SendSoundControlToMixerProcess(&snd_ctrl);
return;
}
-#elif defined(TARGET_SDL)
+#endif
+
for (i=0; i<audio.num_channels; i++)
+ {
+ if (!mixer[i].active)
+ continue;
+
+ if (i != audio.music_channel &&
+ DelayReached(&mixer[i].playing_starttime, SOUND_LOOP_EXPIRATION_TIME))
+ {
+ Mixer_StopChannel(i);
+ continue;
+ }
+
+#if defined(TARGET_SDL)
+
if (!Mix_Playing(i))
Mixer_StopChannel(i);
+
#elif defined(TARGET_ALLEGRO)
- for (i=0; i<audio.num_channels; i++)
- {
- if (!mixer[i].active || IS_LOOP(mixer[i]))
- continue;
mixer[i].playing_pos = voice_get_position(mixer[i].voice);
mixer[i].volume = voice_get_volume(mixer[i].voice);
/* sound sample has completed playing or was completely faded out */
if (mixer[i].playing_pos == -1 || mixer[i].volume == 0)
Mixer_StopChannel(i);
- }
+
#endif /* TARGET_ALLEGRO */
+ }
if (IS_RELOADING(snd_ctrl)) /* load new sound or music files */
{
#define AUDIO_FORMAT_LE (1 << 2)
#define AUDIO_FORMAT_BE (1 << 3)
+/* expiration time (in milliseconds) for sound loops */
+#define SOUND_LOOP_EXPIRATION_TIME 200
+
#if defined(TARGET_SDL)
/* one second fading interval == 1000 ticks (milliseconds) */
#define SOUND_FADING_INTERVAL 1000