是否有任何高级音频队列记录服务库的iOS? [英] Is there any high level Audio Queue Record Service Library for iOS?

查看:170
本文介绍了是否有任何高级音频队列记录服务库的iOS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个关于VOIP的应用程序,

I'm trying to develop an application which about VOIP,

是否有适用于iOS的高级音频队列服务库?

is there any high level audio queue service library for iOS ?

因为我不是很擅长使用扩展名文件名.mm,

because I'm not very good at for working on extension filename ".mm",

使用开源将是一个更好的选择。

using an open source would be a better option.

或者有人可以给我一些提示,说明如何从AudioQueueBufferRef获取缓冲区?

or someone could give me some hints for how to fetch the buffer from AudioQueueBufferRef ?

像代理:

- (void)audioRecorderDidReceivedBuffer:(Buffer) {
    do something for other operations
}







  • p> 更新
    我发现了一篇关于的文章使用RemoteIO音频单元

    也许输入回调是我需要的。

    maybe the input callback is what I need.


    Overvier

    Overvier


    1. 识别音频组件(kAudioUnitType_Output / kAudioUnitSubType_RemoteIO / kAudioUnitManufacturerApple)

    2. 使用AudioComponentFindNext(NULL,& descriptionOfAudioComponent)获取AudioComponent,
      获取音频单元

    3. 使用AudioComponentInstanceNew(ourComponent,& audioUnit)创建音频单元的实例

    4. 描述AudioStreamBasicDescription结构中的音频格式,并使用AudioUnitSetProperty应用格式

    5. 提供录音回调,

    6. 分配一些缓冲区

    7. 初始化音频单元

    8. 启动音频单位

    9. 欢喜

    1. Identify the audio component (kAudioUnitType_Output/ kAudioUnitSubType_RemoteIO/ kAudioUnitManufacturerApple)
    2. Use AudioComponentFindNext(NULL, &descriptionOfAudioComponent) to obtain the AudioComponent, which is like the factory with which you obtain the audio unit
    3. Use AudioComponentInstanceNew(ourComponent, &audioUnit) to make an instance of the audio unit
    4. Enable IO for recording and possibly playback with AudioUnitSetProperty
    5. Describe the audio format in an AudioStreamBasicDescription structure, and apply the format using AudioUnitSetProperty
    6. Provide a callback for recording, and possibly playback, again using AudioUnitSetProperty
    7. Allocate some buffers
    8. Initialise the audio unit
    9. Start the audio unit
    10. Rejoice




    // Enable IO for recording
    UInt32 flag = 1;
    status = AudioUnitSetProperty(audioUnit, 
                                  kAudioOutputUnitProperty_EnableIO, 
                                  kAudioUnitScope_Input, 
                                  kInputBus,
                                  &flag, 
                                  sizeof(flag));
    
    
    
    // Set input callback
    AURenderCallbackStruct callbackStruct;
    callbackStruct.inputProc = recordingCallback;
    callbackStruct.inputProcRefCon = self;
    status = AudioUnitSetProperty(audioUnit, 
                                  kAudioOutputUnitProperty_SetInputCallback, 
                                  kAudioUnitScope_Global, 
                                  kInputBus, 
                                  &callbackStruct, 
                                  sizeof(callbackStruct));
    
    
    
    //recordingCallback
    static OSStatus recordingCallback(void *inRefCon, 
                                  AudioUnitRenderActionFlags *ioActionFlags, 
                                  const AudioTimeStamp *inTimeStamp, 
                                  UInt32 inBusNumber, 
                                  UInt32 inNumberFrames, 
                                  AudioBufferList *ioData) {
    
    // TODO: Use inRefCon to access our interface object to do stuff
    // Then, use inNumberFrames to figure out how much data is available, and make
    // that much space available in buffers in an AudioBufferList.
    
    AudioBufferList *bufferList; // <- Fill this up with buffers (you will want to malloc it, as it's a dynamic-length list)
    
    // Then:
    // Obtain recorded samples
    
    OSStatus status;
    
    status = AudioUnitRender([audioInterface audioUnit], 
                             ioActionFlags, 
                             inTimeStamp, 
                             inBusNumber, 
                             inNumberFrames, 
                             bufferList);
    checkStatus(status);
    
    // Now, we have the samples we just read sitting in buffers in bufferList
    DoStuffWithTheRecordedAudio(bufferList);
    return noErr;
    }
    


    推荐答案

    从记录中提取音频缓冲区

    Here is the method that how to fetch Audio Buffer from recording

    (引用来自: http://atastypixel.com/blog/using-remoteio-audio-unit/

    static OSStatus recordingCallback(void *inRefCon, 
                                      AudioUnitRenderActionFlags *ioActionFlags, 
                                      const AudioTimeStamp *inTimeStamp, 
                                      UInt32 inBusNumber, 
                                      UInt32 inNumberFrames, 
                                      AudioBufferList *ioData) {
    
        // TODO: Use inRefCon to access our interface object to do stuff
        // Then, use inNumberFrames to figure out how much data is available, and make
        // that much space available in buffers in an AudioBufferList.
    
        AudioBufferList *bufferList; // <- Fill this up with buffers (you will want to malloc it, as it's a dynamic-length list)
    
        // Then:
        // Obtain recorded samples
    
        OSStatus status;
    
        status = AudioUnitRender([audioInterface audioUnit], 
                                 ioActionFlags, 
                                 inTimeStamp, 
                                 inBusNumber, 
                                 inNumberFrames, 
                                 bufferList);
        checkStatus(status);
    
        // Now, we have the samples we just read sitting in buffers in bufferList
        DoStuffWithTheRecordedAudio(bufferList);
        return noErr;
    }
    

    这篇关于是否有任何高级音频队列记录服务库的iOS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆