NAudio play only one mp3 always on two channels parallely

385 Views Asked by At

I want to do something like that:

Two stereo cards and I want to play music completely selectively, this means 1.mp3 on 1 channel in 1 sound card and 1 channel on 2 sound card, 2.mp3 on 2 channel in 1 sound card and 3.mp3 na 2 channel in 2 sound card. And changing that just in time.

I read about that few evenings and in my opinion best way is use NAudio, but I try to prepare hello world app in this scope and I have huge problems.

This is my code:

        WaveOut waveOut1 = new WaveOut();
       

        
        var input2 = new Mp3FileReader(@"c:\sample2.mp3");
        var input1 = new Mp3FileReader(@"c:\sample3.mp3");
        
           var waveProvider = new MultiplexingWaveProvider(new IWaveProvider[] { input1, input2 }, 2);
           waveProvider.ConnectInputToOutput(0, 0);
          

        waveOut1.Init(waveProvider);
        waveOut1.Play();
        

And if I changed connectinputtooutput args 0,1;1,0;0,0;1,1 I still hear input nr 2 on each channel (checked on two sound cards).

If I play these mp3 directly both working well.

This was my inspiration: https://markheath.net/post/handling-multi-channel-audio-in-naudio

Can somebody tell my why this script not working properly?

Or maybe you have simpler solution to achieve this? Maybe for linux?

thank you K.

0

There are 0 best solutions below