readData reading garbage the first few thousand bytes

(Gitle Mikkelsen) #1

Hi, I’m using readData to decode files for offline analysis of FFT etc. But I have a problem with this function. I tried decoding a small chunk, about 2000 samples, but I only read what seemed like garbage, either random numbers or 0 etc. I struggled with this for a while until I tried a larger chunk, and then I saw that after about 4000 samples or so, the actual valid PCM data seem to start.

Is there a way to avoid this header or whatever it is of non-sample data at the beginning of a sound when using readData? So that when I use seekData to set the position to 0, then the first thing readData decodes are actual PCM samples at position 0.

(Cameron Baron) #2

It sounds like you are using FMOD_OPENRAW to open the file, this will load the headers as the first part of the data.
FMOD_OPENONLY is what you will want to use to avoid this.