View Single Post
Old 09-17-2014, 12:56 PM   #8
bozmillar
Human being with feelings
 
bozmillar's Avatar
 
Join Date: Sep 2009
Posts: 623
Default

glancing quickly that seems to be right. Just remember that the data is 16bit samples and mData is declare as a char*. That's fine so you can keep track in bytes the amount of data to load, but to convert to floats or doubles, you'll need to also make a

short int *mDataS;

and just make it so it points to the same location as *mData. Then you can just take the samples from mDataS to get the values of each sample.

To convert those values to floats, just divide each sample by 16384 so you can normalize it to -1->1 instead of -16384->16384.

Then you end up with a buffer of doubles that you can do whatever you want with.
__________________
http://www.bozdigitallabs.com
bozmillar is offline   Reply With Quote