From 6d2616b0ca7471003316e5178479832b0b3319b4 Mon Sep 17 00:00:00 2001 From: zsilencer Date: Wed, 8 Oct 2014 12:15:16 -0600 Subject: [PATCH] fix #513 --- src/audio/audio.c | 2 +- src/audio/mixer.cpp | 6 +++--- src/audio/mixer.h | 2 +- src/peep/peep.c | 9 +++++++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/audio/audio.c b/src/audio/audio.c index 838569438f..5ff65ffb31 100644 --- a/src/audio/audio.c +++ b/src/audio/audio.c @@ -1336,7 +1336,7 @@ void start_title_music() if ((RCT2_GLOBAL(0x009AF284, uint32) & (1 << 0)) && RCT2_GLOBAL(0x009AF59D, uint8) & 1 && RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 1) { if (!RCT2_GLOBAL(0x009AF600, uint8)) { #ifdef USE_MIXER - gMusicChannels[3] = Mixer_Play_Music(gMusicChannels[3], PATH_ID_CSS17); + gMusicChannels[3] = Mixer_Play_Music(PATH_ID_CSS17); #else RCT2_GLOBAL(0x014241BC, uint32) = 1; int result = sound_channel_load_file2(3, (char*)get_file_path(PATH_ID_CSS17), 0); diff --git a/src/audio/mixer.cpp b/src/audio/mixer.cpp index 0f068fa202..f71c7bda8e 100644 --- a/src/audio/mixer.cpp +++ b/src/audio/mixer.cpp @@ -563,10 +563,10 @@ int Mixer_Channel_IsPlaying(void* channel) return ((Channel*)channel)->IsPlaying(); } -void* Mixer_Play_Music(void* channel, int pathid) +void* Mixer_Play_Music(int pathid) { - if (!(Channel*)channel && gMixer.LoadMusic(pathid)) { + if (gMixer.LoadMusic(pathid)) { return gMixer.Play(gMixer.musicstreams[pathid], MIXER_LOOP_INFINITE, false); } - return channel; + return 0; } \ No newline at end of file diff --git a/src/audio/mixer.h b/src/audio/mixer.h index 16ef5e896b..58c5c841ef 100644 --- a/src/audio/mixer.h +++ b/src/audio/mixer.h @@ -150,7 +150,7 @@ void Mixer_Channel_Volume(void* channel, int volume); void Mixer_Channel_Pan(void* channel, float pan); void Mixer_Channel_Rate(void* channel, double rate); int Mixer_Channel_IsPlaying(void* channel); -void* Mixer_Play_Music(void* channel, int pathid); +void* Mixer_Play_Music(int pathid); static int DStoMixerVolume(int volume) { return (int)(SDL_MIX_MAXVOLUME * (SDL_pow(10, (float)volume / 2000))); }; static float DStoMixerPan(int pan) { return (((float)pan + -DSBPAN_LEFT) / DSBPAN_RIGHT) / 2; }; diff --git a/src/peep/peep.c b/src/peep/peep.c index e22e44c237..7412b278f5 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -339,7 +339,7 @@ void peep_update_crowd_noise() visiblePeeps = 0; FOR_ALL_GUESTS(spriteIndex, peep) { - if (peep->var_16 == 0x8000) + if (peep->var_16 == (sint16)0x8000) continue; if (viewport->view_x > peep->var_1A) continue; @@ -362,7 +362,12 @@ void peep_update_crowd_noise() if (visiblePeeps < 0) { // Mute crowd noise if (RCT2_GLOBAL(0x009AF5FC, uint32) != 1) { +#ifdef USE_MIXER + Mixer_Stop_Channel(gMusicChannels[2]); + gMusicChannels[2] = 0; +#else sound_channel_stop(2); //RCT2_CALLPROC_1(0x00401A05, int, 2); +#endif RCT2_GLOBAL(0x009AF5FC, uint32) = 1; } } else { @@ -378,7 +383,7 @@ void peep_update_crowd_noise() if (RCT2_GLOBAL(0x009AF5FC, uint32) == 1) { // Load and play crowd noise #ifdef USE_MIXER - gMusicChannels[2] = Mixer_Play_Music(gMusicChannels[2], PATH_ID_CSS2); + gMusicChannels[2] = Mixer_Play_Music(PATH_ID_CSS2); if (gMusicChannels[2]) { Mixer_Channel_Volume(gMusicChannels[2], DStoMixerVolume(volume)); RCT2_GLOBAL(0x009AF5FC, uint32) = volume;