Hey all,
I’m attempting to read a 24bit fixed point SDIR file (aiff, big endian) using an AudioFormatReader and my result is garbled. My question is that I’ve looked at the convertFixedToFloat function the reader is using and I’m not sure why that wouldn’t be sufficient - is my problem elsewhere? I’ve isolated the problem occurring in just the reading of the input file. Is this not the best method for reading an int into an AudioBuffer?
AudioFormatReader* reader = formatManager.createReaderFor (inputfile);
//wav produced no errors
if (reader != nullptr)
{
//correct channel count
if (reader->numChannels == 22)
{
reader->usesFloatingPointData = false;
dataBuffer.setSize (reader->numChannels, (int)reader->lengthInSamples);
bitDepth = reader->bitsPerSample;
sampleRate = reader->sampleRate;
reader->read(dataBuffer.getArrayOfWritePointers(), dataBuffer.getNumChannels(), 0, dataBuffer.getNumSamples());
}
}
edit: formatting