Search code examples
iosswiftxcodecore-audio

CAShow() not outputting to console


Trying to test the state of an AUGraph in a Swift 4.0 project.

var audioGraph: AUGraph? = nil

func createAUGraph() {

    NewAUGraph(&self.audioGraph)

    CAShow(UnsafeMutablePointer<AUGraph>(self.audioGraph!))
    CAShow(UnsafeMutablePointer(self.audioGraph!)) }

I am not seeing anything output to the Console, however.

I've stepped through the code and the AUGraph and AUNodes seem to be created and instantiated successfully..

Is this an indication the AUGraph does not exist ... Or have I used this AudioToolBox method incorrectly?


Solution

  • Yes, you're right. There's no output. Seemingly it's already muted in Swift 4.

    import AudioToolbox
    
    var audioGraph: AUGraph? = nil
    var acd: UnsafePointer<AudioComponentDescription>? = nil
    var outNode: UnsafeMutablePointer<AUNode>? = nil
    
    func createAUGraph() {
        AUGraphAddNode(audioGraph!, acd!, outNode!)
        NewAUGraph(UnsafeMutablePointer<AUGraph>(audioGraph!))
        CAShow(UnsafeMutablePointer<AUGraph>(audioGraph!))
        CAShow(UnsafeMutablePointer(audioGraph!))
    }
    
    createAUGraph()