X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsound.c;h=414ab122befa69174fd501a16ec44763f0a41797;hb=86e110774e5210b326e6867b134bd638d93554d3;hp=b29d5dd62616a3dc9b1f245b2cb83707b9cf6397;hpb=cb5fe20318d9b2c18cb82bc1f7197150cfba7bc0;p=rocksndiamonds.git diff --git a/src/libgame/sound.c b/src/libgame/sound.c index b29d5dd6..414ab122 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -71,6 +71,8 @@ #define SOUND_VOLUME_LEFT(x) (stereo_volume[x]) #define SOUND_VOLUME_RIGHT(x) (stereo_volume[SOUND_MAX_LEFT2RIGHT-x]) +#define SAME_SOUND_NR(x,y) ((x).nr == (y).nr) +#define SAME_SOUND_DATA(x,y) ((x).data_ptr == (y).data_ptr) #if 0 struct SoundHeader_SUN @@ -826,9 +828,9 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) return; } - /* check if sound is already being played (and how often) */ + /* check if (and how often) this sound sample is already playing */ for (k=0, i=audio.first_sound_channel; i= 2) { @@ -878,7 +884,7 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) int playing_time = playing_current - mixer[i].playing_starttime; int actual; - if (!mixer[i].active || mixer[i].nr != snd_ctrl.nr) + if (!mixer[i].active || !SAME_SOUND_NR(mixer[i], snd_ctrl)) continue; actual = 1000 * playing_time / mixer[i].data_len; @@ -1008,7 +1014,7 @@ static void HandleSoundRequest(SoundControl snd_ctrl) } for(i=audio.first_sound_channel; i