Mismatch with input/output buffers
Mismatch with input/output buffers
- Subject: Mismatch with input/output buffers
- From: Benedict Singer <email@hidden>
- Date: Thu, 24 Jul 2003 17:13:03 +0200 (MEST)
Lo again all,
I'm having another interesting issue with AudioConverters. Since the
playout part of this app receives 2048 samples at a time, I decided that
I'd like to just throw each group of 2048 samples through the
AudioConverter, and buffer the output until I have enough to playout. This
is a slight switch from my previous method, which was to buffer the input
until I had enough to convert into the right amount for playout.
So in this situation I use:
UInt32 dataSize = 2048*sizeof(float);
AudioConverterGetProperty(gConverter,
kAudioConverterPropertyCalculateOutputBufferSize, &propSize, &dataSize);
to work out how much data it would give me back when presented with 2048
samples. However, when I then ask for this much data, it wants *more* than
2048 samples:
data->acOutputSize = dataSize;
... (set up variables, doesn't change the AC)
dataSize = data->acOutputSize;
AudioConverterGetProperty(gConverter,
kAudioConverterPropertyCalculateInputBufferSize, &propSize, &dataSize);
fprintf(stderr, "interesting, it wants: %u converted from %u\n", dataSize,
2048*sizeof(float));
This outputs:
interesting, it wants: 8224 converted from 8192
and my inputDataProc confirms that it is asking for 8224. So either the
AudioConverter is doing its calculations wrong, or there's an issue I'm
missing here. I've set the prime method to none, so that's not
contributing to the issue.
Now, when I call AudioConverterFillBuffer I'm not actually interesting in
getting a specific amount of output data, just in processing a specific
amount of input data. However, I can't see a way to call it other than by
working out how much output it will generate when presented with my
samples, and then asking for that much.
Suggestions? Is there some calculation I need to do myself to find out the
correct values?
TIA,
Ben
_______________________________________________
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.