From: Holger Schemel Date: Fri, 10 May 2002 15:00:51 +0000 (+0200) Subject: rnd-20020510-6-src X-Git-Tag: 2.1.0^2~27 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=61335f530816c74dfe9a299b156a8d239d9bd040 rnd-20020510-6-src --- diff --git a/src/libgame/sound.c b/src/libgame/sound.c index e19de800..5e93bd7a 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -54,20 +54,13 @@ static struct SoundControl mixer[NUM_MIXER_CHANNELS]; static int mixer_active_channels = 0; /* forward declaration of internal functions */ -static void Mixer_Main(void); -static void Mixer_InsertNewSound(struct SoundControl); static void InitAudioDevice(struct AudioFormatInfo *); +static void Mixer_Main(void); -#if defined(PLATFORM_UNIX) -#if !defined(AUDIO_STREAMING_DSP) +#if defined(PLATFORM_UNIX) && !defined(AUDIO_STREAMING_DSP) static unsigned char linear_to_ulaw(int); static int ulaw_to_linear(unsigned char); #endif -#elif defined(PLATFORM_MSDOS) -static void Mixer_InsertNewSound(struct SoundControl); -static void Mixer_StopSound(struct SoundControl); -static void Mixer_StopAllSounds(); -#endif static void ReloadCustomSounds(); static void ReloadCustomMusic(); @@ -298,7 +291,7 @@ void Mixer_InitChannels() mixer_active_channels = 0; } -static void Mixer_PlaySound(int channel) +static void Mixer_PlayChannel(int channel) { #if defined(PLATFORM_MSDOS) mixer[channel].voice = allocate_voice((SAMPLE *)mixer[channel].data_ptr); @@ -315,7 +308,7 @@ static void Mixer_PlaySound(int channel) #endif } -static void Mixer_StopSound(int channel) +static void Mixer_StopChannel(int channel) { #if defined(PLATFORM_MSDOS) voice_set_volume(mixer[channel].voice, 0); @@ -323,9 +316,15 @@ static void Mixer_StopSound(int channel) #endif } -static void Mixer_FadeSound(int channel) +static void Mixer_FadeChannel(int channel) { mixer[channel].state |= SND_CTRL_FADE; + +#if defined(PLATFORM_MSDOS) + if (voice_check(mixer[channel].voice)) + voice_ramp_volume(mixer[channel].voice, 1000, 0); + mixer[channel].state &= ~SND_CTRL_IS_LOOP; +#endif } static void Mixer_RemoveSound(int channel) @@ -337,7 +336,7 @@ static void Mixer_RemoveSound(int channel) printf("REMOVING MIXER SOUND %d\n", channel); #endif - Mixer_StopSound(channel); + Mixer_StopChannel(channel); mixer[channel].active = FALSE; mixer_active_channels--; @@ -507,7 +506,7 @@ static void Mixer_InsertSound(struct SoundControl snd_ctrl) printf("NEW SOUND %d ADDED TO MIXER\n", snd_ctrl.nr); #endif - Mixer_PlaySound(i); + Mixer_PlayChannel(i); break; } @@ -536,13 +535,13 @@ static void HandleSoundRequest(struct SoundControl snd_ctrl) if (IS_MUSIC(snd_ctrl)) { - mixer[audio.music_channel].state |= SND_CTRL_FADE; + Mixer_FadeChannel(audio.music_channel); return; } for(i=audio.first_sound_channel; i