Run simultaenously two audio files on two different wireless speakers

Feb 28, 2011 at 5:16 PM

Hi...

 If I install two different wireless speaker's drivers on windows7.....will it be possible to run two audio files..on the two simultaneously..in C#?

Is it possible by using mciSendString()?? Or theres a different way...plz guide,..

Coordinator
Feb 28, 2011 at 6:31 PM

Yeah, this would be possible by setting the out devices explicitly, rather than using the "default" output device.

Jun 27, 2011 at 10:46 AM

can you please give us an example how we can send different sounds to different devices simultaneously. As i am new to this domain. please help me out. thanks. 

Jun 27, 2011 at 11:26 AM
hey even i didn't get ny reply 2 dis qs...so even I dont know :(
Mar 25, 2013 at 10:13 PM
Edited Mar 26, 2013 at 4:11 AM
I wrote this in VB. Hope this helps.
       'set the format (where SAMPLE_RATE = 44100 and NUM_BITS = 16)
        Dim format As New WaveFormat()
        format.FormatTag = WaveFormatTag.Pcm
        format.BitsPerSample = NUM_BITS
        format.Channels = 2
        format.SamplesPerSecond = SAMPLE_RATE

        'read in wav file as byte stream
        Dim f As New FileStream("testwav.wav", FileMode.Open)
        Dim bytes(CInt(f.Length - 1)) As Byte
        f.Read(bytes, 0, CInt(f.Length))
        f.Close()

        'open output with correct format - I am opening at index 0. Set this number to the correct index within the list given in WaveOut.Devices
        Dim o As New WaveOut(0)
        o.Open(format)

        'here is where we are telling the output to start playing our sound
        o.Write(bytes)

        'wait until sound is done playing
        System.Threading.Thread.Sleep(2000)

        'close the output
        o.Close()
Keep in mind that this is not entirely correct. Here, I am reading in the entire wav file and sending this to the sound card. Since there is some header information in the file, I believe that this header info will be played as if it was audio data. It would be best to find where the audio data starts and read the file from there. This website is helpful to learn about wav format: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/