X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Flibgame%2Fsound.c;h=e7cd64613e149132c4c7d875b8b18b7530543ed5;hp=cd34b284473e3126a0191fc3074f7005793fd0e0;hb=463778af29aada177d4a00c566653b92be3b507a;hpb=2fc3381a6d44fe617388ac019170910e337bb07e diff --git a/src/libgame/sound.c b/src/libgame/sound.c index cd34b284..e7cd6461 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -803,11 +803,8 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) int i, k; #if 0 - printf("NEW SOUND %d HAS ARRIVED [%d]\n", snd_ctrl.nr, num_sounds); -#endif - -#if 0 - printf("%d ACTIVE CHANNELS\n", mixer_active_channels); + printf("NEW SOUND %d ARRIVED [%d] [%d ACTIVE CHANNELS]\n", + snd_ctrl.nr, num_sounds, mixer_active_channels); #endif if (IS_MUSIC(snd_ctrl)) @@ -833,10 +830,7 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) /* play music samples on a dedicated music channel */ if (IS_MUSIC(snd_ctrl)) { -#if 0 - printf("PLAY MUSIC WITH VOLUME/STEREO %d/%d\n", - snd_ctrl.volume, snd_ctrl.stereo_position); -#endif + Mixer_StopMusicChannel(); mixer[audio.music_channel] = snd_ctrl; Mixer_PlayMusicChannel(); @@ -921,12 +915,36 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) of the channel's sound sample when compiling with the SDL mixer library, we use the current playing time (in milliseconds) instead. */ +#if DEBUG + /* Channel sanity check -- this should normally not be needed */ + if (mixer_active_channels == + audio.num_channels - (mixer[audio.music_channel].active ? 0 : 1)) + { + for (i=audio.first_sound_channel; idata_len == 0) { printf("THIS SHOULD NEVER HAPPEN! [snd_info->data_len == 0]\n"); } #endif -#endif - -#if 1 - if (IS_MUSIC(snd_ctrl) && i == audio.music_channel && mixer[i].active) - { - printf("THIS SHOULD NEVER HAPPEN! [adding music twice]\n"); - -#if 1 - Mixer_StopChannel(i); -#endif - } -#endif mixer[i] = snd_ctrl; Mixer_PlayChannel(i);