src/audio/SDL_audio.c
changeset 9145 aa99e029b12e
parent 9032 36c472422d64
child 9148 e9b6e9f4a10e
     1.1 --- a/src/audio/SDL_audio.c	Wed Sep 17 08:59:43 2014 -0300
     1.2 +++ b/src/audio/SDL_audio.c	Wed Sep 17 11:41:12 2014 -0300
     1.3 @@ -1348,17 +1348,26 @@
     1.4  SDL_PauseAudioDevice(SDL_AudioDeviceID devid, int pause_on)
     1.5  {
     1.6      SDL_AudioDevice *device = get_audio_device(devid);
     1.7 -    if (device) {
     1.8 -        current_audio.impl.LockDevice(device);
     1.9 +    if (device && device->paused != pause_on) {
    1.10 +        if (pause_on) {
    1.11 +            current_audio.impl.LockDevice(device);
    1.12 +        }
    1.13          device->paused = pause_on;
    1.14 -        current_audio.impl.UnlockDevice(device);
    1.15 +        if (!pause_on) {
    1.16 +            current_audio.impl.UnlockDevice(device);
    1.17 +        }
    1.18      }
    1.19  }
    1.20  
    1.21  void
    1.22  SDL_PauseAudio(int pause_on)
    1.23  {
    1.24 -    SDL_PauseAudioDevice(1, pause_on);
    1.25 +    int id;
    1.26 +    for (id = 0; id < SDL_arraysize(open_devices); id++) {
    1.27 +        if (open_devices[id] != NULL) {
    1.28 +            SDL_PauseAudioDevice(id+1, pause_on);
    1.29 +        }
    1.30 +    }
    1.31  }
    1.32  
    1.33