This might be a far fetch, but I hope someone out there has any clues.
Background
I have an OS X app that uses AVAudioEngine to play a group of files concurrently. This works perfectly fine (most of the time 😉) on my shiny new Macbook Pro with a flash drive.
In order to test how my app behaves on older/smaller/slower machines I thought I'd use Parallels to create a virtual machine with a little RAM and see how my app behaves there.
So, I created a virtual machine, made sure that sound is working on the virtual machine (I can hear sound played on the virtual machine) and installed Xcode on the virtual machine to be able to see what was actually going on.
And then the problems began
Problem
When I start my app I do some initialization of the AVAudioEngine (attach nodes). When I call this line on my virtual machine:
mainMixer = audioEngine.mainMixerNode
a lot of errors are logged to my console:
2015-08-05 10:55:31.562 app_name[357:2898] 10:55:31.562 ERROR: DefaultDeviceAggregate.cpp:361: CreateDictionaryForDevice: Error getting default device name: 'who?'
2015-08-05 10:55:33.635 app_name[357:2898] 10:55:33.635 ERROR: DefaultDeviceAggregate.cpp:772: BuildAggregate: Error creating aggregate audio device, id = 0: -308
2015-08-05 10:55:33.635 app_name[357:2898] 10:55:33.635 WARNING: DefaultDeviceAggregate.cpp:788: BuildAggregate: The default output device 0x34 'CADefaultDeviceAggregate-357-0' has no output channels.
2015-08-05 10:55:33.635 app_name[357:2898] 10:55:33.635 WARNING: DefaultDeviceAggregate.cpp:795: BuildAggregate: The input device is 0x34; 'CADefaultDeviceAggregate-357-0'
2015-08-05 10:55:33.635 app_name[357:2898] 10:55:33.635 WARNING: DefaultDeviceAggregate.cpp:799: BuildAggregate: The output device is 0x34; 'CADefaultDeviceAggregate-357-0'
2015-08-05 10:55:33.639 app_name[357:2898] 10:55:33.639 ERROR: DefaultDeviceAggregate.cpp:696: BuildAggregate: Error finding valid input or output devices!
2015-08-05 10:55:33.639 app_name[357:2872] 10:55:33.639 ERROR: DefaultDeviceAggregate.cpp:322: GetTotalNumberChannels: Error getting stream description size from device: '!obj'
2015-08-05 10:55:33.639 app_name[357:2872] 10:55:33.639 ERROR: DefaultDeviceAggregate.cpp:322: GetTotalNumberChannels: Error getting stream description size from device: '!obj'
And if I try to run this line
audioEngine.startAndReturnError(&engineError)
the app crashes with this error:
2015-08-05 10:56:04.460 app_name[357:2872] 10:56:04.460 ERROR: DefaultDeviceAggregate.cpp:322: GetTotalNumberChannels: Error getting stream description size from device: '!obj'
2015-08-05 10:56:04.460 app_name[357:2872] 10:56:04.460 ERROR: DefaultDeviceAggregate.cpp:322: GetTotalNumberChannels: Error getting stream description size from device: '!obj'
2015-08-05 10:56:06.816 app_name[357:3202] 10:56:06.815 ERROR: DefaultDeviceAggregate.cpp:322: GetTotalNumberChannels: Error getting stream description size from device: '!obj'
2015-08-05 10:56:06.816 app_name[357:3202] 10:56:06.816 ERROR: DefaultDeviceAggregate.cpp:322: GetTotalNumberChannels: Error getting stream description size from device: '!obj'
2015-08-05 10:56:06.819 app_name[357:3202] 10:56:06.819 ERROR: DefaultDeviceAggregate.cpp:322: GetTotalNumberChannels: Error getting stream description size from device: '!obj'
2015-08-05 10:56:06.819 app_name[357:3202] 10:56:06.819 ERROR: DefaultDeviceAggregate.cpp:322: GetTotalNumberChannels: Error getting stream description size from device: '!obj'
2015-08-05 10:56:06.819 app_name[357:3202] 10:56:06.819 ERROR: AVAudioEngineGraph.mm:1417: Initialize: required condition is false: IsFormatSampleRateAndChannelCountValid(outputHWFormat)
2015-08-05 10:56:06.820 app_name[357:3202] An uncaught exception was raised
2015-08-05 10:56:06.820 app_name[357:3202] required condition is false: IsFormatSampleRateAndChannelCountValid(outputHWFormat)
2015-08-05 10:56:06.821 app_name[357:3202] (
0 CoreFoundation 0x00007fff9137103c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8f5d476e objc_exception_throw + 43
2 CoreFoundation 0x00007fff91370e1a +[NSException raise:format:arguments:] + 106
3 libAVFAudio.dylib 0x00007fff966f08d8 _Z19AVAE_RaiseExceptionP8NSStringz + 176
4 libAVFAudio.dylib 0x00007fff96709f5a _ZN18AVAudioEngineGraph10InitializeEv + 1514
5 libAVFAudio.dylib 0x00007fff9671ed29 _ZN17AVAudioEngineImpl10InitializeEv + 29
6 libAVFAudio.dylib 0x00007fff9671e464 _ZN17AVAudioEngineImpl5StartEPP7NSError + 22
7 libAVFAudio.dylib 0x00007fff9671e400 -[AVAudioEngine startAndReturnError:] + 65
8 AudioPlayerFramework_OSX 0x00000001002f5bc5 _TFC24AudioPlayerFramework_OSX21MultitrackAudioPlayerP33_71E080CC26F8E89C0452531C794A613A18playExecutionBlockfS0_FT_T_ + 389
9 AudioPlayerFramework_OSX 0x00000001002fb4c1 _TTRXFo__dT__XFo_iT__iT__ + 17
10 AudioPlayerFramework_OSX 0x00000001002f55a1 _TPA__TTRXFo__dT__XFo_iT__iT__ + 81
11 AudioPlayerFramework_OSX 0x00000001002fb4f0 _TTRXFo_iT__iT__XFo__dT__ + 32
12 AudioPlayerFramework_OSX 0x000000010030141e _TFC24AudioPlayerFramework_OSX13PlayOperation4mainfS0_FT_T_ + 174
13 AudioPlayerFramework_OSX 0x00000001003014f2 _TToFC24AudioPlayerFramework_OSX13PlayOperation4mainfS0_FT_T_ + 34
14 Foundation 0x00007fff950b7a6c -[__NSOperationInternal _start:] + 653
15 Foundation 0x00007fff950b7543 __NSOQSchedule_f + 184
16 libdispatch.dylib 0x0000000100731d43 _dispatch_client_callout + 8
17 libdispatch.dylib 0x0000000100735fb3 _dispatch_queue_drain + 1804
18 libdispatch.dylib 0x0000000100737fc0 _dispatch_queue_invoke + 223
19 libdispatch.dylib 0x0000000100734f5e _dispatch_root_queue_drain + 666
20 libdispatch.dylib 0x0000000100746cd0 _dispatch_worker_thread3 + 106
21 libsystem_pthread.dylib 0x00007fff92621637 _pthread_wqthread + 729
22 libsystem_pthread.dylib 0x00007fff9261f40d start_wqthread + 13
)
2015-08-05 10:56:06.821 app_name[357:3202] *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: IsFormatSampleRateAndChannelCountValid(outputHWFormat)'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff9137103c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8f5d476e objc_exception_throw + 43
2 CoreFoundation 0x00007fff91370e1a +[NSException raise:format:arguments:] + 106
3 libAVFAudio.dylib 0x00007fff966f08d8 _Z19AVAE_RaiseExceptionP8NSStringz + 176
4 libAVFAudio.dylib 0x00007fff96709f5a _ZN18AVAudioEngineGraph10InitializeEv + 1514
5 libAVFAudio.dylib 0x00007fff9671ed29 _ZN17AVAudioEngineImpl10InitializeEv + 29
6 libAVFAudio.dylib 0x00007fff9671e464 _ZN17AVAudioEngineImpl5StartEPP7NSError + 22
7 libAVFAudio.dylib 0x00007fff9671e400 -[AVAudioEngine startAndReturnError:] + 65
8 AudioPlayerFramework_OSX 0x00000001002f5bc5 _TFC24AudioPlayerFramework_OSX21MultitrackAudioPlayerP33_71E080CC26F8E89C0452531C794A613A18playExecutionBlockfS0_FT_T_ + 389
9 AudioPlayerFramework_OSX 0x00000001002fb4c1 _TTRXFo__dT__XFo_iT__iT__ + 17
10 AudioPlayerFramework_OSX 0x00000001002f55a1 _TPA__TTRXFo__dT__XFo_iT__iT__ + 81
11 AudioPlayerFramework_OSX 0x00000001002fb4f0 _TTRXFo_iT__iT__XFo__dT__ + 32
12 AudioPlayerFramework_OSX 0x000000010030141e _TFC24AudioPlayerFramework_OSX13PlayOperation4mainfS0_FT_T_ + 174
13 AudioPlayerFramework_OSX 0x00000001003014f2 _TToFC24AudioPlayerFramework_OSX13PlayOperation4mainfS0_FT_T_ + 34
14 Foundation 0x00007fff950b7a6c -[__NSOperationInternal _start:] + 653
15 Foundation 0x00007fff950b7543 __NSOQSchedule_f + 184
16 libdispatch.dylib 0x0000000100731d43 _dispatch_client_callout + 8
17 libdispatch.dylib 0x0000000100735fb3 _dispatch_queue_drain + 1804
18 libdispatch.dylib 0x0000000100737fc0 _dispatch_queue_invoke + 223
19 libdispatch.dylib 0x0000000100734f5e _dispatch_root_queue_drain + 666
20 libdispatch.dylib 0x0000000100746cd0 _dispatch_worker_thread3 + 106
21 libsystem_pthread.dylib 0x00007fff92621637 _pthread_wqthread + 729
22 libsystem_pthread.dylib 0x00007fff9261f40d start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
And this code works fine if I just run on my normal machine and not on the virtual machine, so the problem seems to be that AVAudioEngine is having problems getting access to the "sound hardware" on the virtual machine. As I said earlier, I have verified that I can hear sound played on the virtual machine
Setup Info
I'm running:
- Xcode Version 6.4 (6E35b)
- Yosemite 10.10.4 (14E46)
So to recap
When I run my app on a virtual machine it crashes because it can not get access to the "sound hardware". Does anybody have any clues about what to do? Or should I just give up and buy an older Mac for testing purposes.
Fingers crossed and all that 🙂