How to monitor what is being recorded?
How to monitor what is being recorded?
- Subject: How to monitor what is being recorded?
- From: Rolf Nilsson <email@hidden>
- Date: Tue, 8 Jun 2004 15:29:48 +0200
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(kAudioHardwarePropertyDefaultInpu
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.