Hello,
I am implementing my audio HAL plugin based on NullAudio sample code (the fragment attached below).
I noticed that the code that implements start/stop counter is never triggered, as if the Core Audio "optimizes" something internally and only calls "start" for the very first client and it only calls stop for the very last client.
That's a problem for me; is there any way around it? I want all starts/stops to know exact number of current clients.
I am implementing my audio HAL plugin based on NullAudio sample code (the fragment attached below).
I noticed that the code that implements start/stop counter is never triggered, as if the Core Audio "optimizes" something internally and only calls "start" for the very first client and it only calls stop for the very last client.
Code Block ClientA starts IO // NullAudio_StartIO is called, ok ClientB starts IO // NullAudio_StartIO is not called? ClientA stops IO // NullAudio_StopIO is not called? ClientB stops IO // NullAudio_StopIO is called, ok
That's a problem for me; is there any way around it? I want all starts/stops to know exact number of current clients.
Code Block static OSStatus NullAudio_StartIO(AudioServerPlugInDriverRef inDriver, AudioObjectID inDeviceObjectID, UInt32 inClientID) { // This call tells the device that IO is starting for the given client. When this routine // returns, the device's clock is running and it is ready to have data read/written. It is // important to note that multiple clients can have IO running on the device at the same time. // So, work only needs to be done when the first client starts. All subsequent starts simply // increment the counter. .... // IO is already running, so just bump the counter ++gDevice_IOIsRunning; // NEVER CALLED }
Code Block static OSStatus NullAudio_StopIO(AudioServerPlugInDriverRef inDriver, AudioObjectID inDeviceObjectID, UInt32 inClientID) { ... // IO is still running, so just bump the counter --gDevice_IOIsRunning; // NEVER CALLED }