• 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 monitor what is being recorded?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to monitor what is being recorded?


  • Subject: Re: How to monitor what is being recorded?
  • From: Doug Wyatt <email@hidden>
  • Date: Wed, 29 Sep 2004 11:19:29 -0700

Testing the format's number of channels against 0 is a definitive test.

Getting the kAudioOutputUnitProperty_HasIO property for bus 1 is equally definitive.

Doug

On Sep 29, 2004, at 11:01, William Stewart wrote:
Sorry - missed this... That doesn't seem a great guarantee to me - though
its something I look at as well. I'd make sure you include (as you're doing)
a check for a non-zero result code as well as numberChannels being equal to
zero as failure conditions.


Bill

On 29/9/04 3:28 AM, "Rolf Nilsson" <email@hidden> wrote:



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


This is what I did before (if that is what you mean?):


CAStreamBasicDescription clientFmt; UInt32 ioDataSize = sizeof(CAStreamBasicDescription);

XThrowIfError(AudioUnitGetProperty(
mInputUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
1,  //AudioUnitElement 1 is input
(void *)&clientFmt,
&ioDataSize), "failed to get audio input format");


this returns no error regardless if the input device is available or not


so I checked the sample rate and/or the number of channels

// returns 0 channels and/or(?) 0 Hz as sample rate if no input device
on system
XThrowIf(clientFmt.mSampleRate == 0 || clientFmt.NumberChannels() ==
0, -1, "This computer does not appear to have any audio input device.
Application will quit.");


Also seems to work allthough I'm not sure the sample rate and/or the number of channels will always be zero?


Rolf Nilsson






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
References: 
 >Re: How to monitor what is being recorded? (From: William Stewart <email@hidden>)

  • Prev by Date: Re: How to monitor what is being recorded?
  • Next by Date: Re: AUEffectBase::ChangeStreamFormat changes sOld
  • Previous by thread: Re: How to monitor what is being recorded?
  • Next by thread: AU Render() and multi-out MusicDevice
  • Index(es):
    • Date
    • Thread