mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Minor changes to OpenSL|ES backend.
This commit is contained in:
@@ -96,6 +96,8 @@
|
|||||||
// consistent so I'm suspecting there's some kind of hard coded limit there or something.
|
// consistent so I'm suspecting there's some kind of hard coded limit there or something.
|
||||||
// - DirectSound currently supports a maximum of 4 periods.
|
// - DirectSound currently supports a maximum of 4 periods.
|
||||||
// - The ALSA backend does not support rewinding.
|
// - The ALSA backend does not support rewinding.
|
||||||
|
// - To capture audio on Android, remember to add the RECORD_AUDIO permission to your manifest:
|
||||||
|
// <uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -3028,7 +3030,7 @@ static mal_result mal_device_init__sles(mal_device* pDevice, mal_device_type typ
|
|||||||
pDevice->sles.periodSizeInFrames = bufferSizeInFrames / periods;
|
pDevice->sles.periodSizeInFrames = bufferSizeInFrames / periods;
|
||||||
pDevice->bufferSizeInFrames = pDevice->sles.periodSizeInFrames * periods;
|
pDevice->bufferSizeInFrames = pDevice->sles.periodSizeInFrames * periods;
|
||||||
|
|
||||||
SLDataLocator_BufferQueue queue;
|
SLDataLocator_AndroidSimpleBufferQueue queue;
|
||||||
queue.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE;
|
queue.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE;
|
||||||
queue.numBuffers = periods;
|
queue.numBuffers = periods;
|
||||||
|
|
||||||
@@ -3041,10 +3043,6 @@ static mal_result mal_device_init__sles(mal_device* pDevice, mal_device_type typ
|
|||||||
pcm.channelMask = ~((~0UL) << channels);
|
pcm.channelMask = ~((~0UL) << channels);
|
||||||
pcm.endianness = SL_BYTEORDER_LITTLEENDIAN;
|
pcm.endianness = SL_BYTEORDER_LITTLEENDIAN;
|
||||||
|
|
||||||
SLDataSource source;
|
|
||||||
source.pLocator = &queue;
|
|
||||||
source.pFormat = &pcm;
|
|
||||||
|
|
||||||
if (type == mal_device_type_playback) {
|
if (type == mal_device_type_playback) {
|
||||||
if ((*g_malEngineSL)->CreateOutputMix(g_malEngineSL, (SLObjectItf*)&pDevice->sles.pOutputMixObj, 0, NULL, NULL) != SL_RESULT_SUCCESS) {
|
if ((*g_malEngineSL)->CreateOutputMix(g_malEngineSL, (SLObjectItf*)&pDevice->sles.pOutputMixObj, 0, NULL, NULL) != SL_RESULT_SUCCESS) {
|
||||||
mal_device_uninit__sles(pDevice);
|
mal_device_uninit__sles(pDevice);
|
||||||
@@ -3066,6 +3064,9 @@ static mal_result mal_device_init__sles(mal_device* pDevice, mal_device_type typ
|
|||||||
MAL_SLES_OUTPUTMIX(pDevice->sles.pOutputMix)->ReRoute((SLOutputMixItf)pDevice->sles.pOutputMix, 1, &pDeviceID->id32);
|
MAL_SLES_OUTPUTMIX(pDevice->sles.pOutputMix)->ReRoute((SLOutputMixItf)pDevice->sles.pOutputMix, 1, &pDeviceID->id32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SLDataSource source;
|
||||||
|
source.pLocator = &queue;
|
||||||
|
source.pFormat = &pcm;
|
||||||
|
|
||||||
SLDataLocator_OutputMix outmixLocator;
|
SLDataLocator_OutputMix outmixLocator;
|
||||||
outmixLocator.locatorType = SL_DATALOCATOR_OUTPUTMIX;
|
outmixLocator.locatorType = SL_DATALOCATOR_OUTPUTMIX;
|
||||||
|
|||||||
Reference in New Issue
Block a user