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: Tue, 8 Jun 2004 16:23:01 -0700
To monitor what is going out - lets say (like Chilton's previous
example) that you've established a connection between the AUHAL (input)
to something to AUHAL for output...
You can attach a render notification to the AUHAL - that gets called
whenever it renders (which is every I/O cycle)... In the AUHAL case
(because the same AU is doing input as well as output) you should check
the bus (element) number in the notification.
When you see both:
post render flag
and
bus zero
then the ABL that is passed to the render notification contains the
audio data that will then be fed to the device.
Does that make sense?
Bill
On 08/06/2004, at 6:29 AM, Rolf Nilsson wrote:
>
From: Rolf Nilsson <email@hidden>
>
Date: Tue Jun 8, 2004 2:04:48 PM Europe/Stockholm
>
To: email@hidden
>
Subject: How to monitor what is being recorded?
>
>
>
Hi,
>
>
I'm trying out the "afrecord" example in the
>
/CoreAudio/Services/AudioFileTools folder.
>
>
The example works fine (the snippet below is how to set up the audio
>
input unit).
>
>
My simple question is:
>
>
What should I do to get a "play thru" function, i.e. being able to
>
monitor what is being recorded?
>
The default audio output would be enough.
>
>
>
Thanks for any help
>
Rolf
>
>
----------------------------------------------------------
>
>
CAAudioFileRecorder::CAAudioFileRecorder(int nBuffers, UInt32
>
bufferSizeFrames) : CAAudioFileWriter(nBuffers, bufferSizeFrames),
>
mInputUnit(NULL),
>
mAudioInputPtrs(NULL)
>
{
>
// open input unit
>
Component comp;
>
ComponentDescription desc;
>
>
desc.componentType = kAudioUnitType_Output;
>
desc.componentSubType = kAudioUnitSubType_HALOutput;
>
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
>
desc.componentFlags = 0;
>
desc.componentFlagsMask = 0;
>
comp = FindNextComponent(NULL, &desc);
>
XThrowIf(comp == NULL, -1, "find audio input unit");
>
XThrowIfError(OpenAComponent(comp, &mInputUnit), "open audio input
>
unit");
>
>
>
UInt32 enableIO = 0;
>
XThrowIfError(AudioUnitSetProperty(mInputUnit,
>
kAudioOutputUnitProperty_EnableIO,
>
kAudioUnitScope_Output,
>
0,
>
&enableIO,
>
sizeof(enableIO)), "failed to disable output");
>
>
enableIO = 1;
>
XThrowIfError(AudioUnitSetProperty(mInputUnit,
>
kAudioOutputUnitProperty_EnableIO,
>
kAudioUnitScope_Input,
>
1,
>
&enableIO,
>
sizeof(enableIO)), "failed to enable input");
>
>
// select the default input device
>
UInt32 propSize = sizeof(AudioDeviceID);
>
AudioDeviceID inputDevice;
>
>
XThrowIfError(AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInp
>
u
>
tDevice,
>
&propSize,
>
&inputDevice),
>
"failed to get default input device");
>
>
XThrowIfError(AudioUnitSetProperty(mInputUnit,
>
kAudioOutputUnitProperty_CurrentDevice,
>
kAudioUnitScope_Global,
>
0,
>
&inputDevice,
>
sizeof(inputDevice)),
>
"failed to select input device");
>
>
// set render callback
>
AURenderCallbackStruct input;
>
input.inputProc = InputProc;
>
input.inputProcRefCon = this;
>
XThrowIfError(AudioUnitSetProperty(mInputUnit,
>
kAudioOutputUnitProperty_SetInputCallback,
>
kAudioUnitScope_Global,
>
0,
>
&input,
>
sizeof(input)), "connect input proc to output
>
unit");
>
>
XThrowIfError(AudioUnitInitialize(mInputUnit), "initialize audio input
>
unit");
>
>
}
>
_______________________________________________
>
coreaudio-api mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
>
Do not post admin requests to the list. They will be ignored.
>
>
--
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]
________________________________________________________________________
__
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.