audio: changed some internal ints to be SDL_bools.
authorRyan C. Gordon
Mon, 01 Aug 2016 13:32:27 -0400
changeset 10235cd7beec0f654
parent 10234 d188ffeca506
child 10236 a9231c55e5cc
audio: changed some internal ints to be SDL_bools.
src/audio/SDL_audio.c
src/audio/SDL_sysaudio.h
src/audio/qsa/SDL_qsa_audio.c
src/audio/qsa/SDL_qsa_audio.h
     1.1 --- a/src/audio/SDL_audio.c	Mon Aug 01 11:47:02 2016 -0400
     1.2 +++ b/src/audio/SDL_audio.c	Mon Aug 01 13:32:27 2016 -0400
     1.3 @@ -373,7 +373,7 @@
     1.4      /* Ends the audio callback and mark the device as STOPPED, but the
     1.5         app still needs to close the device to free resources. */
     1.6      current_audio.impl.LockDevice(device);
     1.7 -    device->enabled = 0;
     1.8 +    device->enabled = SDL_FALSE;
     1.9      current_audio.impl.UnlockDevice(device);
    1.10  
    1.11      /* Post the event, if desired */
    1.12 @@ -873,7 +873,7 @@
    1.13  static void
    1.14  close_audio_device(SDL_AudioDevice * device)
    1.15  {
    1.16 -    device->enabled = 0;
    1.17 +    device->enabled = SDL_FALSE;
    1.18      SDL_AtomicSet(&device->shutdown, 1);
    1.19      if (device->thread != NULL) {
    1.20          SDL_WaitThread(device->thread, NULL);
    1.21 @@ -887,7 +887,7 @@
    1.22      }
    1.23      if (device->opened) {
    1.24          current_audio.impl.CloseDevice(device);
    1.25 -        device->opened = 0;
    1.26 +        device->opened = SDL_FALSE;
    1.27      }
    1.28  
    1.29      free_audio_queue(device->buffer_queue_head);
    1.30 @@ -1074,11 +1074,12 @@
    1.31          return 0;
    1.32      }
    1.33      SDL_zerop(device);
    1.34 +    SDL_AtomicSet(&device->shutdown, 0);  /* just in case. */
    1.35      device->id = id + 1;
    1.36      device->spec = *obtained;
    1.37 -    device->enabled = 1;
    1.38 -    device->paused = 1;
    1.39 -    device->iscapture = iscapture;
    1.40 +    device->enabled = SDL_TRUE;
    1.41 +    device->paused = SDL_TRUE;
    1.42 +    device->iscapture = iscapture ? SDL_TRUE : SDL_FALSE;
    1.43  
    1.44      /* Create a mutex for locking the sound buffers */
    1.45      if (!current_audio.impl.SkipMixerLock) {
    1.46 @@ -1094,7 +1095,7 @@
    1.47          close_audio_device(device);
    1.48          return 0;
    1.49      }
    1.50 -    device->opened = 1;
    1.51 +    device->opened = SDL_TRUE;
    1.52  
    1.53      /* See if we need to do any conversion */
    1.54      build_cvt = SDL_FALSE;
    1.55 @@ -1278,7 +1279,7 @@
    1.56      SDL_AudioDevice *device = get_audio_device(devid);
    1.57      if (device) {
    1.58          current_audio.impl.LockDevice(device);
    1.59 -        device->paused = pause_on;
    1.60 +        device->paused = pause_on ? SDL_TRUE : SDL_FALSE;
    1.61          current_audio.impl.UnlockDevice(device);
    1.62      }
    1.63  }
     2.1 --- a/src/audio/SDL_sysaudio.h	Mon Aug 01 11:47:02 2016 -0400
     2.2 +++ b/src/audio/SDL_sysaudio.h	Mon Aug 01 13:32:27 2016 -0400
     2.3 @@ -158,11 +158,10 @@
     2.4  
     2.5      /* Current state flags */
     2.6      SDL_atomic_t shutdown; /* true if we are signaling the play thread to end. */
     2.7 -    /* !!! FIXME: these should be SDL_bool */
     2.8 -    int iscapture;
     2.9 -    int enabled;  /* true if device is functioning and connected. */
    2.10 -    int paused;
    2.11 -    int opened;
    2.12 +    SDL_bool iscapture;
    2.13 +    SDL_bool enabled;  /* true if device is functioning and connected. */
    2.14 +    SDL_bool paused;
    2.15 +    SDL_bool opened;
    2.16  
    2.17      /* Fake audio buffer for when the audio hardware is busy */
    2.18      Uint8 *fake_stream;
     3.1 --- a/src/audio/qsa/SDL_qsa_audio.c	Mon Aug 01 11:47:02 2016 -0400
     3.2 +++ b/src/audio/qsa/SDL_qsa_audio.c	Mon Aug 01 13:32:27 2016 -0400
     3.3 @@ -371,7 +371,7 @@
     3.4      QSA_InitAudioParams(&cparams);
     3.5  
     3.6      /* Initialize channel direction: capture or playback */
     3.7 -    this->hidden->iscapture = iscapture;
     3.8 +    this->hidden->iscapture = iscapture ? SDL_TRUE : SDL_FALSE;
     3.9  
    3.10      if (device != NULL) {
    3.11          /* Open requested audio device */
     4.1 --- a/src/audio/qsa/SDL_qsa_audio.h	Mon Aug 01 11:47:02 2016 -0400
     4.2 +++ b/src/audio/qsa/SDL_qsa_audio.h	Mon Aug 01 13:32:27 2016 -0400
     4.3 @@ -34,7 +34,7 @@
     4.4  struct SDL_PrivateAudioData
     4.5  {
     4.6      /* SDL capture state */
     4.7 -    int iscapture;
     4.8 +    SDL_bool iscapture;
     4.9  
    4.10      /* The audio device handle */
    4.11      int cardno;