mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 07:14:31 +01:00
Add new audio objects for loading sounds
This commit is contained in:
@@ -11,9 +11,11 @@
|
||||
|
||||
#include "../Context.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../audio/AudioChannel.h"
|
||||
#include "../audio/AudioMixer.h"
|
||||
#include "../audio/audio.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../object/AudioObject.h"
|
||||
#include "../object/MusicObject.h"
|
||||
#include "../object/ObjectManager.h"
|
||||
#include "Ride.h"
|
||||
@@ -175,22 +177,31 @@ namespace OpenRCT2::RideAudio
|
||||
|
||||
static void StartRideMusicChannel(const ViewportRideMusicInstance& instance)
|
||||
{
|
||||
auto& objManager = GetContext()->GetObjectManager();
|
||||
|
||||
// Create new music channel
|
||||
auto ride = get_ride(instance.RideId);
|
||||
if (ride->type == RIDE_TYPE_CIRCUS)
|
||||
{
|
||||
auto channel = Mixer_Play_Music(PATH_ID_CSS24, MIXER_LOOP_NONE, true);
|
||||
if (channel != nullptr)
|
||||
ObjectEntryDescriptor desc(ObjectType::Audio, AudioObjectIdentifiers::Rct2Circus);
|
||||
auto audioObj = static_cast<AudioObject*>(objManager.GetLoadedObject(desc));
|
||||
if (audioObj != nullptr)
|
||||
{
|
||||
// Move circus music to the sound mixer group
|
||||
Mixer_Channel_SetGroup(channel, Audio::MixerGroup::Sound);
|
||||
|
||||
_musicChannels.emplace_back(instance, channel);
|
||||
auto source = audioObj->GetSample(0);
|
||||
if (source != nullptr)
|
||||
{
|
||||
auto channel = Mixer_Play_Music(source, MIXER_LOOP_NONE, true);
|
||||
if (channel != nullptr)
|
||||
{
|
||||
// Move circus music to the sound mixer group
|
||||
channel->SetGroup(Audio::MixerGroup::Sound);
|
||||
_musicChannels.emplace_back(instance, channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto& objManager = GetContext()->GetObjectManager();
|
||||
auto musicObj = static_cast<MusicObject*>(objManager.GetLoadedObject(ObjectType::Music, ride->music));
|
||||
if (musicObj != nullptr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user