Question

I'm using SLDataLocator_AndroidSimpleBufferQueue for all audio files. It works good, but... It doesnt support seek and loop.

OpenSL can't require SL_IID_SEEK with a buffer queue data source

How can i use looping for files? Cant use streaming - low latency.

Was it helpful?

Solution 2

As it turned out, this is not possible with SLDataLocator_AndroidSimpleBufferQueue. Had to use SLDataLocator_AndroidFD...

OTHER TIPS

I solved this problem with buffer queue Enqueue function on player callback function.

the sample code like this...

struct PARAM { char* buffer;  long  size; };

void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue, void *context)
{
    ...
    PARAM* param = (PARAM*)context;
    result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, param->buffer, nparam->size);
}

void createAudioPlayer... {
    (*engineEngine)->CreateAudioPlayer(engineEngine, &bqPlayerObject, ...);
    ...
    PARAM* param = new PARAM{buffer, size};
    result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, param);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top