casting void* to float* creates only zeros
- by Paperflyer
I am reading an audio file using CoreAudio (Extended Audio File Read Services). The audio data gets converted to 4-byte float and handed to me as a void* buffer. It can be played with Audio Queue Services, so its content is correct.
Next, I want to draw a waveform and thus need access to the actual samples.
So, I cast void* audioData to float*:
Float32 *floatData = (Float32 *)audioData;
When accessing this data however, I only get 0.0 regardless of the index.
Float32 value = floatData[index]; // Is always zero for any index
Am I doing something wrong with the cast?