X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fsound.c;fp=src%2Fsound.c;h=d2cdbc724d0e9d781aa664bd7d03d8f60e199b4c;hb=6d639c557d602855b9866959445f3f5b5513d289;hp=e89a153fd665db256c4306e1c231632227e83446;hpb=41cfe645942062496cd063eb46e17d677a76c645;p=rocksndiamonds.git diff --git a/src/sound.c b/src/sound.c index e89a153f..d2cdbc72 100644 --- a/src/sound.c +++ b/src/sound.c @@ -830,17 +830,6 @@ void PlaySoundExt(int nr, int volume, int stereo, boolean loop) { struct SoundControl snd_ctrl = emptySoundControl; -#ifdef USE_SDL_LIBRARY - Mix_PlayChannel(-1, Sound[nr].mix_chunk, 0); - - /* - Mix_Volume(-1, SDL_MIX_MAXVOLUME / 4); - Mix_VolumeMusic(SDL_MIX_MAXVOLUME / 4); - */ - - return; -#endif - if (sound_status==SOUND_OFF || !setup.sound) return; @@ -862,6 +851,14 @@ void PlaySoundExt(int nr, int volume, int stereo, boolean loop) snd_ctrl.data_ptr = Sound[nr].data_ptr; snd_ctrl.data_len = Sound[nr].data_len; +#ifdef USE_SDL_LIBRARY + + Mix_Volume(-1, SDL_MIX_MAXVOLUME / 4); + Mix_VolumeMusic(SDL_MIX_MAXVOLUME / 4); + + Mix_PlayChannel(-1, Sound[nr].mix_chunk, (loop ? -1 : 0)); + +#else #ifndef MSDOS if (write(sound_pipe[1], &snd_ctrl, sizeof(snd_ctrl))<0) { @@ -872,6 +869,7 @@ void PlaySoundExt(int nr, int volume, int stereo, boolean loop) #else sound_handler(snd_ctrl); #endif +#endif } void FadeSound(int nr) @@ -898,11 +896,6 @@ void StopSoundExt(int nr, int method) { struct SoundControl snd_ctrl = emptySoundControl; -#ifdef USE_SDL_LIBRARY - Mix_HaltMusic(); - return; -#endif - if (sound_status==SOUND_OFF) return; @@ -917,6 +910,20 @@ void StopSoundExt(int nr, int method) snd_ctrl.stop_sound = TRUE; } +#ifdef USE_SDL_LIBRARY + + if (SSND_FADING(method)) + { + Mix_FadeOutChannel(-1, 1000); + Mix_FadeOutMusic(1000); + } + else + { + Mix_HaltChannel(-1); + Mix_HaltMusic(); + } + +#else #ifndef MSDOS if (write(sound_pipe[1], &snd_ctrl, sizeof(snd_ctrl))<0) { @@ -927,6 +934,7 @@ void StopSoundExt(int nr, int method) #else sound_handler(snd_ctrl); #endif +#endif } void FreeSounds(int num_sounds)