playing sound using direct sound
Posted on 2001-06-18
im try to play wave file
in this format:
8 khz,16 bit (sampled at),mono.
in the lpDirectSound->CreateSoundBuffer() func
i supply WAVEFORMATEX structure with this parmeters:
wf.wFormatTag = ; //i dont know
wf.nChannels = 1;
wf.nSamplesPerSec = 8000;
wf.nBlockAlign = 2;
wf.wBitsPerSample = 16;
the sound that i receive is very slow
and with lot of noise.
(in very slow i mean that the voice
is spread on long time)
the format of the sound file that i try to play,
is as codec output, before any manipulations (include pcm).
i dont know the correct parameter for field wf.wFormatTag in the WAVEFORMATEX structure.
is the direct sound is the good way for this task?
the original file is not pcm format, but now i convert it to pcm format, for using WAVE_FORMAT_PCM.
(Also, my code already based on Microsoft sample in direct sound documentation).
But the problem persists. (The sound spread on long time)
Its lock likes frequency mismatch,
May the hardware or driver translate the data as lowest sample rate so all sample take more time when playing it.