Cycling74 / rnbo.example.vcvrack

An example of using RNBO exports in VCV Rack plugins
GNU General Public License v3.0
27 stars 1 forks source link

Building a single plugin from multiple rnbo_source #6

Closed michelezaccagnini closed 1 year ago

michelezaccagnini commented 1 year ago

Hello, Is there a way to build a single plugin with multiple modules using multiple rnbo_source? I have three plugins at the moment and I would like to create a single plugin containing 3 modules instead, as in the Rack Fundamentals for instance. Problem is that each one of the plugins I want to consolidate has a same-named rnbo_source folder. If I can just manually change the names of rnbo_source in a few spots to make them unique-named that would fantastic (I am just not sure where?)

cccstbccc commented 1 year ago

Hallo, did you have a look at: https://rnbo.cycling74.com/learn/multiple-rnbo-devices-in-one-c-project ? maybe this can get you un-stuck.

michelezaccagnini commented 1 year ago

Hallo, did you have a look at: https://rnbo.cycling74.com/learn/multiple-rnbo-devices-in-one-c-project ? maybe this can get you un-stuck.

Unfortunately this does not help since the building of the plugin will not work changing the names of the sources. I am using this repo tool to compile the plugin and the naming of the rnbo generated code cannot be changed.

cccstbccc commented 1 year ago

maybe i do not fully understand your problem, when you do a C++ export you get a:

you can copy multiple exported RNBO sources (rnbo_source1.cpp, rnbo_source.2cpp) into one folder you only need one "rnbo" folder

you can include all exported classes via the HOWTO above

does this maybe help ?

michelezaccagnini commented 1 year ago

maybe i do not fully understand your problem, when you do a C++ export you get a:

  • rnbo_source.cpp (this name you can change)

This is from the README: "Export your RNBO patch to the rnbo-export directory. Currently, the exported code must be named rnbo_source.cpp, so make sure that in the RNBO export sidebar, the Export Name field is set correctly." (https://github.com/Cycling74/rnbo.example.vcvrack/issues/4)

I use this tool to compile the VCV plugin but only onernbo_source.cpp can be compiled at each time

cccstbccc commented 1 year ago

this is very true for a single class and file, but for using multiple at once you need to adapt a few things (for example modify your CMakeLists.txt file), which is laid out in the above mentioned README:

https://rnbo.cycling74.com/learn/multiple-rnbo-devices-in-one-c-project

michelezaccagnini commented 1 year ago

When I export the different .cpp files I do not get the CMakeLists.txt. This is what I get image The dependencies.json and presets.json are unique to each effect but when I export a new rnbo_source they will be replaced by the latest, so I think that doesn't work.

If I compile each effect (I use MSYS), I do get a Makefile and I can modify it but I am not sure that is what is meant in the instructions you sent me: I believe I have to make these adjustments and then compile the whole plugin right?

I tried to work with the compiled plugins to then recompile them. If that is what I am supposed to do then these are my questions. I can modify the Makefile to include all of the different named .cpp files. But then, again, what do I do with the dependencies.json and presets.json files that are unique to each .cpp? Also in the src folder I have unique module.cpp, plugin.cpp and other files that are unique to each of the modules: how do I rename them? Here is what the src folder looks like image

This is my Makefile


# Exported code
FLAGS += -Irnbo-export/rnbo/code
FLAGS += -Irnbo-export/rnbo
FLAGS += -Irnbo-export/rnbo/adapters
FLAGS += -Irnbo-export/rnbo/common
FLAGS += -Irnbo-export/rnbo/src
SLUG = NLS
SOURCES += rnbo-export/Cross_seq2.cpp //three modules are included instead of the single rnbo_source
SOURCES += rnbo-export/Cross_seq3.cpp
SOURCES += rnbo-export/Trigger_logic.cpp
SOURCES += rnbo-export/rnbo/RNBO.cpp

# VCV module
FLAGS += -Isrc 
SOURCES += $(wildcard src/*.cpp)

# Include the license and module SVGs in the distribution
DISTRIBUTABLES += $(wildcard ../LICENSE*) res

include $(RACK_DIR)/plugin.mk

These are my plugins right now if you want to take a peek: https://github.com/michelezaccagnini/NonlinearSequencer_VCV They work fine, I would just like them to be included into one VCV plugin instead of separate ones. Thanks

cccstbccc commented 1 year ago

i am afraid there is no way of automatically combining multiple RNBO source files to one plugin, you will have to take the source code of your first plugin, and then incorporate the generated source files of the other plugins yourself (as displayed in the file main.cpp in the howto)

it might get tricky when you need to combine parameters of all three generated source files, you will have to do this by yourself and maybe use the sources of the Juce adapter of the first plugin as an example