IOAudioEngine problem while changing audio format (bit depth) from Audio MIDI Setup
IOAudioEngine problem while changing audio format (bit depth) from Audio MIDI Setup
- Subject: IOAudioEngine problem while changing audio format (bit depth) from Audio MIDI Setup
- From: Matthieu Collette <email@hidden>
- Date: Fri, 19 Feb 2016 22:47:08 +0100
Hi,
I have developed a virtual audio driver using the IOKit classes.
It gets samples and sends those samples through the network.
It works as expected but I am facing some issues with audio format changes.
My driver has two streams, one for input and one for output.
It can deal 16 bits and 24 bits depth with sample rates from 44kHz to 192kHz.
While playing, if I change the sample rate using an external application such as Audio MIDI Setup, the sample rate is successfully changed and the audio engine continues playing.
When I change the bit depth using the same external application, the player I use is paused and I am unable to play again until I change the sample rate again.
I have wrapped some of my custom IOAudioEngine's virtual methods to understand what is going on.
In both cases, everything is similar until IOAudioEngine::performFormatChange is called:
IOAudioEngine::sendFormatChangeNotification(IOAudioStream *audioStream)
IOAudioEngine::resumeAudioEngine()
IOAudioEngine::setState( Resumed )
IOAudioEngine::sendNotification( kIOAudioEngineResumedNotification )
The only difference between changing the sample rate / bit depth occurs after the resume notification is sent, ONLY when I change the sample rate, the following sequence is called:
IOAudioEngine::stopAudioEngine()
IOAudioEngine::setState( Stopped )
IOAudioEngine::sendNotification( kIOAudioEngineStoppedNotification )
The IOAudioEngine::stopAudioEngine() is called from IOAudioDevice from IOAudioDevice::deactivateAllAudioEngines() called from IOAudioDevice::stop().
Why sample rate and bit depth are not processed the same way ?
Is there any way to have the IOAudioDevice::stop() called after a bit depth change ?
In most audio driver sample code I have seen, there is always one format (i.e. bit depth) dealt, so I wonder if there is something special to do when dealing multiple audio formats and switching from one another ?
In my CustomIOAudioEngine::performFormatChange, when the IOAudioStreamFormat is not null, I call the setFormat method on my output stream ... it sometimes works, sometimes don't.
I am surely missing something but don't know what yet.
I hope someone could help.
Thanks in advance.
Cheers.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden