Fixed a sound locking bug.
authorFlorian Schulze <crow@icculus.org>
Wed, 20 Feb 2002 21:23:31 +0000 (21:23 +0000)
committerFlorian Schulze <crow@icculus.org>
Wed, 20 Feb 2002 21:23:31 +0000 (21:23 +0000)
sdl/sound.c

index 5b5a59d..b782364 100644 (file)
@@ -314,7 +314,6 @@ void dj_play_sfx(unsigned char sfx_num, unsigned short freq, char volume, char p
 {
        int slot;
 
-       SDL_LockAudio();
        if (channel<0) {
                for (slot=0; slot<MAX_CHANNELS; slot++)
                        if (channelinfo[slot].data==NULL)
@@ -324,6 +323,7 @@ void dj_play_sfx(unsigned char sfx_num, unsigned short freq, char volume, char p
        } else
                slot = channel;
 
+       SDL_LockAudio();
        addsfx((short *)sounds[sfx_num].buf, sounds[sfx_num].length, sounds[sfx_num].loop, freq, slot);
        updateSoundParams(slot, volume*2);
        SDL_UnlockAudio();