Well it looks like you've done enough to get a buffer of ALint values. What is the range of possible valid values in that buffer? Then normalizing to float is as simple as:
float intermediate_value = (i_val - min_ival)/float(max_ival - min_ival);
float f_val = min_fval + intermediate_value*(max_fval - min_fval);
If the integers, for example, all lie between 0 and 65535 (16 bit unsigned integers), and you want floats between -1 and 1, then the values are
int min_ival = 0;
int max_ival = 65535;
float min_fval = -1.0f;
float max_fval = 1.0f;
Keep in mind: expressions which don't change can be evaluated once, and multiplication is often faster than division. Though a really good optimizing compiler will take care of it for you.
raptr_dflo
Practically a Master Poster
602 posts since Aug 2010
Reputation Points: 76
Solved Threads: 82