Beckon
Beckon

Reputation: 138

How to add two I/O audio Unit in AUGraph on iOS?

How to add two I/O audio Unit in AUGraph in iOS ? One I/O AudioUnit take the record input, another take the playback output.

Upvotes: 2

Views: 272

Answers (2)

Vanya
Vanya

Reputation: 5005

If the record is a file, then I found this post very useful http://www.ithinkers.com.ua/blog-en/2017/3/16/how-to-make-offline-render-audio

// EDIT: after comments some explanation

The solution described by the link above is based on file to file conversion. So basically if you need a solution "file to output (speakers" you need to fiddle out around output node connection in augraph with this description

//
static var outputDescription:AudioComponentDescription {
    //
    var theType:OSType
    //
    #if (os(iOS))
        theType = kAudioUnitSubType_RemoteIO
    #else
        theType = kAudioUnitSubType_DefaultOutput
    #endif

    return AudioComponentDescription(componentType: kAudioUnitType_Output,
                                     componentSubType: theType,
                                     componentManufacturer: kAudioUnitManufacturer_Apple,
                                     componentFlags: 0,
                                     componentFlagsMask: 0)
}

Upvotes: -1

hotpaw2
hotpaw2

Reputation: 70703

iOS currently only allows using one Audio Unit for I/O, RemoteIO. However, the RemoteIO Audio Unit can be connected to an AUGraph to do both recording audio input and playing audio output at the same time. The audio routing can be configured through the Audio Session API.

Upvotes: 1

Related Questions