CoreAudio device removed question
CoreAudio device removed question
- Subject: CoreAudio device removed question
- From: Jean Bovet <email@hidden>
- Date: Tue, 13 May 2003 21:02:49 +0200
Hi,
I'm trying to understand how the CoreAudio is notifying the software
when an audio device is removed from the Mac.
Currently, I've installed a listener as follow:
AudioDeviceAddPropertyListener(mDeviceID, 0, DIRECTION_INPUT,
kAudioDevicePropertyDeviceIsAlive,
inputDevicePropertyListener, self);
Then, in the callback routine, I stop the ioProc of the device (the
ioProc is running) as follow:
static OSStatus inputDevicePropertyListener(AudioDeviceID inDevice,
UInt32 inChannel, Boolean isInput,
AudioDevicePropertyID
inPropertyID, void *inClientData)
{
if(inPropertyID == kAudioDevicePropertyDeviceIsAlive)
AudioDeviceStop(..., ...);
return noErr;
}
It work quite well for one ioProc. But if I register two ioProc (one
for input, the other for output - on the same device, let say the iMic)
and then I remove the device, sometime (and this is why I don't
understand - sometime) my program crash with the following backtrace:
Thread 3 Crashed:
#0 0x94d84b18 in
XIOAudioDevice::GetCurrent0TimeStamp(AudioTimeStamp&)
#1 0x94d83798 in XIOAudioDevice::Update0TimeStamp()
#2 0x94d82480 in XThreadedDevice::IOThread()
#3 0x94d95a24 in XThreadedDevice::IOThreadEntry(void*)
#4 0x94d911b0 in CAPThread::Entry(CAPThread*)
#5 0x90020d28 in _pthread_body
It seems like one of the ioProc didn't stop: but sometime, my program
doesn't crash and the two ioProc are correctly stopped. What I'm doing
wrong ? It is the "good" way of stopping an ioProc when a device is
removed ?
Thank you for any help.
Jean Bovet
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.