Re: How to monitor what is being recorded?
Re: How to monitor what is being recorded?
- Subject: Re: How to monitor what is being recorded?
- From: William Stewart <email@hidden>
- Date: Wed, 29 Sep 2004 11:01:14 -0700
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
>
>
> --
> 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]
> ________________________________________________________________________
> __
>
>
--
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