RE: Looking for input AUHAL & audio converter sample
RE: Looking for input AUHAL & audio converter sample
- Subject: RE: Looking for input AUHAL & audio converter sample
- From: Stephen Shaw <email@hidden>
- Date: Mon, 06 Feb 2006 16:37:23 -0800
- Thread-topic: Looking for input AUHAL & audio converter sample
Sorry, In my first post I should have included the code I had put together.
This is what I have so far, I'm wondering if I'm on track or completely off
base.
Thanks in advance,
Stephen
class AudioInputDevice
{
<code>
AudioStreamBasicDescription mInputASBD;
AudioConverterRef mConvertRef;
AudioUnit mInputUnit;
AudioDevice mInputDevice;
AudioBufferList* mpInputBufferList;
AudioRingBuffer* mpRingBuffer;
};
OSStatus AudioInputDevice::ACComplexInputProc (AudioConverterRef
inAudioConverter,
UInt32*
ioNumberDataPackets,
AudioBufferList* ioData,
AudioStreamPacketDescription**
outDataPacketDescription,
void*
inUserData)
{
OSStatus err = noErr;
AudioInputDevice* pDevice = (AudioInputDevice *)inUserData;
AudioBufferList* pBufferList = pDevice->mpInputBufferList;
for (UInt32 i = 0 ; i < pBufferList->mNumberBuffers; ++i)
{
ioData->mBuffers[i].mNumberChannels =
pBufferList->mBuffers[i].mNumberChannels;
ioData->mBuffers[i].mData =
pBufferList->mBuffers[i].mData;
ioData->mBuffers[i].mDataByteSize =
pBufferList->mBuffers[i].mDataByteSize;
}
*ioNumberDataPackets = pBufferList->mBuffers[0].mDataByteSize /
pDevice->mInputASBD.mBytesPerPacket;
return (err);
}
OSStatus AudioInputDevice::InputProc (void *inRefCon,
AudioUnitRenderActionFlags
*ioActionFlags,
const AudioTimeStamp
*inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList * ioData)
{
OSStatus err= noErr;
AudioStreamPacketDescription* outPacketDescription = NULL;
AudioInputDevice* pDevice = (AudioInputDevice *)inRefCon;
if (pDevice->mFirstInputTime < 0.)
pDevice->mFirstInputTime = inTimeStamp->mSampleTime;
//Get the new audio data
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->mpInputBufferList,
outPacketDescription);
checkErr(err);
pDevice->mpRingBuffer->Store (pDevice->mpInputBufferList,
inNumberFrames, SInt64(inTimeStamp->mSampleTime));
return err;
}
> I¹ve been looking at the ComplexPlayThru sample, which uses a Varispeed Unit
to convert sample rates. I¹m looking for an example of taking the input from
the AUHAL (using AudioUnitRender) and feeding it to an AudioConverter using
AudioConverterFillComplexBuffer to change the format. Can anyone point me to an
example of this or give me any tips on performing this sequence?
_______________________________________________
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