hrm...
well after playing around some, I found that the following ends up solving my problem :
CODE
float *samples = (float *)malloc(chunk.samples*chunk.nch*sizeof(float));
double *psample = chunk.data;
for (int i=0;i<chunk.samples*chunk.nch;i++) {
double sample = *psample++;
samples[i] = (sample*100);
}
if (samples) {
free(samples);
}
basically, if I multiple the sample by 100, I get the desired value (and sound is fine and clear)...so the question is, what exactly is this doing ? (besides simply multiplying the value).
and the reason why I am doing this (converting from doubles to floats) is that the DSP that I am writing is a streaming encoder, and I am basically sending these samples to both LAME, Vorbis, and Windows Media.. LAME and WMA take in int samples, and vorbis takes in float samples, so I am keeping at least the float granularity, (and in the case of LAME and WMA converting from float to int samples)....I don't know of any encoder (used for streaming) that uses 64 bit samples...so I'm left to convert....which leads to another question I guess..is my assumption that I'm doing the right thing here correct ? All my resampling logic also deals with floats, and any other possible manipulation I do to the raw samples are done in float form, and then when the data is sent to LAME/WMA/Vorbis it is either converted to int samples, or left as float. I'd hate to think I am introducing artifacts into the stream as a result of the way I'm doing these conversions..
thanks for any help..
oddsock
update:
ok, so I'm an idiot, and had the "Attenuator" in the DSP before my DSP, which was making the samples very very quiet, (and seemingly 0) so my original code actually does work when I take the attenuator out of the DSP path...so I guess all is good now...