I’ve got the following code:
Uint8* AudioBuffer = nullptr;
Uint32 AudioBufferLength = 0;
SDL_memset(&SpecToAnalyse, 0, sizeof(SDL_AudioSpec));
SDL_LoadWAV(FilePath.c_str(), &SpecToAnalyse, &AudioBuffer, &AudioBufferLength);
if (SpecToAnalyse.format & AUDIO_F32)
{
const size_t NumSamples = AudioBufferLength / sizeof(float);
float* AsCorrectType = reinterpret_cast<float*>(AudioBuffer);
// Do DSP stuff()
}
I’m expecting audio samples within the range -1.0f to 1.0, but this isn’t the case.
Am I detecting the sample type incorrectly or is there an additional conversion function I’m meant to use?