void* Mixer_Play_Music(int pathId, int loop, int streaming) { if (gOpenRCT2Headless) return 0; if (streaming) { const utf8 *filename = get_file_path(pathId); SDL_RWops* rw = SDL_RWFromFile(filename, "rb"); if (rw == NULL) { return 0; } Source_SampleStream* source_samplestream = new Source_SampleStream; if (source_samplestream->LoadWAV(rw)) { Channel* channel = gMixer.Play(*source_samplestream, loop, false, true); if (!channel) { delete source_samplestream; } else { channel->SetGroup(MIXER_GROUP_RIDE_MUSIC); } return channel; } else { delete source_samplestream; return 0; } } else { if (gMixer.LoadMusic(pathId)) { Channel* channel = gMixer.Play(*gMixer.musicsources[pathId], MIXER_LOOP_INFINITE, false, false); if (channel) { channel->SetGroup(MIXER_GROUP_RIDE_MUSIC); } return channel; } } return 0; }
void* Mixer_Play_Music(int pathid) { if (gMixer.LoadMusic(pathid)) { return gMixer.Play(gMixer.musicstreams[pathid], MIXER_LOOP_INFINITE, false); } return 0; }
void* Mixer_Play_Effect(int id, int loop, int volume, float pan, double rate, int deleteondone) { if (id >= SOUND_MAXID) { return 0; } gMixer.Lock(); Channel* channel = gMixer.Play(gMixer.css1streams[id], loop, deleteondone != 0); if (channel) { channel->SetVolume(volume); channel->SetPan(pan); channel->SetRate(rate); } gMixer.Unlock(); return channel; }
void* Mixer_Play_Effect(int id, int loop, int volume, float pan, double rate, int deleteondone) { if (gOpenRCT2Headless) return 0; if (!gConfigSound.sound) { return 0; } if (id >= countof(gMixer.css1sources)) { return 0; } gMixer.Lock(); Channel* channel = gMixer.Play(*gMixer.css1sources[id], loop, deleteondone != 0, false); if (channel) { channel->SetVolume(volume); channel->SetPan(pan); channel->SetRate(rate); } gMixer.Unlock(); return channel; }
void* Mixer_Play_Effect(size_t id, int loop, int volume, float pan, double rate, int deleteondone) { if (gOpenRCT2Headless) return 0; if (!gConfigSound.sound_enabled) { return 0; } if (id >= Util::CountOf(gMixer.css1sources)) { log_error("Tried to play an invalid sound id. %i", id); return 0; } gMixer.Lock(); Channel* channel = gMixer.Play(*gMixer.css1sources[id], loop, deleteondone != 0, false); if (channel) { channel->SetVolume(volume); channel->SetPan(pan); channel->SetRate(rate); } gMixer.Unlock(); return channel; }