Commit ea6281fa authored by David Reid's avatar David Reid

Fix compilation errors with AAudio.

Public issue https://github.com/mackron/miniaudio/issues/247
parent 37cff3f0
......@@ -268,6 +268,9 @@ The BSD build only requires linking to `-lpthread` and `-lm`. NetBSD uses audio(
AAudio is the highest priority backend on Android. This should work out of the box without needing any kind of compiler configuration. Support for AAudio
starts with Android 8 which means older versions will fall back to OpenSL|ES which requires API level 16+.
There have been reports that the OpenSL|ES backend fails to initialize on some Android based devices. If this happens you'll need to disable run-time
linking with `MA_NO_RUNTIME_LINKING` which you'll need to link with -lOpenSLES.
2.6. Emscripten
---------------
The Emscripten build emits Web Audio JavaScript directly and should compile cleanly out of the box. You cannot use -std=c* compiler flags, nor -ansi.
......@@ -29482,36 +29485,20 @@ AAudio Backend
******************************************************************************/
#ifdef MA_HAS_AAUDIO
#if defined(MA_NO_RUNTIME_LINKING)
/* Compile-Time Linking */
#include <AAudio/AAudio.h>
typedef aaudio_result_t ma_aaudio_result_t;
typedef aaudio_direction_t ma_aaudio_direction_t;
typedef aaudio_sharing_mode_t ma_aaudio_sharing_mode_t;
typedef aaudio_format_t ma_aaudio_format_t;
typedef aaudio_stream_state_t ma_aaudio_stream_state_t;
typedef aaudio_performance_mode_t ma_aaudio_performance_mode_t;
typedef aaudio_usage_t ma_aaudio_usage_t;
typedef aaudio_content_type_t ma_aaudio_content_type_t;
typedef aaudio_input_preset_t ma_aaudio_input_preset_t;
typedef aaudio_data_callback_result_t ma_aaudio_data_callback_result_t;
typedef AAudioStreamBuilder ma_AAudioStreamBuilder;
typedef AAudioStream ma_AAudioStream;
#else
/* Run-Time Linking */
typedef int32_t ma_aaudio_result_t;
typedef int32_t ma_aaudio_direction_t;
typedef int32_t ma_aaudio_sharing_mode_t;
typedef int32_t ma_aaudio_format_t;
typedef int32_t ma_aaudio_stream_state_t;
typedef int32_t ma_aaudio_performance_mode_t;
typedef int32_t ma_aaudio_usage_t;
typedef int32_t ma_aaudio_content_type_t;
typedef int32_t ma_aaudio_input_preset_t;
typedef int32_t ma_aaudio_data_callback_result_t;
typedef struct ma_AAudioStreamBuilder_t* ma_AAudioStreamBuilder;
typedef struct ma_AAudioStream_t* ma_AAudioStream;
#endif
/*#include <AAudio/AAudio.h>*/
typedef int32_t ma_aaudio_result_t;
typedef int32_t ma_aaudio_direction_t;
typedef int32_t ma_aaudio_sharing_mode_t;
typedef int32_t ma_aaudio_format_t;
typedef int32_t ma_aaudio_stream_state_t;
typedef int32_t ma_aaudio_performance_mode_t;
typedef int32_t ma_aaudio_usage_t;
typedef int32_t ma_aaudio_content_type_t;
typedef int32_t ma_aaudio_input_preset_t;
typedef int32_t ma_aaudio_data_callback_result_t;
typedef struct ma_AAudioStreamBuilder_t* ma_AAudioStreamBuilder;
typedef struct ma_AAudioStream_t* ma_AAudioStream;
#define MA_AAUDIO_UNSPECIFIED 0
......@@ -30196,14 +30183,11 @@ static ma_result ma_context_uninit__aaudio(ma_context* pContext)
static ma_result ma_context_init__aaudio(const ma_context_config* pConfig, ma_context* pContext)
{
#if 1 /*!defined(MA_NO_RUNTIME_LINKING)*/
size_t i;
const char* libNames[] = {
"libaaudio.so"
};
#endif
#if 1 /*!defined(MA_NO_RUNTIME_LINKING)*/
for (i = 0; i < ma_countof(libNames); ++i) {
pContext->aaudio.hAAudio = ma_dlopen(pContext, libNames[i]);
if (pContext->aaudio.hAAudio != NULL) {
......@@ -30243,36 +30227,6 @@ static ma_result ma_context_init__aaudio(const ma_context_config* pConfig, ma_co
pContext->aaudio.AAudioStream_getFramesPerBurst = (ma_proc)ma_dlsym(pContext, pContext->aaudio.hAAudio, "AAudioStream_getFramesPerBurst");
pContext->aaudio.AAudioStream_requestStart = (ma_proc)ma_dlsym(pContext, pContext->aaudio.hAAudio, "AAudioStream_requestStart");
pContext->aaudio.AAudioStream_requestStop = (ma_proc)ma_dlsym(pContext, pContext->aaudio.hAAudio, "AAudioStream_requestStop");
#else
pContext->aaudio.AAudio_createStreamBuilder = (ma_proc)AAudio_createStreamBuilder;
pContext->aaudio.AAudioStreamBuilder_delete = (ma_proc)AAudioStreamBuilder_delete;
pContext->aaudio.AAudioStreamBuilder_setDeviceId = (ma_proc)AAudioStreamBuilder_setDeviceId;
pContext->aaudio.AAudioStreamBuilder_setDirection = (ma_proc)AAudioStreamBuilder_setDirection;
pContext->aaudio.AAudioStreamBuilder_setSharingMode = (ma_proc)AAudioStreamBuilder_setSharingMode;
pContext->aaudio.AAudioStreamBuilder_setFormat = (ma_proc)AAudioStreamBuilder_setFormat;
pContext->aaudio.AAudioStreamBuilder_setChannelCount = (ma_proc)AAudioStreamBuilder_setChannelCount;
pContext->aaudio.AAudioStreamBuilder_setSampleRate = (ma_proc)AAudioStreamBuilder_setSampleRate;
pContext->aaudio.AAudioStreamBuilder_setBufferCapacityInFrames = (ma_proc)AAudioStreamBuilder_setBufferCapacityInFrames;
pContext->aaudio.AAudioStreamBuilder_setFramesPerDataCallback = (ma_proc)AAudioStreamBuilder_setFramesPerDataCallback;
pContext->aaudio.AAudioStreamBuilder_setDataCallback = (ma_proc)AAudioStreamBuilder_setDataCallback;
pContext->aaudio.AAudioStreamBuilder_setErrorCallback = (ma_proc)AAudioStreamBuilder_setErrorCallback;
pContext->aaudio.AAudioStreamBuilder_setPerformanceMode = (ma_proc)AAudioStreamBuilder_setPerformanceMode;
pContext->aaudio.AAudioStreamBuilder_setUsage = (ma_proc)AAudioStreamBuilder_setUsage;
pContext->aaudio.AAudioStreamBuilder_setContentType = (ma_proc)AAudioStreamBuilder_setContentType;
pContext->aaudio.AAudioStreamBuilder_setInputPreset = (ma_proc)AAudioStreamBuilder_setInputPreset;
pContext->aaudio.AAudioStreamBuilder_openStream = (ma_proc)AAudioStreamBuilder_openStream;
pContext->aaudio.AAudioStream_close = (ma_proc)AAudioStream_close;
pContext->aaudio.AAudioStream_getState = (ma_proc)AAudioStream_getState;
pContext->aaudio.AAudioStream_waitForStateChange = (ma_proc)AAudioStream_waitForStateChange;
pContext->aaudio.AAudioStream_getFormat = (ma_proc)AAudioStream_getFormat;
pContext->aaudio.AAudioStream_getChannelCount = (ma_proc)AAudioStream_getChannelCount;
pContext->aaudio.AAudioStream_getSampleRate = (ma_proc)AAudioStream_getSampleRate;
pContext->aaudio.AAudioStream_getBufferCapacityInFrames = (ma_proc)AAudioStream_getBufferCapacityInFrames;
pContext->aaudio.AAudioStream_getFramesPerDataCallback = (ma_proc)AAudioStream_getFramesPerDataCallback;
pContext->aaudio.AAudioStream_getFramesPerBurst = (ma_proc)AAudioStream_getFramesPerBurst;
pContext->aaudio.AAudioStream_requestStart = (ma_proc)AAudioStream_requestStart;
pContext->aaudio.AAudioStream_requestStop = (ma_proc)AAudioStream_requestStop;
#endif
pContext->isBackendAsynchronous = MA_TRUE;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment