• 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
Re: How to check if a system has an audio input?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to check if a system has an audio input?


  • Subject: Re: How to check if a system has an audio input?
  • From: William Stewart <email@hidden>
  • Date: Tue, 28 Sep 2004 15:31:25 -0700

Title: Re: How to check if a system has an audio input?
What you are doing is correct... The “problem” is that AUHAL is an AU that can be used for either/or/both input and output, so it will always have a device that it is using...

Another way to do this with the AUHal unit is to get the format for the input scope on element 1 (this is where the input side of the device lives) - if that returns an error, you can assume that you have no input capability on the device currently being used by the AUHAL unit

Bill

On 28/9/04 12:15 PM, "Rolf Nilsson" <email@hidden> wrote:


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


--
mailto:email@hidden
tel: +1 408 974 4056

__________________________________________________________________________
Culture Ship Names:
Ravished By The Sheer Implausibility Of That Last Statement [GSV]
I said, I've Got A Big Stick [OU]
Inappropiate Response [OU]
Far Over The Borders Of Insanity And Still Accelerating [Eccentric]
__________________________________________________________________________

 _______________________________________________
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

References: 
 >How to check if a system has an audio input? (From: Rolf Nilsson <email@hidden>)

  • Prev by Date: Re: question about CoreMIDI & cocoa
  • Next by Date: Re: question about CoreMIDI & cocoa
  • Previous by thread: How to check if a system has an audio input?
  • Next by thread: AU Host problem
  • Index(es):
    • Date
    • Thread