grame-cncm / faust

Functional programming language for signal processing and sound synthesis
http://faust.grame.fr
Other
2.57k stars 322 forks source link

faust2juce ignores channel configurations #630

Open madskjeldgaard opened 3 years ago

madskjeldgaard commented 3 years ago

When using faust2juce to convert faust code to Juce projects, the .jucer file does not contain information about the numbers of channels going in/out of the faust dsp. Would be really cool to see that happen automatically. Seems like it is this line: https://github.com/grame-cncm/faust/blob/449bda497b8a0c501961cd439d5211622b0bc42c/architecture/juce/plugin/plugin.jucer#L8

Where pluginChannelConfigs="" needs to be set to something, eg. for a 1 input and 8 output plugin: pluginChannelConfigs="1,8" - I think.

sletz commented 3 years ago

What it this pluginChannelConfigs variable used for later on ?

sletz commented 3 years ago

Channel layer management is done dynamically in then C++ see https://github.com/grame-cncm/faust/blob/master-dev/architecture/juce/juce-plugin.cpp#L672. What would pluginChannelConfigs give more?

madskjeldgaard commented 3 years ago

Channel layer management is done dynamically in then C++ see https://github.com/grame-cncm/faust/blob/master-dev/architecture/juce/juce-plugin.cpp#L672. What would pluginChannelConfigs give more?

Ah you might be right in assuming that it doesn't do more than that ? I'm not so experienced with JUCE to be honest, sorry

sletz commented 3 years ago

Can you try (editing the JUCER file manually) and report?

madskjeldgaard commented 3 years ago

If I just convert my multi channel project (1 input + 36 outputs) to juce and don't touch the .jucer file it results in a standalone that has 2 inputs and 2 outputs and the vst3 version seg faults on open.

If I manually edit the .jucer file with the correct input/outputs nothing happens, except if I open it up in Projucer and edit "plugin channel configurations" and change it to "1,36", save the project to update the make files. After compilation, this allows the vst3 version to open up in Reaper with 1 input and 36 outputs correctly but with an assertion fail (but the standalone still seems to have 2 in + 2 out? ):

JUCE Assertion failure in juce_VST3_Wrapper.cpp:1771

which in the file of the same name has a comment that says:

// VST-3 requires your default layout to be non-discrete!
// For example, your default layout must be mono, stereo, quadrophonic
// and not AudioChannelSet::discreteChannels (2) etc.

and I think this is related to

https://github.com/grame-cncm/faust/blob/76ab7cbc48f9f20249ce19891ac8eab0cd5ec8cb/architecture/juce/juce-plugin.cpp#L551-L570

in the faust project. But I may be wrong!

madskjeldgaard commented 3 years ago

I think this is the relevant documentation for the above multi channel problem with Juce (but I'm not sure because I haven't use Juce all that much as mentioned :) ) https://docs.juce.com/master/classAudioChannelSet.html#ab917e490df2e0edfb1087e4c4f8d652e

madskjeldgaard commented 3 years ago

and oh, by the way I tested with Juce 6.0.7

sletz commented 3 years ago

Thejuce::AudioProcessor::BusesPropertiescode uses FAUST_INPUTS and FAUST_OUTPUTS Faust compiler generated values. This code may still be incorrect. Feel free to fix it and prepare a PR.

madskjeldgaard commented 3 years ago

Thejuce::AudioProcessor::BusesPropertiescode uses FAUST_INPUTS and FAUST_OUTPUTS Faust compiler generated values. This code may still be incorrect. Feel free to fix it and prepare a PR.

The strange thing is that it actually works and I'm not sure what the alternative is to the way Faust does this right now but I can try and see if I can figure it out.

sletz commented 3 years ago

We can also discuss that on Faust Slack channel here: https://join.slack.com/t/faustaudio/shared_invite/zt-a624szlz-fL4v2DTR~ZGlI7wARryT7g