Warning AVAudioEngine: "Legacy Carbon Component Manager for Hosting Audio Devices"

I am writing my first audio application for Mac that downloads an external audio block and uses it to play sound through an AVAudioEngine instance, and I saw this warning:

WARNING: 140: This application or the library it uses uses an outdated carbon component manager to host audio devices. Support as it will be removed in a future release. In addition, this makes the host incompatible with version 3 audio units. Please go to the API in AudioComponent.h.

I have already switched from using AVAudioUnitComponents to AudioComponents (now accessed via this api ), which I expected would solve this problem, but I "I still see this warning when I call start() on my engine.

Any ideas what is going wrong here? As far as I can tell, I no longer use legacy APIs. Is it possible that AVAudioEngine uses legacy APIs under the hood?

Here is a piece of code I'm working with. I call selectInstrument with the description I got using the AudioComponents API.

 public func selectInstrument(withDescription description: AudioComponentDescription, callback: @escaping SelectInstrumentCallback) { AVAudioUnit.instantiate(with: description, options: []) { avAudioUnit, error in guard let unit = avAudioUnit else { callback(nil) return } self.disconnectCurrent() self.connect(unit: unit) unit.auAudioUnit.requestViewController { viewController in callback(viewController) } } } private func disconnectCurrent() { guard let current = currentInstrument else { return } self.engine.disconnectNodeInput(engine.mainMixerNode) self.engine.detach(current) self.currentInstrument = nil self.engine.stop() } private func connect(unit: AVAudioUnit) { let hardwareFormat = self.engine.outputNode.outputFormat(forBus: 0) self.engine.connect(self.engine.mainMixerNode, to: self.engine.outputNode, format: hardwareFormat) self.engine.attach(unit) do { try ExceptionCatcher.catchException { let stereoFormat = AVAudioFormat(standardFormatWithSampleRate: hardwareFormat.sampleRate, channels: 2) self.engine.connect(unit, to: self.engine.mainMixerNode, format: stereoFormat) } } catch { let monoFormat = AVAudioFormat(standardFormatWithSampleRate: hardwareFormat.sampleRate, channels: 1) self.engine.connect(unit, to: self.engine.mainMixerNode, format: monoFormat) } unit.auAudioUnit.contextName = "Running in AU host demo app" self.currentInstrument = unit do { // Carbon Component Manager warning issued here: try self.engine.start() } catch { print("Failed to start engine") } } 

Thank you for your help!

+5
source share

Source: https://habr.com/ru/post/1265686/


All Articles