0
我初始化的AndroidSimpleBufferQueue如價值觀:無法播放PCM> 60KB與AndroidSimpleBufferQueue
SLDataLocator_AndroidSimpleBufferQueue bufferLocator = {
SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2};
SLDataFormat_PCM pcmFormat = {
SL_DATAFORMAT_PCM, 1,
SL_SAMPLINGRATE_44_1, SL_PCMSAMPLEFORMAT_FIXED_16,
SL_PCMSAMPLEFORMAT_FIXED_16, SL_SPEAKER_FRONT_CENTER,
SL_BYTEORDER_LITTLEENDIAN};
SLDataSource audioSource = {&bufferLocator, &pcmFormat};
SLDataLocator_OutputMix locatorOutputMix = {SL_DATALOCATOR_OUTPUTMIX,
outputMixObj.getObject()};
SLDataSink audioSink = {&locatorOutputMix, nullptr};
[...]
然後,當我需要播放聲音我排隊,如:
bufferQueue->Enqueue(bufferQueue, (uint8_t*)buffer.data(),
buffer.size())
它的工作原理以及對於小於60k的緩衝區,但是當緩衝區較大時沒有聲音被播放或有時只是一個神器。