Author Topic: Stereo output with Mono Left channel / Mono Right Channel  (Read 51 times)

Cafony

  • Posts: 28
Ive made this funtion.

But cant figuire out why cant work:
Mono to stereo out
-----------right channel => right channel
-----------right channel => Left channel


Inicial stream: _stream

Code: [Select]
        public void  CreateMonoOutLeft()
        {
                     
         //int monoStream = BassMix.CreateMixerStream(44100, 2, BassFlags.Default); // 2 channel for stereo
           int monoStream = BassMix.CreateMixerStream(44100, 2, BassFlags.Float | BassFlags.MixerNonStop);


            BassMix.MixerAddChannel(monoStream, _stream, BassFlags.MixerChanDownMix | BassFlags.Float);
            // Set the matrix to swap the left and right channels
                float[,] matrix = { { 1.0f, 0.0f }, // Left speaker plays the left channel
                                        { 1.0f, 0.0f }  // Right speaker also plays the left channel
                          };

                BassMix.ChannelSetMatrix(monoStream, matrix);               
                           
        }
Thanks for help.

Ian @ un4seen

  • Administrator
  • Posts: 26077
The "MixerChanDownMix" flag only enables matrix mixing if downmixing is applicable. It isn't if the mixer and source are both stereo. You should use "MixerChanMatrix" instead to always enable matrix mixing, and that'll hopefully fix the problem you're having. The "BassFlags.Float" flag should also be removed from the MixerAddChannel call, as it's invalid and unnecessary there (the mixer's format is set in the CreateMixerStream call).

Cafony

  • Posts: 28
Im using ManagedBass library
and there is no MixerChannelMatrix method.
How can I do it?
Thanks

Ian @ un4seen

  • Administrator
  • Posts: 26077
Yep, I noticed you were using ManagedBass, so checked that for the flag's name (the original name is BASS_MIXER_CHAN_MATRIX). Here's where it's defined:

   https://github.com/ManagedBass/ManagedBass/blob/5856a8baf538e7d91fa0b4ce6ba5de45d91bb016/src/Bass/Shared/Bass/Enumerations/BassFlags.cs#L427

If you don't see it in your ManagedBass version then you could try "MixerMatrix" instead, which was a previous name for it.