How to set buffer size for Audio Output Unit?
How to set buffer size for Audio Output Unit?
- Subject: How to set buffer size for Audio Output Unit?
- From: Christof Faller <email@hidden>
- Date: Tue, 28 Aug 2001 15:53:32 -0400
I am using the default audio output unit for implementing
a real-time audio decoder. My decoder is frame based,
that means, it decodes always N samples at once
(e.g. 2048).
I use an input callback function for the default output
unit (kAudioUnitProperty_SetInputCallback).
AudioUnitRenderActionFlags is zero. Am I allowed in this
case to just override the buffer (ioData), by filling this struct
with my desired buffer size and setting the data pointer to
my data?
I did not get it to work yet.
This is my question again:
OSStatus AudioUnitCallback(void *inRefCon, AudioUnitRenderActionFlags
inActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber,
AudioBuffer *ioData)
{
BCC_vars* bcc_vars = inRefCon; // get access to data
BCC_params* bcc_params = bcc_vars->bcc_params;
int framesize = bcc_params->framesize;
int i;
float *fbuf;
bcc_vars->getsamples(bcc_vars);
ioData->mDataByteSize = framesize * 2 * sizeof(float);
ioData->mNumberChannels = 2;
ioData->mData = (float*) bcc_vars->rbuf;
etc.
}
======>
I am allowed to override the buffer like this?
Thanks for any comments!
Chris