The sources you can organize as you wish. Convention is for all source to be in src
.
Rack itself has a separate include
at the same level as src
, with any organizing folder structure under src
mirrored under include
. This makes sense for something that is consumed by others as an SDK, but it’s not necessary for plugins. I use a different structure.
If you get into making more complex modules, or want to understand more how Rack works, and how it’s widgets work, I find it’s very useful to build Rack from source (with necessary modifications to build it with optimizations off for easier debugging). Building and running your plugin within full Rack source can be faster to iterate because you don’t have to build and install the deployment package (.vcvplugin
). Of course, this also makes Rack source local and easy to search, navigate, and step through under a debugger.
The standard makefile expects all resources that will be installed to be in res
. This is the DISTRIBUTABLES += res
line in the makefile. You will always need resources if you’re using SVGs for panels. If you have “factory” presets and selections, you can see the parallel conventions for these types of content that can be installed with your plugin. This is where Rack infrastructure expects them to be, so you must follow the convention.
I like to keep documentation in the same repo with the source. I don’t publish to a site, but it’s not the worst thing to browse the markdown docs right in the repo on github. Some keep the doc source elsewhere, and publish to a site. Others don’t bother creating any docs at all.
I keep working stuff separated from installed stuff, so I have folders for this.
My current plugin is quite complex, with extensive custom UI widgets, and modules that communicate among each other, so the structure is correspondingly more complex than a simpler plugin. My other projects have been much flatter.
Some stuff is here that I wouldn’t normally keep in source control, but since I’m now switching between Windows, Mac, and Linux, and sometimes need to work away from home, more goes in there so that it’s easier to switch which machine I’m working from.
My elaborate folder structure is like this (no include
folder in sight :-):
.github/workflows // github actions for building releases
.vscode // local vscode configuration (not checked in)
boneyard // stuff I'm not currently using but might want later
design // svg master files, sketches, notes
dev // (not checked into source control) scratch files
doc // documentation source, starting with index.md
doc/image // all graphics files for the docs (svgs, screen shots)
res/fonts
res/logo
res/panels // all the module panels
res/symbols // specialized svg graphics
res/themes // (I have a fancy themeing system)
res/widgets // ui widget svgs
src
src/em // a major subsystem for the plugin used by many modules
src/modules/<module> // Folder for each module (14 modules)
src/services // common services used across the plugin (mostly header-only) (33 files)
src/widgets // ui widgets (48 files)
Each module is usually composed of a module.hpp, module.cpp, and module-ui.cpp. If a if a source file is getting too big (around the 1000-line mark), I break it down further. So, in a few modules you can find module-ui-create.cpp (ui creation separate from other ui logic), module-file.cpp (file i/o) module-ui-events.cpp (when I need a lot of ui event overrides).
Some of the modules have widgets unique to that module, so I sometimes have a widgets
folder under the module.