mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-23 09:49:34 -10:00
OpenSL's blocks are one arena, so its lend runs from the fill point through every block the device does not hold, to the arena's end: the pipeline produces its output in the buffers the device plays, and the end enqueues each block it completes, sharing write()'s enqueue. DirectSound and SDL2 lend the ring their pump and callback drain, and JACK the first part of its ringbuffer's write vector, whose two entry points join the table it loads; each in whole frames. opensl's mock now plays back what each block held when it finished, and the lend's spans are checked to cross blocks and play in order. dsound_pump lends through wine's DirectSound, jack_runtime through the fake server into the port buffers, and sdl_lost_wakeup against SDL's dummy device, which the samples/audio workflow now runs. pipeline_wakeups reports the staged writes a lending device still takes.
60 lines
2.6 KiB
C
60 lines
2.6 KiB
C
/* The Android additions the driver uses: the simple buffer queue, and
|
|
* the extended PCM format that carries a float representation. */
|
|
#ifndef OPENSL_MOCK_ANDROID_H
|
|
#define OPENSL_MOCK_ANDROID_H
|
|
|
|
#include "OpenSLES.h"
|
|
|
|
#define SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE 0x800007BD
|
|
#define SL_ANDROID_DATAFORMAT_PCM_EX 0x800007C0
|
|
#define SL_ANDROID_PCM_REPRESENTATION_FLOAT 0x00000003
|
|
|
|
extern const SLInterfaceID SL_IID_ANDROIDSIMPLEBUFFERQUEUE;
|
|
|
|
typedef struct { SLuint32 locatorType; SLuint32 numBuffers; }
|
|
SLDataLocator_AndroidSimpleBufferQueue;
|
|
|
|
typedef struct
|
|
{
|
|
SLuint32 formatType, numChannels, sampleRate, bitsPerSample;
|
|
SLuint32 containerSize, channelMask, endianness, representation;
|
|
} SLAndroidDataFormat_PCM_EX;
|
|
|
|
typedef struct { SLuint32 count, index; } SLAndroidSimpleBufferQueueState;
|
|
|
|
struct SLAndroidSimpleBufferQueueItf_;
|
|
typedef const struct SLAndroidSimpleBufferQueueItf_ * const * SLAndroidSimpleBufferQueueItf;
|
|
struct SLAndroidSimpleBufferQueueItf_
|
|
{
|
|
SLresult (*Enqueue)(SLAndroidSimpleBufferQueueItf self, const void *buf, SLuint32 size);
|
|
SLresult (*Clear)(SLAndroidSimpleBufferQueueItf self);
|
|
SLresult (*GetState)(SLAndroidSimpleBufferQueueItf self, SLAndroidSimpleBufferQueueState *state);
|
|
SLresult (*RegisterCallback)(SLAndroidSimpleBufferQueueItf self,
|
|
void (*cb)(SLAndroidSimpleBufferQueueItf, void*), void *ctx);
|
|
};
|
|
|
|
/* the harness's controls */
|
|
void opensl_mock_reset(void);
|
|
void opensl_mock_set_float_supported(int on);
|
|
void opensl_mock_set_queue_limit(unsigned max_buffers); /* 0: no limit */
|
|
void opensl_mock_freeze(int on); /* the device stops consuming */
|
|
unsigned opensl_mock_num_buffers(void); /* numBuffers the player was created with */
|
|
unsigned opensl_mock_buffer_bytes(void); /* the size of the blocks enqueued */
|
|
unsigned opensl_mock_rate_milli(void);
|
|
int opensl_mock_is_float(void);
|
|
const uint8_t *opensl_mock_capture(size_t *len); /* the bytes the device played, in order */
|
|
size_t opensl_mock_consumed(void); /* blocks the device has played */
|
|
unsigned opensl_mock_enqueue_failures(void);
|
|
int opensl_mock_playing(void);
|
|
int opensl_mock_objects(void); /* created less destroyed */
|
|
|
|
/* Android's teardown rather than the spec's (issue #19561): the player
|
|
* goes without waiting for a callback already on its way, and its
|
|
* registration outlives it. The pump parks at the callback so a test
|
|
* owns the window: wait for it, tear down, then release. */
|
|
void opensl_mock_set_racy_teardown(int on);
|
|
int opensl_mock_wait_dispatching(unsigned timeout_ms); /* 0: never got there */
|
|
void opensl_mock_release_dispatch(void);
|
|
|
|
#endif
|