0

I have written an application using MSoft WaveOut api and it works fine except that my speakers don't play stereo only mono. When I plug an earphone in one of the two jacks in one I get the same mono behavior but the other jack plays the file in stereo. If I use something that uses DirectX api, all plays in stereo. My equipment is Dell Studio XP. Can someone suggest a reason for this?

2 Answers2

0

you shold change Channels parameter from 1 to 2

format.wFormatTag = 1 ' PCM
format.nChannels = 1 '1=mono   ,  2=Steero <<<<<<
format.nSamplesPerSec = 8000 ' 12000
format.wBitsPerSample = 16
0

The problem was with the volume. I was setting the volume with code like:

unsigned long x = 0xFFFF;
MMRESULT result = waveOutSetVolume( _audio_device, x );

when in fact, I needed to do:

unsigned short left = unsigned(0xFFFF * v);
unsigned short right = unsigned(0xFFFF * v);

unsigned long x = left + (right << 16);
MMRESULT result = waveOutSetVolume( _audio_device, x );