Created
December 9, 2017 23:43
-
-
Save analogcode/3b3dac2699a6e85c5d3fb86fe48e4ccb to your computer and use it in GitHub Desktop.
AudioBus Icon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ********************************************************** | |
// 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