AudioConverterConvertBuffer & sampleRate
AudioConverterConvertBuffer & sampleRate
- Subject: AudioConverterConvertBuffer & sampleRate
- From: Pierre-Olivier Latour <email@hidden>
- Date: Wed, 22 Jan 2003 00:29:15 -0800
Hi,
I'm trying to use the AudioConverterConvertBuffer, but apparently it fails
when the frequency differs between the two formats.
Right now, I load the content of an audio file in memory and then convert it
to the format used by the default audio output device. I convert the whole
data at once with AudioConverterConvertBuffer
If the frequency differs (e.g. Audio data is 22Khz and device is 44Khz), it
fails with an error indicating passed number of samples is wrong. Obviously,
it's because it needs more samples to perform rate conversion, but the
problem is: how do I pass these extra samples to the AudioConverter?
Note: I tried changing the kAudioConverterPrimeMethod property or setting
the leadingFrames and trailingFrames to 0 in kAudioConverterPrimeMethod, but
this had no effect.
My code do this:
outSize = numBytes;
AudioConverterGetProperty(converter,
kAudioConverterPropertyCalculateOutputBufferSize, &dataSize, &outSize);
outBuffer = malloc(outSize);
AudioConverterConvertBuffer(converter, numBytes, inBuffer, &outSize,
outBuffer);
_____________________________________________________________
Pierre-Olivier Latour email@hidden
Palo Alto, USA
http://www.pol-online.net
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.