【问题标题】:NDK OpenSL ES looping sound with a buffer queue带有缓冲队列的 NDK OpenSL ES 循环声音
【发布时间】:2016-11-18 16:21:37
【问题描述】:

我正在为所有音频文件使用 SLDataLocator_AndroidSimpleBufferQueue。 效果很好,但是... 它不支持搜索和循环。

OpenSL 不能要求带有缓冲队列数据源的 SL_IID_SEEK

如何对文件使用循环?无法使用流式传输 - 低延迟。

【问题讨论】:

    标签: android android-ndk opensl


    【解决方案1】:

    我用播放器回调函数上的缓冲队列入队函数解决了这个问题。

    这样的示例代码...

    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);
    }
    

    【讨论】:

      【解决方案2】:

      事实证明,SLDataLocator_AndroidSimpleBufferQueue 无法做到这一点。 不得不使用SLDataLocator_AndroidFD...

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-07-22
        • 2023-04-06
        • 1970-01-01
        • 2016-04-28
        • 2021-10-03
        • 2012-12-23
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多