【问题标题】:How to Implement Buffering in the Multichannel Mixer on iOS?如何在 iOS 上的多通道混音器中实现缓冲?
【发布时间】:2011-08-31 12:12:33
【问题描述】:

我正在使用 MixerHostAudio 同时加载多个音频文件。

由于应用程序崩溃,我无法将整个文件加载到内存中!

有人可以帮我实现一个缓冲论文文件的算法吗?

或者至少给我举个例子?

我设法做到了这一点:

我指出了调用渲染函数的代码:

    UInt32 numberOfPacketsToRead = (UInt32) totalFramesInFile;

    result = ExtAudioFileRead (audioFileObject, &numberOfPacketsToRead, bufferList);

    free (bufferList);

    if (noErr != result) {

        [self printErrorMessage: @"ExtAudioFileRead failure - " withStatus: result];

        // If reading from the file failed, then free the memory for the sound buffer.
        free (soundStructArray[audioFile].audioDataLeft);
        soundStructArray[audioFile].audioDataLeft = 0;

        if (2 == channelCount) {
            free (soundStructArray[audioFile].audioDataRight);
            soundStructArray[audioFile].audioDataRight = 0;
        }

        ExtAudioFileDispose (audioFileObject);            
        return;
    }

--- 现在我只在缓冲完成时丢失了部分,我可以告诉程序获取下一个块....

有什么想法吗?

谢谢

埃尔南

【问题讨论】:

    标签: ios buffer core-audio mixer


    【解决方案1】:

    您需要使用环形缓冲区来处理您的音频。

    这里有一个简单的例子。

    ring buffer

    【讨论】:

    • 谢谢兄弟。我去看看。 (与 DubStep 有任何关系吗?)
    • 你有任何 Objective - C 的例子吗?
    猜你喜欢
    • 2010-12-10
    • 1970-01-01
    • 2011-03-28
    • 1970-01-01
    • 2018-08-03
    • 1970-01-01
    • 2016-08-08
    • 2012-10-03
    • 2014-01-30
    相关资源
    最近更新 更多