diff --git a/audio/drivers/alsa.c b/audio/drivers/alsa.c index dbdc935e69..c76cd5e569 100644 --- a/audio/drivers/alsa.c +++ b/audio/drivers/alsa.c @@ -28,8 +28,8 @@ typedef struct alsa { snd_pcm_t *pcm; size_t buffer_size; - bool nonblock; unsigned int frame_bits; + bool nonblock; bool has_float; bool can_pause; bool is_paused; diff --git a/audio/drivers/alsa_qsa.c b/audio/drivers/alsa_qsa.c index d192370bb7..f168ceab90 100644 --- a/audio/drivers/alsa_qsa.c +++ b/audio/drivers/alsa_qsa.c @@ -29,18 +29,18 @@ typedef struct alsa { uint8_t **buffer; + snd_pcm_t *pcm; uint8_t *buffer_chunk; unsigned buffer_index; unsigned buffer_ptr; volatile unsigned buffered_blocks; - snd_pcm_t *pcm; + unsigned buf_size; + unsigned buf_count; bool nonblock; bool has_float; bool can_pause; bool is_paused; - unsigned buf_size; - unsigned buf_count; } alsa_qsa_t; typedef long snd_pcm_sframes_t; diff --git a/audio/drivers/alsathread.c b/audio/drivers/alsathread.c index 339803fd49..a9d7efab54 100644 --- a/audio/drivers/alsathread.c +++ b/audio/drivers/alsathread.c @@ -33,20 +33,18 @@ typedef struct alsa_thread { snd_pcm_t *pcm; - bool nonblock; - bool is_paused; - bool has_float; - volatile bool thread_dead; - - size_t buffer_size; - size_t period_size; - snd_pcm_uframes_t period_frames; - fifo_buffer_t *buffer; sthread_t *worker_thread; slock_t *fifo_lock; scond_t *cond; slock_t *cond_lock; + size_t buffer_size; + size_t period_size; + snd_pcm_uframes_t period_frames; + bool nonblock; + bool is_paused; + bool has_float; + volatile bool thread_dead; } alsa_thread_t; static void alsa_worker_thread(void *data) diff --git a/audio/drivers/audioio.c b/audio/drivers/audioio.c index 66a219ec3c..82950ee541 100644 --- a/audio/drivers/audioio.c +++ b/audio/drivers/audioio.c @@ -36,9 +36,9 @@ static void *audioio_init(const char *device, unsigned rate, unsigned latency, unsigned block_frames, unsigned *new_out_rate) { - int *fd = (int*)calloc(1, sizeof(int)); - const char *audiodev = device ? device : DEFAULT_DEV; struct audio_info info; + const char *audiodev = device ? device : DEFAULT_DEV; + int *fd = (int*)calloc(1, sizeof(int)); if (!fd) return NULL; diff --git a/audio/drivers/coreaudio.c b/audio/drivers/coreaudio.c index 6354fcb6df..1f4fd7ae76 100644 --- a/audio/drivers/coreaudio.c +++ b/audio/drivers/coreaudio.c @@ -38,18 +38,16 @@ typedef struct coreaudio { slock_t *lock; scond_t *cond; - #if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__))) ComponentInstance dev; #else AudioComponentInstance dev; #endif + fifo_buffer_t *buffer; + size_t buffer_size; bool dev_alive; bool is_paused; - - fifo_buffer_t *buffer; bool nonblock; - size_t buffer_size; } coreaudio_t; #if TARGET_OS_IOS diff --git a/audio/drivers/coreaudio3.m b/audio/drivers/coreaudio3.m index 4519e7220c..8e35241435 100644 --- a/audio/drivers/coreaudio3.m +++ b/audio/drivers/coreaudio3.m @@ -30,9 +30,9 @@ typedef struct ringbuffer { float *buffer; size_t cap; - atomic_int len; size_t write_ptr; size_t read_ptr; + atomic_int len; } ringbuffer_t; typedef ringbuffer_t * ringbuffer_h; diff --git a/audio/drivers/ctr_csnd_audio.c b/audio/drivers/ctr_csnd_audio.c index d45fe4f9aa..165d226e74 100644 --- a/audio/drivers/ctr_csnd_audio.c +++ b/audio/drivers/ctr_csnd_audio.c @@ -23,8 +23,8 @@ typedef struct { - bool nonblock; - bool playing; + uint64_t cpu_ticks_last; + int16_t* l; int16_t* r; @@ -34,7 +34,8 @@ typedef struct uint32_t pos; uint32_t playpos; - uint64_t cpu_ticks_last; + bool nonblock; + bool playing; } ctr_csnd_audio_t; #define CTR_CSND_AUDIO_COUNT (1u << 11u) diff --git a/audio/drivers/ctr_dsp_audio.c b/audio/drivers/ctr_dsp_audio.c index 58ec8a13e3..68d8121cca 100644 --- a/audio/drivers/ctr_dsp_audio.c +++ b/audio/drivers/ctr_dsp_audio.c @@ -22,12 +22,11 @@ typedef struct { + ndspWaveBuf dsp_buf; /* TODO/FIXME - find out alignment */ + int channel; + uint32_t pos; bool nonblock; bool playing; - int channel; - ndspWaveBuf dsp_buf; - - uint32_t pos; } ctr_dsp_audio_t; #define CTR_DSP_AUDIO_COUNT (1u << 11u) diff --git a/audio/drivers/gx_audio.c b/audio/drivers/gx_audio.c index 29679fd986..9119356235 100644 --- a/audio/drivers/gx_audio.c +++ b/audio/drivers/gx_audio.c @@ -32,13 +32,11 @@ typedef struct { + size_t write_ptr; uint32_t data[BLOCKS][CHUNK_FRAMES]; - volatile unsigned dma_busy; volatile unsigned dma_next; volatile unsigned dma_write; - size_t write_ptr; - bool nonblock; bool is_paused; } gx_audio_t; diff --git a/audio/drivers/jack.c b/audio/drivers/jack.c index 053d62b654..7c144fb873 100644 --- a/audio/drivers/jack.c +++ b/audio/drivers/jack.c @@ -36,15 +36,14 @@ typedef struct jack jack_client_t *client; jack_port_t *ports[2]; jack_ringbuffer_t *buffer[2]; - volatile bool shutdown; - bool nonblock; - bool is_paused; - #ifdef HAVE_THREADS scond_t *cond; slock_t *cond_lock; #endif size_t buffer_size; + volatile bool shutdown; + bool nonblock; + bool is_paused; } jack_t; static int process_cb(jack_nframes_t nframes, void *data) diff --git a/audio/drivers/openal.c b/audio/drivers/openal.c index 109edb83ee..ce540c14a9 100644 --- a/audio/drivers/openal.c +++ b/audio/drivers/openal.c @@ -43,17 +43,14 @@ typedef struct al ALuint source; ALuint *buffers; ALuint *res_buf; - size_t res_ptr; - ALenum format; - size_t num_buffers; - int rate; - - uint8_t tmpbuf[BUFSIZE]; - size_t tmpbuf_ptr; - ALCdevice *handle; ALCcontext *ctx; - + size_t res_ptr; + size_t num_buffers; + size_t tmpbuf_ptr; + int rate; + ALenum format; + uint8_t tmpbuf[BUFSIZE]; bool nonblock; bool is_paused; } al_t; diff --git a/audio/drivers/opensl.c b/audio/drivers/opensl.c index 4d02b15d14..6e33a466d6 100644 --- a/audio/drivers/opensl.c +++ b/audio/drivers/opensl.c @@ -37,9 +37,6 @@ typedef struct sl { uint8_t **buffer; uint8_t *buffer_chunk; - unsigned buffer_index; - unsigned buffer_ptr; - volatile unsigned buffered_blocks; SLObjectItf engine_object; SLEngineItf engine; @@ -51,10 +48,13 @@ typedef struct sl slock_t *lock; scond_t *cond; - bool nonblock; - bool is_paused; unsigned buf_size; unsigned buf_count; + unsigned buffer_index; + unsigned buffer_ptr; + volatile unsigned buffered_blocks; + bool nonblock; + bool is_paused; } sl_t; static void opensl_callback(SLAndroidSimpleBufferQueueItf bq, void *ctx) diff --git a/audio/drivers/oss.c b/audio/drivers/oss.c index 73b4a61eeb..919bb86753 100644 --- a/audio/drivers/oss.c +++ b/audio/drivers/oss.c @@ -42,6 +42,7 @@ #define DEFAULT_OSS_DEV "/dev/dsp" #endif +/* TODO/FIXME - static global variable */ static bool oss_is_paused = false; static void *oss_init(const char *device, unsigned rate, unsigned latency, diff --git a/audio/drivers/ps2_audio.c b/audio/drivers/ps2_audio.c index 9b9e77cb45..87aef95c8f 100644 --- a/audio/drivers/ps2_audio.c +++ b/audio/drivers/ps2_audio.c @@ -32,7 +32,6 @@ typedef struct ps2_audio /* TODO/FIXME - nonblock is not implemented */ bool nonblock; bool running; - } ps2_audio_t; static void audioConfigure(ps2_audio_t *ps2, unsigned rate) diff --git a/audio/drivers/ps3_audio.c b/audio/drivers/ps3_audio.c index d8ffa73805..c0e057eca9 100644 --- a/audio/drivers/ps3_audio.c +++ b/audio/drivers/ps3_audio.c @@ -28,16 +28,15 @@ typedef struct { - uint32_t audio_port; - bool nonblock; - bool started; - volatile bool quit_thread; fifo_buffer_t *buffer; - sys_ppu_thread_t thread; sys_lwmutex_t lock; sys_lwmutex_t cond_lock; sys_lwcond_t cond; + uint32_t audio_port; + bool nonblock; + bool started; + volatile bool quit_thread; } ps3_audio_t; #ifdef __PSL1GHT__ diff --git a/audio/drivers/psp_audio.c b/audio/drivers/psp_audio.c index f0aa81b10b..ef34867c70 100644 --- a/audio/drivers/psp_audio.c +++ b/audio/drivers/psp_audio.c @@ -44,23 +44,23 @@ typedef struct psp_audio { - bool nonblock; - uint32_t* buffer; uint32_t* zeroBuffer; - SceUID thread; - int rate; - - volatile bool running; - volatile uint16_t read_pos; - volatile uint16_t write_pos; - sthread_t *worker_thread; slock_t *fifo_lock; scond_t *cond; slock_t *cond_lock; + SceUID thread; + + int rate; + + volatile uint16_t read_pos; + volatile uint16_t write_pos; + + volatile bool running; + bool nonblock; } psp_audio_t; #define AUDIO_OUT_COUNT 512u diff --git a/audio/drivers/rsound.c b/audio/drivers/rsound.c index b5d10ebf99..98c1da4609 100644 --- a/audio/drivers/rsound.c +++ b/audio/drivers/rsound.c @@ -27,14 +27,14 @@ typedef struct rsd { rsound_t *rd; + + fifo_buffer_t *buffer; + slock_t *cond_lock; + scond_t *cond; + bool nonblock; bool is_paused; volatile bool has_error; - - fifo_buffer_t *buffer; - - slock_t *cond_lock; - scond_t *cond; } rsd_t; static ssize_t rsound_audio_cb(void *data, size_t bytes, void *userdata) diff --git a/audio/drivers/rwebaudio.c b/audio/drivers/rwebaudio.c index 8723e29a55..151163d0a4 100644 --- a/audio/drivers/rwebaudio.c +++ b/audio/drivers/rwebaudio.c @@ -30,6 +30,8 @@ void RWebAudioSetNonblockState(bool state); void RWebAudioFree(void); size_t RWebAudioWriteAvail(void); size_t RWebAudioBufferSize(void); + +/* TODO/FIXME - static global variable */ static bool rwebaudio_is_paused; static void rwebaudio_free(void *data) diff --git a/audio/drivers/sdl_audio.c b/audio/drivers/sdl_audio.c index 5f03253eac..80fa1bd7cb 100644 --- a/audio/drivers/sdl_audio.c +++ b/audio/drivers/sdl_audio.c @@ -33,14 +33,13 @@ typedef struct sdl_audio { - bool nonblock; - bool is_paused; - #ifdef HAVE_THREADS slock_t *lock; scond_t *cond; #endif fifo_buffer_t *buffer; + bool nonblock; + bool is_paused; } sdl_audio_t; static void sdl_audio_cb(void *data, Uint8 *stream, int len) diff --git a/audio/drivers/wiiu_audio.c b/audio/drivers/wiiu_audio.c index 9bdfa5c5ee..f493721780 100644 --- a/audio/drivers/wiiu_audio.c +++ b/audio/drivers/wiiu_audio.c @@ -31,11 +31,10 @@ typedef struct AXMVoice* mvoice; uint16_t* buffer_l; uint16_t* buffer_r; - bool nonblock; - + OSSpinLock spinlock; uint32_t pos; uint32_t written; - OSSpinLock spinlock; + bool nonblock; } ax_audio_t; /* 3072 samples main buffer, 64ms total */