• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to check if a system has an audio input?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: How to check if a system has an audio input?
      • From: William Stewart <email@hidden>
  • Prev by Date: Re: AUBase.h:672: error: 'struct HostCallbackInfo' has no member named 'transportStateProc'
  • Next by Date: Re: AUBase.h:672: error: 'struct HostCallbackInfo' has no member named 'transportStateProc'
  • Previous by thread: Re: AUBase.h:672: error: 'struct HostCallbackInfo' has no member named 'transportStateProc'
  • Next by thread: Re: How to check if a system has an audio input?
  • Index(es):
    • Date
    • Thread