# MultiChannel Problems

**URL:** <https://forum.juce.com/t/multichannel-problems/1728>\
**Category:** General JUCE discussion\
**Created:** [May 25, 2007, 10:40am UTC](https://forum.juce.com/t/multichannel-problems/1728 "2007-05-25T10:40:05Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![dO3](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/do3/32/409_2.png) [@dO3](https://forum.juce.com/u/dO3)\
**Post date:** [May 25, 2007, 10:40am UTC](https://forum.juce.com/t/multichannel-problems/1728/1 "2007-05-25T10:40:05Z")

</div>

Hi… I’ve this problem:  
I have to use 8 audio channels in output.  
So, i choose the sound card and select the 8 channels, but the “audiosamplebuffer info” that i use in the getNextAudioBlock has always just 2 channels; it let me stream audio just to the first two channel selected in the selector (eg, if i select 1…8 audio comes out from monitor 1&2, if i deselect channels 1&2 audio comes out from monitor 3&4…)  
I think that when i choose the sound card in the AudioDeviceSelectorComponent it has to change the channel number in the buffer… but nothing!

Let me know what it’s possible that i miss

thanks and forgive me for my english

Marcello

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 25, 2007, 10:58am UTC](https://forum.juce.com/t/multichannel-problems/1728/2 "2007-05-25T10:58:20Z")

</div>

The number of channels is set in AudioDeviceManager::initialise().

---

<div class="post-metadata">

**Author:** ![dO3](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/do3/32/409_2.png) [@dO3](https://forum.juce.com/u/dO3)\
**Post date:** [May 25, 2007, 12:37pm UTC](https://forum.juce.com/t/multichannel-problems/1728/3 "2007-05-25T12:37:18Z")

</div>

so it’s not atomatic that if i select 8 (or more…) channel in the selector the buffer will become an 8 channel uffer??

but anyhow, when i create the devicemanager i do this:

```auto
const String error (audioDeviceManager.initialise (1, /* number of input channels */
                        8, /* number of output channels */
                        0, /* no XML settings.. */
                        true /* select default device on failure */));

    if (error.isNotEmpty())
    {
        AlertWindow::showMessageBox (AlertWindow::WarningIcon,
                                     T("Audio Demo"),
                                     T("Couldn't open an output device!\n\n") + error);
    }
    else
    {

        // ..and connect the mixer to our source player.
        audioSourcePlayer.setSource (&transportSource2);

        // start the IO device pulling its data from our callback..
        audioDeviceManager.setAudioCallback (this);

       /* other stuff */
    }
		audioSettingsComp=new AudioDeviceSelectorComponent ( audioDeviceManager,
                                                            0, 1,
                                                            2, 8,
                                                            true);
		audioSettingsComp->setSize (500, 300);

```

but always just 2 channels opened…  
maybe it’s becouse, by default, my app first open a sound card with 2 chan out… then i choose the other one…

let me know…

thanks jules

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 25, 2007, 12:47pm UTC](https://forum.juce.com/t/multichannel-problems/1728/4 "2007-05-25T12:47:19Z")

</div>

Well if you’ve only got 2 channels active then the callback just gives you a buffer containing those 2 channels.

---

<div class="post-metadata">

**Author:** ![dO3](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/do3/32/409_2.png) [@dO3](https://forum.juce.com/u/dO3)\
**Post date:** [May 25, 2007, 12:55pm UTC](https://forum.juce.com/t/multichannel-problems/1728/5 "2007-05-25T12:55:18Z")

</div>

so, after selecting the new device i got to call the initialise(…); right?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 25, 2007, 1:40pm UTC](https://forum.juce.com/t/multichannel-problems/1728/6 "2007-05-25T13:40:18Z")

</div>

No, you don’t have to call it again. Sorry, I’m not sure I understand exactly what the problem is?

---

<div class="post-metadata">

**Author:** ![dO3](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/do3/32/409_2.png) [@dO3](https://forum.juce.com/u/dO3)\
**Post date:** [May 25, 2007, 2:20pm UTC](https://forum.juce.com/t/multichannel-problems/1728/7 "2007-05-25T14:20:46Z")

</div>

Maybe it’s becouse of my english… 😃  
Ok, let me explain better than before…

In the constructor of the main component i do this:

```auto
const String error (audioDeviceManager.initialise (1, /* number of input channels */
                        8, /* number of output channels */
                        0, /* no XML settings.. */
                        true /* select default device on failure */));

    if (error.isNotEmpty())
    {
        AlertWindow::showMessageBox (AlertWindow::WarningIcon,
                                     T("Audio Demo"),
                                     T("Couldn't open an output device!\n\n") + error);
    }
    else
    {

        // ..and connect the mixer to our source player.
        audioSourcePlayer.setSource (&transportSource2);

        // start the IO device pulling its data from our callback..
        audioDeviceManager.setAudioCallback (this);

       /* other stuff */
    }
      audioSettingsComp=new AudioDeviceSelectorComponent ( audioDeviceManager,
                                                            0, 1,
                                                            2, 8,
                                                            true); 
```

When i run the app, it choose the default audiodevice that has 2 output channels.

Then I open the AudioDeviceSelectorComponent and choose the other audiodevice selecting all the 8 output channels.

But when i “play” audio just the first 2 channels selected (1&2 or, if 1&2 are uncecked, 3&4…) will stream audio; this (i think) becouse info.buffer in the getNextAudioBlock got still 2 output channels.

I thought that selecting the right audiodevice and selecting the output channels to open then info.buffer would change with it.

I hope you understand what i mean…

Thanks

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 25, 2007, 3:00pm UTC](https://forum.juce.com/t/multichannel-problems/1728/8 "2007-05-25T15:00:34Z")

</div>

Ok. If you can select and activate 8 channels in the audio device panel, then the audio device will definitely be delivering an 8-channel buffer in its callback…

But I think I recently fixed the AudioSourcePlayer code because that was only passing on the first two channels to the audio source… Are you using the latest juce version?

---

<div class="post-metadata">

**Author:** ![dO3](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/do3/32/409_2.png) [@dO3](https://forum.juce.com/u/dO3)\
**Post date:** [June 1, 2007, 12:57pm UTC](https://forum.juce.com/t/multichannel-problems/1728/9 "2007-06-01T12:57:24Z")

</div>

I got Juce 1.41…  
Could be this???  
let me know…

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [June 1, 2007, 1:00pm UTC](https://forum.juce.com/t/multichannel-problems/1728/10 "2007-06-01T13:00:06Z")

</div>

Yes, try the latest one.

---

<div class="post-metadata">

**Author:** ![dO3](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/do3/32/409_2.png) [@dO3](https://forum.juce.com/u/dO3)\
**Post date:** [June 1, 2007, 1:54pm UTC](https://forum.juce.com/t/multichannel-problems/1728/11 "2007-06-01T13:54:02Z")

</div>

Nothing…  
I try to open just 1 channel to test, but when debugging i find just 2 channel for the info.buffer!!!

Just to tell you: when I choose the asio device in the selector and also choose all the 8 channels in the output tab of VC++ appear:

```auto
in 0 0
out 1 0
out 2 1
out 3 2
out 4 3
out 5 4
out 6 5
out 7 6
out 8 7
```

I really don’t know what it is and what to do…

help me…

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [June 1, 2007, 2:07pm UTC](https://forum.juce.com/t/multichannel-problems/1728/12 "2007-06-01T14:07:32Z")

</div>

I’m working on some multi-channel apps at the moment and they work just fine, so it’s very unlikely to be a bug - you must just be misunderstanding something.

The debug info shows that it is opening that many channels, so I assume you’re getting them in your callback. Sorry, without seeing all your code I can’t guess what else you might be missing…

---

<div class="post-metadata">

**Author:** ![dO3](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/do3/32/409_2.png) [@dO3](https://forum.juce.com/u/dO3)\
**Post date:** [June 1, 2007, 2:50pm UTC](https://forum.juce.com/t/multichannel-problems/1728/13 "2007-06-01T14:50:21Z")

</div>

I compiled the jucedemo to see if i did something stupid… but even with it just 2 channels spray audio…  
what da hell!!!

---

<div class="post-metadata">

**Author:** ![dO3](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/do3/32/409_2.png) [@dO3](https://forum.juce.com/u/dO3)\
**Post date:** [June 1, 2007, 3:02pm UTC](https://forum.juce.com/t/multichannel-problems/1728/14 "2007-06-01T15:02:59Z")

</div>

breaking news:

I told you i try with the jucedemo…  
now, with the audio sound (cello) it do not work… but it work with the mid, all the channels!!!

wow… but what it means???

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [June 1, 2007, 3:10pm UTC](https://forum.juce.com/t/multichannel-problems/1728/15 "2007-06-01T15:10:33Z")

</div>

Eh? Of course the cello only uses 2 channels, it’s a stereo sample. And the demo’s only designed to use 2 channels anyway. Not sure I understand what you think is wrong?

---

<div class="post-metadata">

**Author:** ![dO3](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/do3/32/409_2.png) [@dO3](https://forum.juce.com/u/dO3)\
**Post date:** [June 1, 2007, 3:14pm UTC](https://forum.juce.com/t/multichannel-problems/1728/16 "2007-06-01T15:14:53Z")

</div>

let me explain…  
i modified the jucedemo code to use asio device and then i select my device (that allow to use up to 10 out channels).  
Now if i play midi it sounds good…  
i know that cello is a stereo file but i thought, maybe i was wrong, that it would play the same…

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [June 1, 2007, 3:21pm UTC](https://forum.juce.com/t/multichannel-problems/1728/17 "2007-06-01T15:21:18Z")

</div>

So there’s no problem, right?

---

<div class="post-metadata">

**Author:** ![dO3](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/do3/32/409_2.png) [@dO3](https://forum.juce.com/u/dO3)\
**Post date:** [June 1, 2007, 3:23pm UTC](https://forum.juce.com/t/multichannel-problems/1728/18 "2007-06-01T15:23:55Z")

</div>

uhm… no, problems remain!  
but i don’t want to bore you anymore… today!!! 😃  
i will try… i got to play audiosample in all the channels…  
so I will try!

See you tomorrow Jules 🙂

ps: thanks

---

<div class="post-metadata">

**Author:** ![dO3](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/do3/32/409_2.png) [@dO3](https://forum.juce.com/u/dO3)\
**Post date:** [June 6, 2007, 1:45pm UTC](https://forum.juce.com/t/multichannel-problems/1728/19 "2007-06-06T13:45:13Z")

</div>

hi, here I am again…  
Let me explain the actual situation; i got something like this:

```auto
AudioSourcePlayer <-- TransportSource <-- MyMixer <-- Filter0 <-- Channel0
                                                  <-- Filter1 <-- Channel1
                                                  <-- FilterN <-- ChannelN  
```

where MyMixer, Filter and Channel inherit from PositionableAudioSource.  
In this situation I can play, stop and other but the channel number for MyMixer is always 2!

if I try this:

```auto
AudioSourcePlayer <-- MyMixer <-- Filter0 <-- Channel0
                              <-- Filter1 <-- Channel1
                              <-- FilterN <-- ChannelN  
```

it let me change the channel number in MyMixer in whatever I choose in the AudioDeviceSelector… but, obviously, becouse of there’s no transportsource, i cannot start playing and other…

Help me find the solution to my sick problem…

thanks

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [June 6, 2007, 2:10pm UTC](https://forum.juce.com/t/multichannel-problems/1728/20 "2007-06-06T14:10:25Z")

</div>

Sorry, I still don’t understand - exactly which class are you saying is not working, and in what way is it failing?

[Next page](https://forum.juce.com/t/multichannel-problems/1728.md?page=2)
