(Audio) reorder structs/alignment (don't touch Switch audio drivers

for now)
This commit is contained in:
twinaphex 2020-08-26 15:24:33 +02:00
parent b546fddf86
commit 13604b047f
20 changed files with 63 additions and 74 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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)

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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)

View file

@ -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)

View file

@ -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;

View file

@ -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)

View file

@ -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;

View file

@ -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)

View file

@ -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,

View file

@ -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)

View file

@ -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__

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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 */