Thank you Bill, I had read in TN2091 that the AUHAL contained a
converter and I had considered using it by setting the output
format, but I was concerned about the dest format. I was also
confused that if the user selects another input device or changes
the samplerate, that I might still need an external Audio Converter.
The destination I'm trying to reach is
outputASBD.mSampleRate = 48000;// khz
outputASBD.mFormatID = kAudioFormatLinearPCM;
outputASBD.mFormatFlags = kAudioFormatFlagIsPacked
| kAudioFormatFlagIsSignedInteger;
outputASBD.mBytesPerPacket = 4;
outputASBD.mFramesPerPacket = 1;
outputASBD.mBytesPerFrame = 4;
outputASBD.mChannelsPerFrame = 2;
outputASBD.mBitsPerChannel = sizeof (SInt16) * 8;
outputASBD.mReserved = 0;
I have a subsystem that expects the audio in that format and it has
its own timer to pull the data. So what I was planing on doing was
using the AudioRingBuffer to store the audio until it was pulled
from the destination sub-system's timer routine. What I was trying
to set up in my InputProc callback was:
err= AudioUnitRender(pDevice->mInputUnit,
ioActionFlags,
inTimeStamp,
inBusNumber,
inNumberFrames, //# of frames requested
pDevice->mpInputBufferList);// Audio Buffer List to hold data
checkErr( err);
UInt32 convertFrames = inNumberFrames;
err = AudioConverterFillComplexBuffer (pDevice-
>mConvertRef, ACComplexInputProc, pDevice, &convertFrames, pDevice-
>mpConvertBufferList, NULL);
pDevice->mpRingBuffer->Store (pDevice-
>mpConvertBufferList, convertFrames , SInt64 (inTimeStamp-
>mSampleTime));
but I was getting a -50 error returned from the call to
FillComplexBuffer.
Thank you again for you valuable help,
Stephen
Macintosh Virtual PC Engineer
________________________________
From: William Stewart [mailto:email@hidden]
Sent: Tue 2/7/2006 6:04 PM
To: Stephen Shaw
Cc: CoreAudio API
Subject: Re: Help with AUHAL & AudioConverter
Stephen
What format do you need?
If your sample rate is the same (but you want say an interleaved or
int format), then you can actually have the AU do the format
conversion for you.
If the sample rate is different, then you will need to do the
conversion externally to the AU's render call.
The question though, is really too general to answer.
What are you doing with the audio input? If you are writing a file,
then you can use the ExtAF API and just give it the format that you
have - it will do all necessary conversions for you.
If you want the audio in some format in order to do some post-
processing or other activities with, then you need a more complex
solution - probably you will need to buffer the audio input you have
from the device (there are some AudioBuffer Ring Buffer code in
PubicUtility)... Then you run some other thread and use whatever
services you need to convert that audio to the format you want. The
AUHAL does NOT buffer audio, so you really can't call its render call
from an AudioConvFill's InputProc directly - at least there would
need to be a lot of gymnastics about getting the notifications and
time stamps right, etc...
Bill
On 07/02/2006, at 4:51 PM, Stephen Shaw wrote:
Using the ComplexPlayThru as an example, I'm able to get a AUHAL
set up which supplies me with audio input. I'm still trying to
discern the best way of taking this input and converting it to the
format I need. It looks like there's two options:
In the AUHAL input callback I can call the AudioUnitRender to
acquire the data and then call AudioConverterFillComplexBuffer to
convert it, or I could call AudioUnitRender from the AudioConveter
callback routine and return the acquired data to the converter from
there. One problem I see with the second option is I loose access
to the TimeStamp parameter in order to call AudioUnitRender.
I would really appreciate any help, tips or pointers anyone can
provide me since I've got a feature deadline pressing.
Stephen
Macintosh Virtual PC Engineer
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com
This email sent to email@hidden
--
mailto:email@hidden
tel: +1 408 974 4056
______________________________________________________________________
__
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
______________________________________________________________________
__
__
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com
This email sent to email@hidden