c++ - Portaudio high pitch noise while playing wave -


i'm trying play simple wave file using portaudio library.

i thought should simple, wrote simple callback. wave 16bits per sample , 2 channels have assumed pasting integer output stream ok (sample per integer).

int *out = (int*)outputbuffer; for(int i=0; i<framesperbuffer; i+=4 )     *out++ = *(reinterpret_cast<int*>(&data->chunk[i])); 

(i have stored data file characters)

music plays fine noised addition of high pitch.

i tried left idea of reinterpreted cast , did move chars. no matter did writing output buffer sounded before. ran out of ideas fix this.

outputparameters.channelcount = 2; outputparameters.sampleformat = paint16 ; //    outputparameters.suggestedlatency = pa_getdeviceinfo( outputparameters.device )->defaultlowoutputlatency; outputparameters.suggestedlatency = pa_getdeviceinfo( outputparameters.device )->defaulthighoutputlatency; outputparameters.hostapispecificstreaminfo = null;  

those output params.


Comments