src/audio/SDL_sysaudio.h
changeset 10757 329d6d46fb90
parent 10737 3406a0f8b041
child 10758 e0fd49c1a5b7
     1.1 --- a/src/audio/SDL_sysaudio.h	Thu Jan 05 19:12:20 2017 -0500
     1.2 +++ b/src/audio/SDL_sysaudio.h	Thu Jan 05 19:29:38 2017 -0500
     1.3 @@ -35,6 +35,8 @@
     1.4  typedef struct SDL_AudioDevice SDL_AudioDevice;
     1.5  #define _THIS   SDL_AudioDevice *_this
     1.6  
     1.7 +typedef struct SDL_AudioStream SDL_AudioStream;
     1.8 +
     1.9  /* Audio targets should call this as devices are added to the system (such as
    1.10     a USB headset being plugged in), and should also be called for
    1.11     for every device found during DetectDevices(). */
    1.12 @@ -123,15 +125,6 @@
    1.13  } SDL_AudioDriver;
    1.14  
    1.15  
    1.16 -/* Streamer */
    1.17 -typedef struct
    1.18 -{
    1.19 -    Uint8 *buffer;
    1.20 -    int max_len;                /* the maximum length in bytes */
    1.21 -    int read_pos, write_pos;    /* the position of the write and read heads in bytes */
    1.22 -} SDL_AudioStreamer;
    1.23 -
    1.24 -
    1.25  /* Define the SDL audio driver structure */
    1.26  struct SDL_AudioDevice
    1.27  {
    1.28 @@ -139,15 +132,14 @@
    1.29      /* Data common to all devices */
    1.30      SDL_AudioDeviceID id;
    1.31  
    1.32 -    /* The current audio specification (shared with audio thread) */
    1.33 +    /* The device's current audio specification */
    1.34      SDL_AudioSpec spec;
    1.35  
    1.36 -    /* An audio conversion block for audio format emulation */
    1.37 -    SDL_AudioCVT convert;
    1.38 +    /* The callback's expected audio specification (converted vs device's spec). */
    1.39 +    SDL_AudioSpec callbackspec;
    1.40  
    1.41 -    /* The streamer, if sample rate conversion necessitates it */
    1.42 -    int use_streamer;
    1.43 -    SDL_AudioStreamer streamer;
    1.44 +    /* Stream that converts and resamples. NULL if not needed. */
    1.45 +    SDL_AudioStream *stream;
    1.46  
    1.47      /* Current state flags */
    1.48      SDL_atomic_t shutdown; /* true if we are signaling the play thread to end. */
    1.49 @@ -158,6 +150,9 @@
    1.50      /* Fake audio buffer for when the audio hardware is busy */
    1.51      Uint8 *fake_stream;
    1.52  
    1.53 +    /* Size, in bytes, of fake_stream. */
    1.54 +    Uint32 fake_stream_len;
    1.55 +
    1.56      /* A mutex for locking the mixing buffers */
    1.57      SDL_mutex *mixer_lock;
    1.58