     private var audioConverter: AudioConverterRef?
     fileprivate var aacBuffer: [UInt8] = []
     fileprivate var aacBufferSize: UInt32
-    private var pcmBuffer: [UInt8] = []
+    private var pcmBuffer: [UInt8]     = []
     private var pcmBufferSize: UInt32
     
     fileprivate var fillComplexCallback: AudioConverterComplexInputDataProc = { (inAudioConverter, 

        ioData: UnsafeMutablePointer<AudioBufferList>,
        outDataPacketDescription: UnsafeMutablePointer<UnsafeMutablePointer<AudioStreamPacketDescription>?>?) -> OSStatus
    {
        print(#function)
        let requestedPackets = ioNumberDataPackets.pointee
        self.pcmBuffer.withUnsafeMutableBufferPointer { bufferPtr in
            let ptr                              = UnsafeMutableRawPointer(bufferPtr.baseAddress)
            ioData.pointee.mBuffers.mData        = ptr
            ioData.pointee.mBuffers.mDataByteSize = self.pcmBufferSize
            print(ioData)
        }
        
        if self.pcmBufferSize < requestedPackets {
            print("Fuck")
            ioNumberDataPackets.pointee = 0
            return -1
        }
        
        print("Next")
        ioNumberDataPackets.pointee = 1
        return noErr
    }
    

    // http://stackoverflow.com/questions/10817036/can-i-use-avcapturesession-to-encode-an-aac-stream-to-memory
    private func getAudioClassDescription(with type: UInt32,
                                          from manufacturer: UInt32) -> AudioClassDescription?
    {
        var status = noErr
        
        var encoderSpec: UInt32 = type
        var size: UInt32 = 0
        status = AudioFormatGetPropertyInfo(kAudioFormatProperty_Encoders,
                                            type,
                                            &encoderSpec,
                                            &size)
        
        if status != noErr {
            print("Error getting audio format property", status)
            return nil
        }
        
        var descriptions: [AudioClassDescription] = []
        status = AudioFormatGetProperty(kAudioFormatProperty_Encoders,
                                        type,
                                        &encoderSpec,
                                        &size,
                                        &descriptions)
        
        if status != noErr {
            print("Error getting audio format property", status)
            return nil
        }
        
        for descriptor in descriptions {
            if descriptor.mSubType == type && descriptor.mManufacturer == manufacturer {
                return descriptor
            }
        }
        
        return nil
    }
    
}

        
            if status == noErr {
                let rawAAC = Data(self.aacBuffer)
                print(self.aacBuffer)
                onComplete(rawAAC, noErr)
            } else {
                print("Error converting buffer:", status)
