Hi,
I've tried to get some audio things going on a new Mac mini 8,1 macOS 10.14.2 (18C54), and ran into an issue where there is no output from the built-in audio devices when using AVAudioEngine.
Xcode prints this while setting up the AVAudioEngine:
[AudioHAL_Client] HALC_ShellDriverPlugIn.cpp:104:Open: HALC_ShellDriverPlugIn::Open: opening the plug-in failed, Error: 2003329396 (what)
If the built-in speaker or the headphone jack is selected as sound output device, no sound comes out from my AVAudioEngine app.
If I select output via DisplayPort or AirPlay, sound is working, even though above error is also being printed.
Here's repo with an example project: https://github.com/nsdvr/avaudioengine_basic_output
It just plays a .wav file when you press the button. My own project uses a custom AudioUnit generator, and its internalRenderBlock is getting called, so the engine seems to be running fine, there's just silence at the physical outputs.
Relevant setup code:
- (void) setup {
self.engine = [AVAudioEngine new];
self.playerNode = [AVAudioPlayerNode new];
[self.engine attachNode:self.playerNode];
[self.engine connect:self.playerNode to:self.engine.mainMixerNode format:nil];
[self.engine prepare];
NSError *err;
[self.engine startAndReturnError:&err];
if(err) {
NSLog(@"AVAudioEngine start error: %@", err.localizedDescription);
}
NSError *fileErr;
NSURL *fileURL = [[NSBundle mainBundle] URLForResource:@"HUUH" withExtension:@"wav"];
self.audioFile = [[AVAudioFile alloc] initForReading:fileURL error:&fileErr];
if(fileErr) {
NSLog(@"error reading audio file");
return;
}
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(handleInterruption:)
name: AVAudioEngineConfigurationChangeNotification
object: self.engine];
}
- (void) play {
if(!self.audioFile) {
NSLog(@"Can't play without audio file");
return;
}
[self.playerNode scheduleFile:self.audioFile atTime:nil completionHandler:nil];
[self.playerNode play];
}
Submitted a bug report (46728117)
I'd like to verify if this issue happens on other machines. I don't have this problem on my old Macbook Air.