(Audio) reorder structs/alignment (don't touch Switch audio drivers
for now)
This commit is contained in:
parent
b546fddf86
commit
13604b047f
|
@ -28,8 +28,8 @@ typedef struct alsa
|
||||||
{
|
{
|
||||||
snd_pcm_t *pcm;
|
snd_pcm_t *pcm;
|
||||||
size_t buffer_size;
|
size_t buffer_size;
|
||||||
bool nonblock;
|
|
||||||
unsigned int frame_bits;
|
unsigned int frame_bits;
|
||||||
|
bool nonblock;
|
||||||
bool has_float;
|
bool has_float;
|
||||||
bool can_pause;
|
bool can_pause;
|
||||||
bool is_paused;
|
bool is_paused;
|
||||||
|
|
|
@ -29,18 +29,18 @@
|
||||||
typedef struct alsa
|
typedef struct alsa
|
||||||
{
|
{
|
||||||
uint8_t **buffer;
|
uint8_t **buffer;
|
||||||
|
snd_pcm_t *pcm;
|
||||||
uint8_t *buffer_chunk;
|
uint8_t *buffer_chunk;
|
||||||
unsigned buffer_index;
|
unsigned buffer_index;
|
||||||
unsigned buffer_ptr;
|
unsigned buffer_ptr;
|
||||||
volatile unsigned buffered_blocks;
|
volatile unsigned buffered_blocks;
|
||||||
|
|
||||||
snd_pcm_t *pcm;
|
unsigned buf_size;
|
||||||
|
unsigned buf_count;
|
||||||
bool nonblock;
|
bool nonblock;
|
||||||
bool has_float;
|
bool has_float;
|
||||||
bool can_pause;
|
bool can_pause;
|
||||||
bool is_paused;
|
bool is_paused;
|
||||||
unsigned buf_size;
|
|
||||||
unsigned buf_count;
|
|
||||||
} alsa_qsa_t;
|
} alsa_qsa_t;
|
||||||
|
|
||||||
typedef long snd_pcm_sframes_t;
|
typedef long snd_pcm_sframes_t;
|
||||||
|
|
|
@ -33,20 +33,18 @@
|
||||||
typedef struct alsa_thread
|
typedef struct alsa_thread
|
||||||
{
|
{
|
||||||
snd_pcm_t *pcm;
|
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;
|
fifo_buffer_t *buffer;
|
||||||
sthread_t *worker_thread;
|
sthread_t *worker_thread;
|
||||||
slock_t *fifo_lock;
|
slock_t *fifo_lock;
|
||||||
scond_t *cond;
|
scond_t *cond;
|
||||||
slock_t *cond_lock;
|
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;
|
} alsa_thread_t;
|
||||||
|
|
||||||
static void alsa_worker_thread(void *data)
|
static void alsa_worker_thread(void *data)
|
||||||
|
|
|
@ -36,9 +36,9 @@ static void *audioio_init(const char *device, unsigned rate, unsigned latency,
|
||||||
unsigned block_frames,
|
unsigned block_frames,
|
||||||
unsigned *new_out_rate)
|
unsigned *new_out_rate)
|
||||||
{
|
{
|
||||||
int *fd = (int*)calloc(1, sizeof(int));
|
|
||||||
const char *audiodev = device ? device : DEFAULT_DEV;
|
|
||||||
struct audio_info info;
|
struct audio_info info;
|
||||||
|
const char *audiodev = device ? device : DEFAULT_DEV;
|
||||||
|
int *fd = (int*)calloc(1, sizeof(int));
|
||||||
|
|
||||||
if (!fd)
|
if (!fd)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -38,18 +38,16 @@ typedef struct coreaudio
|
||||||
{
|
{
|
||||||
slock_t *lock;
|
slock_t *lock;
|
||||||
scond_t *cond;
|
scond_t *cond;
|
||||||
|
|
||||||
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
|
#if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__)))
|
||||||
ComponentInstance dev;
|
ComponentInstance dev;
|
||||||
#else
|
#else
|
||||||
AudioComponentInstance dev;
|
AudioComponentInstance dev;
|
||||||
#endif
|
#endif
|
||||||
|
fifo_buffer_t *buffer;
|
||||||
|
size_t buffer_size;
|
||||||
bool dev_alive;
|
bool dev_alive;
|
||||||
bool is_paused;
|
bool is_paused;
|
||||||
|
|
||||||
fifo_buffer_t *buffer;
|
|
||||||
bool nonblock;
|
bool nonblock;
|
||||||
size_t buffer_size;
|
|
||||||
} coreaudio_t;
|
} coreaudio_t;
|
||||||
|
|
||||||
#if TARGET_OS_IOS
|
#if TARGET_OS_IOS
|
||||||
|
|
|
@ -30,9 +30,9 @@ typedef struct ringbuffer
|
||||||
{
|
{
|
||||||
float *buffer;
|
float *buffer;
|
||||||
size_t cap;
|
size_t cap;
|
||||||
atomic_int len;
|
|
||||||
size_t write_ptr;
|
size_t write_ptr;
|
||||||
size_t read_ptr;
|
size_t read_ptr;
|
||||||
|
atomic_int len;
|
||||||
} ringbuffer_t;
|
} ringbuffer_t;
|
||||||
|
|
||||||
typedef ringbuffer_t * ringbuffer_h;
|
typedef ringbuffer_t * ringbuffer_h;
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
bool nonblock;
|
uint64_t cpu_ticks_last;
|
||||||
bool playing;
|
|
||||||
int16_t* l;
|
int16_t* l;
|
||||||
int16_t* r;
|
int16_t* r;
|
||||||
|
|
||||||
|
@ -34,7 +34,8 @@ typedef struct
|
||||||
uint32_t pos;
|
uint32_t pos;
|
||||||
|
|
||||||
uint32_t playpos;
|
uint32_t playpos;
|
||||||
uint64_t cpu_ticks_last;
|
bool nonblock;
|
||||||
|
bool playing;
|
||||||
} ctr_csnd_audio_t;
|
} ctr_csnd_audio_t;
|
||||||
|
|
||||||
#define CTR_CSND_AUDIO_COUNT (1u << 11u)
|
#define CTR_CSND_AUDIO_COUNT (1u << 11u)
|
||||||
|
|
|
@ -22,12 +22,11 @@
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
ndspWaveBuf dsp_buf; /* TODO/FIXME - find out alignment */
|
||||||
|
int channel;
|
||||||
|
uint32_t pos;
|
||||||
bool nonblock;
|
bool nonblock;
|
||||||
bool playing;
|
bool playing;
|
||||||
int channel;
|
|
||||||
ndspWaveBuf dsp_buf;
|
|
||||||
|
|
||||||
uint32_t pos;
|
|
||||||
} ctr_dsp_audio_t;
|
} ctr_dsp_audio_t;
|
||||||
|
|
||||||
#define CTR_DSP_AUDIO_COUNT (1u << 11u)
|
#define CTR_DSP_AUDIO_COUNT (1u << 11u)
|
||||||
|
|
|
@ -32,13 +32,11 @@
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
size_t write_ptr;
|
||||||
uint32_t data[BLOCKS][CHUNK_FRAMES];
|
uint32_t data[BLOCKS][CHUNK_FRAMES];
|
||||||
|
|
||||||
volatile unsigned dma_busy;
|
volatile unsigned dma_busy;
|
||||||
volatile unsigned dma_next;
|
volatile unsigned dma_next;
|
||||||
volatile unsigned dma_write;
|
volatile unsigned dma_write;
|
||||||
size_t write_ptr;
|
|
||||||
|
|
||||||
bool nonblock;
|
bool nonblock;
|
||||||
bool is_paused;
|
bool is_paused;
|
||||||
} gx_audio_t;
|
} gx_audio_t;
|
||||||
|
|
|
@ -36,15 +36,14 @@ typedef struct jack
|
||||||
jack_client_t *client;
|
jack_client_t *client;
|
||||||
jack_port_t *ports[2];
|
jack_port_t *ports[2];
|
||||||
jack_ringbuffer_t *buffer[2];
|
jack_ringbuffer_t *buffer[2];
|
||||||
volatile bool shutdown;
|
|
||||||
bool nonblock;
|
|
||||||
bool is_paused;
|
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
scond_t *cond;
|
scond_t *cond;
|
||||||
slock_t *cond_lock;
|
slock_t *cond_lock;
|
||||||
#endif
|
#endif
|
||||||
size_t buffer_size;
|
size_t buffer_size;
|
||||||
|
volatile bool shutdown;
|
||||||
|
bool nonblock;
|
||||||
|
bool is_paused;
|
||||||
} jack_t;
|
} jack_t;
|
||||||
|
|
||||||
static int process_cb(jack_nframes_t nframes, void *data)
|
static int process_cb(jack_nframes_t nframes, void *data)
|
||||||
|
|
|
@ -43,17 +43,14 @@ typedef struct al
|
||||||
ALuint source;
|
ALuint source;
|
||||||
ALuint *buffers;
|
ALuint *buffers;
|
||||||
ALuint *res_buf;
|
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;
|
ALCdevice *handle;
|
||||||
ALCcontext *ctx;
|
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 nonblock;
|
||||||
bool is_paused;
|
bool is_paused;
|
||||||
} al_t;
|
} al_t;
|
||||||
|
|
|
@ -37,9 +37,6 @@ typedef struct sl
|
||||||
{
|
{
|
||||||
uint8_t **buffer;
|
uint8_t **buffer;
|
||||||
uint8_t *buffer_chunk;
|
uint8_t *buffer_chunk;
|
||||||
unsigned buffer_index;
|
|
||||||
unsigned buffer_ptr;
|
|
||||||
volatile unsigned buffered_blocks;
|
|
||||||
|
|
||||||
SLObjectItf engine_object;
|
SLObjectItf engine_object;
|
||||||
SLEngineItf engine;
|
SLEngineItf engine;
|
||||||
|
@ -51,10 +48,13 @@ typedef struct sl
|
||||||
|
|
||||||
slock_t *lock;
|
slock_t *lock;
|
||||||
scond_t *cond;
|
scond_t *cond;
|
||||||
bool nonblock;
|
|
||||||
bool is_paused;
|
|
||||||
unsigned buf_size;
|
unsigned buf_size;
|
||||||
unsigned buf_count;
|
unsigned buf_count;
|
||||||
|
unsigned buffer_index;
|
||||||
|
unsigned buffer_ptr;
|
||||||
|
volatile unsigned buffered_blocks;
|
||||||
|
bool nonblock;
|
||||||
|
bool is_paused;
|
||||||
} sl_t;
|
} sl_t;
|
||||||
|
|
||||||
static void opensl_callback(SLAndroidSimpleBufferQueueItf bq, void *ctx)
|
static void opensl_callback(SLAndroidSimpleBufferQueueItf bq, void *ctx)
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#define DEFAULT_OSS_DEV "/dev/dsp"
|
#define DEFAULT_OSS_DEV "/dev/dsp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* TODO/FIXME - static global variable */
|
||||||
static bool oss_is_paused = false;
|
static bool oss_is_paused = false;
|
||||||
|
|
||||||
static void *oss_init(const char *device, unsigned rate, unsigned latency,
|
static void *oss_init(const char *device, unsigned rate, unsigned latency,
|
||||||
|
|
|
@ -32,7 +32,6 @@ typedef struct ps2_audio
|
||||||
/* TODO/FIXME - nonblock is not implemented */
|
/* TODO/FIXME - nonblock is not implemented */
|
||||||
bool nonblock;
|
bool nonblock;
|
||||||
bool running;
|
bool running;
|
||||||
|
|
||||||
} ps2_audio_t;
|
} ps2_audio_t;
|
||||||
|
|
||||||
static void audioConfigure(ps2_audio_t *ps2, unsigned rate)
|
static void audioConfigure(ps2_audio_t *ps2, unsigned rate)
|
||||||
|
|
|
@ -28,16 +28,15 @@
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32_t audio_port;
|
|
||||||
bool nonblock;
|
|
||||||
bool started;
|
|
||||||
volatile bool quit_thread;
|
|
||||||
fifo_buffer_t *buffer;
|
fifo_buffer_t *buffer;
|
||||||
|
|
||||||
sys_ppu_thread_t thread;
|
sys_ppu_thread_t thread;
|
||||||
sys_lwmutex_t lock;
|
sys_lwmutex_t lock;
|
||||||
sys_lwmutex_t cond_lock;
|
sys_lwmutex_t cond_lock;
|
||||||
sys_lwcond_t cond;
|
sys_lwcond_t cond;
|
||||||
|
uint32_t audio_port;
|
||||||
|
bool nonblock;
|
||||||
|
bool started;
|
||||||
|
volatile bool quit_thread;
|
||||||
} ps3_audio_t;
|
} ps3_audio_t;
|
||||||
|
|
||||||
#ifdef __PSL1GHT__
|
#ifdef __PSL1GHT__
|
||||||
|
|
|
@ -44,23 +44,23 @@
|
||||||
|
|
||||||
typedef struct psp_audio
|
typedef struct psp_audio
|
||||||
{
|
{
|
||||||
bool nonblock;
|
|
||||||
|
|
||||||
uint32_t* buffer;
|
uint32_t* buffer;
|
||||||
uint32_t* zeroBuffer;
|
uint32_t* zeroBuffer;
|
||||||
|
|
||||||
SceUID thread;
|
|
||||||
int rate;
|
|
||||||
|
|
||||||
volatile bool running;
|
|
||||||
volatile uint16_t read_pos;
|
|
||||||
volatile uint16_t write_pos;
|
|
||||||
|
|
||||||
sthread_t *worker_thread;
|
sthread_t *worker_thread;
|
||||||
slock_t *fifo_lock;
|
slock_t *fifo_lock;
|
||||||
scond_t *cond;
|
scond_t *cond;
|
||||||
slock_t *cond_lock;
|
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;
|
} psp_audio_t;
|
||||||
|
|
||||||
#define AUDIO_OUT_COUNT 512u
|
#define AUDIO_OUT_COUNT 512u
|
||||||
|
|
|
@ -27,14 +27,14 @@
|
||||||
typedef struct rsd
|
typedef struct rsd
|
||||||
{
|
{
|
||||||
rsound_t *rd;
|
rsound_t *rd;
|
||||||
|
|
||||||
|
fifo_buffer_t *buffer;
|
||||||
|
slock_t *cond_lock;
|
||||||
|
scond_t *cond;
|
||||||
|
|
||||||
bool nonblock;
|
bool nonblock;
|
||||||
bool is_paused;
|
bool is_paused;
|
||||||
volatile bool has_error;
|
volatile bool has_error;
|
||||||
|
|
||||||
fifo_buffer_t *buffer;
|
|
||||||
|
|
||||||
slock_t *cond_lock;
|
|
||||||
scond_t *cond;
|
|
||||||
} rsd_t;
|
} rsd_t;
|
||||||
|
|
||||||
static ssize_t rsound_audio_cb(void *data, size_t bytes, void *userdata)
|
static ssize_t rsound_audio_cb(void *data, size_t bytes, void *userdata)
|
||||||
|
|
|
@ -30,6 +30,8 @@ void RWebAudioSetNonblockState(bool state);
|
||||||
void RWebAudioFree(void);
|
void RWebAudioFree(void);
|
||||||
size_t RWebAudioWriteAvail(void);
|
size_t RWebAudioWriteAvail(void);
|
||||||
size_t RWebAudioBufferSize(void);
|
size_t RWebAudioBufferSize(void);
|
||||||
|
|
||||||
|
/* TODO/FIXME - static global variable */
|
||||||
static bool rwebaudio_is_paused;
|
static bool rwebaudio_is_paused;
|
||||||
|
|
||||||
static void rwebaudio_free(void *data)
|
static void rwebaudio_free(void *data)
|
||||||
|
|
|
@ -33,14 +33,13 @@
|
||||||
|
|
||||||
typedef struct sdl_audio
|
typedef struct sdl_audio
|
||||||
{
|
{
|
||||||
bool nonblock;
|
|
||||||
bool is_paused;
|
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
slock_t *lock;
|
slock_t *lock;
|
||||||
scond_t *cond;
|
scond_t *cond;
|
||||||
#endif
|
#endif
|
||||||
fifo_buffer_t *buffer;
|
fifo_buffer_t *buffer;
|
||||||
|
bool nonblock;
|
||||||
|
bool is_paused;
|
||||||
} sdl_audio_t;
|
} sdl_audio_t;
|
||||||
|
|
||||||
static void sdl_audio_cb(void *data, Uint8 *stream, int len)
|
static void sdl_audio_cb(void *data, Uint8 *stream, int len)
|
||||||
|
|
|
@ -31,11 +31,10 @@ typedef struct
|
||||||
AXMVoice* mvoice;
|
AXMVoice* mvoice;
|
||||||
uint16_t* buffer_l;
|
uint16_t* buffer_l;
|
||||||
uint16_t* buffer_r;
|
uint16_t* buffer_r;
|
||||||
bool nonblock;
|
OSSpinLock spinlock;
|
||||||
|
|
||||||
uint32_t pos;
|
uint32_t pos;
|
||||||
uint32_t written;
|
uint32_t written;
|
||||||
OSSpinLock spinlock;
|
bool nonblock;
|
||||||
} ax_audio_t;
|
} ax_audio_t;
|
||||||
|
|
||||||
/* 3072 samples main buffer, 64ms total */
|
/* 3072 samples main buffer, 64ms total */
|
||||||
|
|
Loading…
Reference in New Issue