[Audio Input Bus] Getting Buffers
[Audio Input Bus] Getting Buffers
- Subject: [Audio Input Bus] Getting Buffers
- From: "Malik 522" <email@hidden>
- Date: Thu, 13 Oct 2005 11:05:20 +0000
hi all
I would like to catch buffers from the output of the Audio Input Bus.
My Input Scope is configured like this :
-----------------------------------------------------
input.mSampleRate = 44100
input.mBytesPerPacket = 4
input.mFramesPerPacket = 1
input.mBytesPerFrame = 4
input.mChannelsPerFrame = 1
input.mBitsPerChannel = 32
-----------------------------------------------------
and I configure my Output Scope like this :
-----------------------------------------------------
output.mSampleRate = 8000
output.mBytesPerPacket = 2
output.mFramesPerPacket = 1
output.mBytesPerFrame = 2
output.mChannelsPerFrame = 1
output.mBitsPerChannel = 16
-----------------------------------------------------
The problem is that I dont know how to use the AudioUnitRender and its
parameters... I want to catch 160 packets, each packet contains 2 bytes. I
dont know why, but AudioUnitRender works if numberOfFrames=512, but returns
an error if numberOfFrames=160...
my code :
----------------------------------------------------------------------------------------------------------
flags = 0;
kNumChannels = 160;
theAudioData = (AudioBufferList *)malloc(offsetof(AudioBufferList,
mBuffers[kNumChannels]));
theAudioData->mNumberBuffers = kNumChannels;
for (int i = 0; i < kNumChannels; i++)
{
theAudioData->mBuffers[i].mNumberChannels = 1;
theAudioData->mBuffers[i].mDataByteSize = 2;
theAudioData->mBuffers[i].mData = NULL;
}
OSStatus err = AudioUnitRender(theInputUnit, &flags, &myTimeStamp, 1,
numberOfFrames, theAudioData); // it doesnt work if numberOfFrames=160...
myTimeStamp.mSampleTime += kNumFramesPerSlice;
----------------------------------------------------------------------------------------------------------
Any idea ?
thx in advance
Dragoon
_______________________________________________
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