How to check if a system has an audio input?
How to check if a system has an audio input?
- Subject: How to check if a system has an audio input?
- From: Rolf Nilsson <email@hidden>
- Date: Tue, 28 Sep 2004 21:15:59 +0200
Hi,
I'm trying out the "afrecord" example in the /
CoreAudio/Services/AudioFileTools folder.
That example uses the default audio input.
Some computers does not come with a built in audio input.
How do I detect that a system does not have an audio input?
Even if there is no audio input, the following does not return an error:
// Get the Current Input Device ID
// this should be done only after IO has been enabled on the AUHAL.
propSize = sizeof(mInputDevice.mID);
XThrowIfError(AudioUnitGetProperty(mInputUnit,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global,
0,
&mInputDevice.mID,
&propSize), "failed to get current audio input device ID");
So I tried kAudioDevicePropertyDeviceIsAlive:
propSize = sizeof(UInt32);
UInt32 isAlive;
XThrowIfError(AudioDeviceGetProperty(mInputDevice.mID,
0,
true/*isInput*/,
kAudioDevicePropertyDeviceIsAlive,
&propSize,
&isAlive), "failed to check if the device is alive");
This one fails if there is no audio input. So this kind of works for my purpose but my feeling is that there should be a better way?
Thanks for any help
Rolf Nilsson
_______________________________________________
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