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, 9 Jun 2004 19:02:39 -0700
What's the failure case when you set the connection?
Bill
On 09/06/2004, at 1:18 PM, Rolf Nilsson wrote:
>
>
>
Thanks for replying!
>
>
>
> 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...
>
>
Maybe the word "monitor" is not what I mean?
>
I want what is coming in at the input should be sent to the output.
>
>
Is it possible to make a connection between the input and output like
>
this (it does not work as I try it)
>
>
AudioUnitConnection connection;
>
connection.sourceAudioUnit = theInputUnit;
>
connection.sourceOutputNumber = 1;
>
connection.destInputNumber = 0;
>
AudioUnitSetProperty( theOutputUnit,
>
kAudioUnitProperty_MakeConnection, kAudioUnitScope_Input,
>
0/*inElement*/, &connection, sizeof(AudioUnitConnection));
>
>
>
or
>
>
must I transfer the incoming data from the input callback to the
>
output callback via a queue/ringbuffer
>
as in the /CoreAudio/HAL/AudioThru example?
>
>
>
>
>
> 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.
>
>
I did set up a render notification with AudioUnitAddRenderNotify() for
>
the output device (or should it be the input device?)
>
and in the notification callback I check for
>
>
if ( (*ioActionFlags & kAudioUnitRenderAction_PostRender) &&
>
(inBusNumber == 0))
>
{
>
// what do I do here?
>
}
>
>
>
>
>
> Does that make sense?
>
>
Not sure? I guess I'm a bit confused?
>
>
I just want the sound from the default input device to be sent to the
>
default output device (play thru)
>
>
Rolf
>
>
>
>
>
>
> 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]
>
>
>
_______________________________________________________________________
>
_
>
> __
>
>
>
--
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.