Reputation: 7197
My device has 2 external speakers. How can I separatly test them?
1 function that will play sound only on left one and one that will play sound only on right one.
Googled without success. Maybe I'm using the wrong terms.
Maybe set the balance using WIN32 API?
Upvotes: 4
Views: 2986
Reputation: 19956
If you are talking about 2 speakers from stereo speaker system setup, then your solution is simple.
Create a sound that plays only on left channel, then play it. Then, create a sound that plays only on right channel, play it.
You can use Audacity for creating a sounds.
As .NET API is concerned, you can try your luck with http://windowsmedianet.sourceforge.net/
What you might need is http://msdn.microsoft.com/en-us/library/ms712636(VS.85).aspx, as they have them neatly wrapped.
EDIT:
BTW, you can use waveOutOpen to open same device twice, and once play LEFT sound file, and independently play RIGHT sound file on two separate waveOutOpen device handles that both point to same physical device. Sound will come out just as expected, on the speaker of your choice depending on the type of sound.
Further, if you want to create sounds programatically, having only LEFT channel means that your every other PCM sample in the audio file should be 0.
I wouldn't recommend using balance, because mixer API is difficult to understand, and you'll set API for BOTH played samples accidentally.
Even more info:
You can use http://msdn.microsoft.com/en-us/library/system.media.soundplayer(VS.80).aspx to play WAV files. If you don't have WAV files but you want to play something from MemoryStream
, find a way to insert some form of a WAV header at the front of your audio sample data. You won't be the first one to try it :)
Upvotes: 4