Skip to content

Instantly share code, notes, and snippets.

@analogcode
Created December 9, 2017 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save analogcode/3b3dac2699a6e85c5d3fb86fe48e4ccb to your computer and use it in GitHub Desktop.
Save analogcode/3b3dac2699a6e85c5d3fb86fe48e4ccb to your computer and use it in GitHub Desktop.
AudioBus Icon
// **********************************************************
// MARK: - AudioBus Host Icon
// **********************************************************
private func startObservingInterAppAudioConnections() {
audioUnitPropertyListener = AudioUnitPropertyListener { (audioUnit, property) in
self.hostAppIcon.image = AudioOutputUnitGetHostIcon(AudioKit.engine.outputNode.audioUnit!, 44)
}
AudioKit.engine.outputNode.audioUnit!.add(listener: audioUnitPropertyListener, toProperty: kAudioUnitProperty_IsInterAppConnected)
}
@IBAction func openHostApp(_ sender: AnyObject) {
var url: CFURL = CFURLCreateWithString(nil, "" as CFString!, nil)
var size = UInt32(MemoryLayout<CFURL>.size)
let result = AudioUnitGetProperty(
AudioKit.engine.outputNode.audioUnit!,
AudioUnitPropertyID(kAudioUnitProperty_PeerURL),
AudioUnitScope(kAudioUnitScope_Global),
0,
&url,
&size)
if result == noErr {
UIApplication.shared.open(url as URL)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment