[Resolved] Issue for more than 8 channels


#1

Hi, I’m sorry to bug you with this issue (originating from Multibus API ), but I can’t achieve more than 8 channels output without the following patch, can you please have a look at it?

diff --git a/modules/juce_audio_basics/buffers/juce_AudioChannelSet.h b/modules/juce_audio_basics/buffers/juce_AudioChannelSet.h
index c4c9274..7eb56a7 100644
--- a/modules/juce_audio_basics/buffers/juce_AudioChannelSet.h
+++ b/modules/juce_audio_basics/buffers/juce_AudioChannelSet.h
@@ -305,7 +305,7 @@ public:
     //==============================================================================
     enum
     {
-        maxChannelsOfNamedLayout = 8
+        maxChannelsOfNamedLayout = 16
     };
 
     /** Adds a channel to the set. */
diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
index 37f4f3f..4cf0f73 100644
--- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
+++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
@@ -1943,7 +1943,7 @@ private:
         AudioChannelSet inputLayout  = filter->getChannelLayoutOfBus (true,  0);
         AudioChannelSet outputLayout = filter->getChannelLayoutOfBus (false,  0);
 
-        const std::size_t speakerBaseSize = sizeof (VstSpeakerConfiguration) - (sizeof (VstIndividualSpeakerInfo) * 8);
+        const std::size_t speakerBaseSize = sizeof (VstSpeakerConfiguration) - (sizeof (VstIndividualSpeakerInfo) * 16);
 
         cachedInArrangement .malloc (speakerBaseSize + (static_cast<std::size_t> (inputLayout. size()) * sizeof (VstSpeakerConfiguration)), 1);
         cachedOutArrangement.malloc (speakerBaseSize + (static_cast<std::size_t> (outputLayout.size()) * sizeof (VstSpeakerConfiguration)), 1);
diff --git a/modules/juce_audio_processors/format_types/juce_VSTInterface.h b/modules/juce_audio_processors/format_types/juce_VSTInterface.h
index 502f367..e077a48 100644
--- a/modules/juce_audio_processors/format_types/juce_VSTInterface.h
+++ b/modules/juce_audio_processors/format_types/juce_VSTInterface.h
@@ -409,7 +409,7 @@ struct VstSpeakerConfiguration
 {
     int32 type;
     int32 numberOfChannels;
-    VstIndividualSpeakerInfo speakers[8];
+    VstIndividualSpeakerInfo speakers[16];
 };
 
 enum VstSpeakerConfigurationType

thanks


#2

I think this is fixed on develop now.


#3

Unfortunately, Reaper now always shows 64in/64out instead of the proper channel count.


#4

Can you be more specific? Are you limiting the channels somehow (by overriding isBusesLayoutSupported or by using the Projucer’s channel configuration field)?


#6

Sorry, my fault. The isBusesLayoutSupported() function was not declared const override. Exactly duplicating the example code fixed this.

However, one problem remains in Nuendo 7. With the following configuration the outputs are not connected when I add the plugin to a 5.1 or 7.1, … bus.

MultiBusAudioProcessor::MultiBusAudioProcessor()
	: AudioProcessor(BusesProperties().withInput("Input", AudioChannelSet::stereo())
					  .withOutput("Output", AudioChannelSet::discreteChannels(6)))
{
}

bool MultiBusAudioProcessor::isBusesLayoutSupported(const BusesLayout& layouts) const
{
	return (layouts.getMainInputChannels() == 2 &&
		    layouts.getMainOutputChannels() == 6);
}

By replacing discreteChannels(6) with create5point1() it connects all 6 outputs correctly when I add the plugin to a multi-channel bus with 5.1 or 7.1 configuration.

Any ideas what may be wrong here? Do I have to check the AudioChannelSet in isBusesLayoutSupported()?


#7

Well it depends if you want to accept. If you only want to accept surround 5.1 then you need to do this:

MultiBusAudioProcessor::MultiBusAudioProcessor()
: AudioProcessor(BusesProperties().withInput("Input", AudioChannelSet::stereo())
                                  .withOutput("Output", AudioChannelSet::create5point1()))
{
}

 bool MultiBusAudioProcessor::isBusesLayoutSupported(const BusesLayout& layouts) const
 {
 	return (layouts.getMainInputChannelSet() == AudioChannelSet::stereo() &&
               layouts.getMainOutputChannelSet() == AudioChannelSet::create5point1());
}

If you want to only allow 6 discrete channels (yes discrete channels are their own layout which are distinct from 5.1 surround) then you can use the following:

MultiBusAudioProcessor::MultiBusAudioProcessor()
: AudioProcessor(BusesProperties().withInput("Input", AudioChannelSet::discreteChannels (2))
                                  .withOutput("Output", AudioChannelSet::discreteChannels (6)))
{
}

 bool MultiBusAudioProcessor::isBusesLayoutSupported(const BusesLayout& layouts) const
 {
 	return (layouts.getMainInputChannelSet() == AudioChannelSet::discreteChannels (2) &&
               layouts.getMainOutputChannelSet() == AudioChannelSet::discreteChannels (6));
}

If you really don’t care about the exact format on the output as long as it has 6 channels then you can use the following:

MultiBusAudioProcessor::MultiBusAudioProcessor()
: AudioProcessor(BusesProperties().withInput("Input", AudioChannelSet::stereo())
                                  .withOutput("Output", AudioChannelSet::create5point1()))
{
}

 bool MultiBusAudioProcessor::isBusesLayoutSupported(const BusesLayout& layouts) const
 {
 	return (layouts.getMainInputChannels() == 2 &&
               layouts.getMainOutputChannels() == 6);
}

#8

Thank you for this nice explanation. I was for example using discreteChannels(10) and tried to add this plugin to a Auro 9.1 Bus in Nuendo. Regarding your post it would require a create9point1() function to make this work.

Is there any reason why this is not available or could I simply add it by following the scheme of the other createXpointY() functions?


#9

We will be adding a bunch more of those createSurround functions soon. Just haven’t gotten round to adding and testing them.


#10

Hi!
I got similar problems with VST plugins having >8 channels and the JucePluginHost using the latest JUCE version from develop.

It seems when you set your plugin channel configuration to >8 channels and not providing the isBusesLayoutSupported method the Plugin Host crashes while loading the plugin.

You can easily test this by changing the plugin channel configuration to >8 from the JuceDemoPlugin and commenting the isBusesLayoutSupported method.

Further, if you implement isBusesLayoutSupported, is it even possible to load the plugin with eg. 32 channels in the JucePluginHost? I only see max 7.1 if I want to change the channel configuration.

Cheers,
Matthias


#11

Yes, currently the JucePluginHost will only support max 7.1. It will support more but only if the default layout of the plugin has >8 channels. We need to add some text field to the IO config dialog to be able to specify more channels.


#12

I have a similar issue. To investigate the problems I face with >8 channels, I attached a debug-session to a running host (in this case: Max/MSP). I use the constructor as follows:

DummyProcessor()
    : AudioProcessor (BusesProperties().withInput  ("Input",  AudioChannelSet::discreteChannels(64))
                                       .withOutput ("Output", AudioChannelSet::discreteChannels(64)))
{
    // ... addParameter (..), etc.
}

isBusesLayoutSupported looks like this:

bool isBusesLayoutSupported (const BusesLayout& layouts) const override
{
return (layouts.getMainInputChannels() == 64 &&
layouts.getMainOutputChannels() == 64);
}

The host then crashes in line 2006 (of the current JUCE repository on github) in juce_VST_Wrapper.cpp

And here’s why: In line 276, which reads
findMaxTotalChannels (maxNumInChannels, maxNumOutChannels);,

the values of maxNumInChannels and maxNumOutChannels each equal to -1.

Is this a bug? Shouldn’t these values be set (correctly) at this point of the instance creation? If not, could you please explain in more detail, how to get more than 8 channels configured, Fabian? Unfortunately I could not get there, utilizing your answers to previous posts by other users in this thread. Thanks in advance!

Best regards,
Christian

Edit:
Here’s some additional info I forgot…

  • For any other number of channels >8 the same happens
  • Using the channel config field in the Projucer with e.g. {64, 64} there was no crash and everything worked perfectly fine. In your ADC’16 talk on the multibus features you suggested to not use this anymore, so I don’t…

#13

Yes, that’s very strange. Seems like a bug but I can’t reproduce this. I’ve added your exact bit of code into the GainPlugin example here and it seems to work fine:

Yes exactly! Make sure to not use that field. Also please check that you are on the latest develop branch. We’ve just fixed a few bugs in there recently (for example yesterday).


#14

Thank you, now it works! I had mistakenly been using an older JUCE version, thinking I was on the up-to-date dev branch. Classic…