Re: Acquiring input Data
Re: Acquiring input Data
- Subject: Re: Acquiring input Data
- From: Heath Raftery <email@hidden>
- Date: Wed, 22 Jun 2005 12:20:54 +1000
On 22/06/2005, at 12:03 AM, Paul Barbot wrote:
On 6/21/05, Heath Raftery <email@hidden> wrote:
I meant the content of the StreamBasicDescription. For example, after
your AudioUnit is set up, try the following:
CAStreamBasicDescription asbdClient;
UInt32 theSize = sizeof(asbdClient);
AudioUnitGetProperty(fInputUnit,
^^^^^^^^^^ oops, that should have been
InputUnit (or whatever you have called it)
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
1,
&asbdClient,
&theSize);
printf("client format:\n");
asbdClient.Print();
And check the output log.
I got that on the console :
AudioStreamBasicDescription: 0 ch, 44100 Hz, ' ' (0x00000000) 0
bits/channel, 0 bytes/packet, 0 frames/packet, 0 bytes/frame
I have a bad feeling about all these zero, is that normal ?.
No, I'm afraid that is not normal. Something has gone wrong here. Are
you doing the OpenAComponent bit (I assume that's your OpenUnit()
function)?
desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_HALOutput;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
comp = FindNextComponent(NULL, &desc);
OpenAComponent(comp, &InputUnit);
What about your SetDefaultInputDeviceAsCurrent()? You need to find
the system input device, and then set the input unit's device to that
device:
theSize = sizeof(AudioDeviceID);
AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice,
&theSize,
&InputDeviceID);
AudioUnitSetProperty(InputUnit,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Input,
1,
&InputDeviceID,
sizeof(InputDeviceID));
After all that is done, printing the StreamBasicDescription should
give you something like this:
AudioStreamBasicDescription: 2 ch, 44100 Hz, 'lpcm' (0x0000002B) 32-
bit big-endian float, deinterleaved
I have tried to do that but I have no more call of the callback
where I must put that allocation ??
That's odd! It wasn't supposed to affect the calling of your
callback. Just replace your allocation (your
"theBufferList.mNumberBuffers = 1;" etc.) with what I've posted.
Remember to declare the global variable "AudioBufferList
*theBufferListPtr;". As long as you allocate before your callback is
called, but after InputUnit has been connected to the
DefaultOutputUnit, you should be fine. If your callback is not being
called something else must have gone screwy - check to make sure your
"MyInputCallbackSetup()" and "InitAndStartAUHAL()" is working right.
OK it's just a previous allocation that I forget in my code, now the
callback run
and i have no more -50 error !! However the ioActionFlag of the render
is always set to 0
and there are no data in my buffer :( .
Well that's progress :)
Keep an eye on your InputUnit in the debugger. It should start to
fill with values as you go through the functions to set it up. Follow
the technote you were reading, and make sure you have included the
functions we've mentioned in this thread. You'll get there!
Heath
_______________________________________________
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