I’m having a go at writing a Rack plugin. I successfully generated my .cpp template, and am now trying to compile it — however, I am getting two blocking errors:
Output from `RACK_DIR=../Rack-SDK make install`
g++ -std=c++11 -Wsuggest-override -fPIC -I../Rack-SDK/include -I../Rack-SDK/dep/include -MMD -MP -g -O3 -march=nocona -funsafe-math-optimizations -Wall -Wextra -Wno-unused-parameter -DARCH_LIN -c -o build/src/trigsplit.cpp.o src/trigsplit.cpp
src/trigsplit.cpp:44:27: error: expected ‘)’ before ‘*’ token
TrigsplitWidget(Trigsplit* module) {
^
src/trigsplit.cpp:74:76: error: no matching function for call to ‘createModel<Trigsplit, TrigsplitWidget>(const char [10])’
Model* modelTrigsplit = createModel<Trigsplit, TrigsplitWidget>("Trigsplit");
^
In file included from ../Rack-SDK/include/rack.hpp:16:0,
from src/plugin.hpp:2,
from src/trigsplit.cpp:1:
../Rack-SDK/include/helpers.hpp:20:16: note: candidate: template<class TModule, class TModuleWidget> rack::plugin::Model* rack::createModel(const string&)
plugin::Model* createModel(const std::string& slug) {
^~~~~~~~~~~
../Rack-SDK/include/helpers.hpp:20:16: note: template argument deduction/substitution failed:
../Rack-SDK/compile.mk:68: recipe for target 'build/src/trigsplit.cpp.o' failed
make: *** [build/src/trigsplit.cpp.o] Error 1
My code
#include "plugin.hpp"
struct Trigsplit : Module {
enum ParamIds {
NUM_PARAMS
};
enum InputIds {
V_OCT_INPUT,
TRIG_INPUT,
NUM_INPUTS
};
enum OutputIds {
TRIG_OUTPUT,
NUM_OUTPUTS
};
enum LightIds {
NOTE_C_LIGHT,
NOTE_CSHARP_LIGHT,
NOTE_D_LIGHT,
NOTE_DSHARP_LIGHT,
NOTE_E_LIGHT,
NOTE_F_LIGHT,
NOTE_FSHARP_LIGHT,
NOTE_G_LIGHT,
NOTE_GSHARP_LIGHT,
NOTE_A_LIGHT,
NOTE_ASHARP_LIGHT,
NOTE_B_LIGHT,
NUM_LIGHTS
};
Trigsplit() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
}
void process(const ProcessArgs& args) override {
//nothing here yet — even with something simple here, the plugin can't compile
}
};
struct TrigsplitWidget : ModuleWidget {
TrigsplitWidget(Trigsplit* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/trigsplit.svg")));
addChild(createWidget<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0)));
//addChild(createWidget<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0)));
addChild(createWidget<ScrewSilver>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
//addChild(createWidget<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(10.16, 20.681)), module, Trigsplit::V_OCT_INPUT));
addInput(createInputCentered<PJ301MPort>(mm2px(Vec(10.16, 45.096)), module, Trigsplit::TRIG_INPUT));
addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(10.16, 117.056)), module, Trigsplit::TRIG_OUTPUT));
addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 56.621)), module, Trigsplit::NOTE_C_LIGHT));
addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 60.636)), module, Trigsplit::NOTE_CSHARP_LIGHT));
addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 64.652)), module, Trigsplit::NOTE_D_LIGHT));
addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 68.668)), module, Trigsplit::NOTE_DSHARP_LIGHT));
addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 72.683)), module, Trigsplit::NOTE_E_LIGHT));
addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 76.699)), module, Trigsplit::NOTE_F_LIGHT));
addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 80.714)), module, Trigsplit::NOTE_FSHARP_LIGHT));
addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 84.73)), module, Trigsplit::NOTE_G_LIGHT));
addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 88.745)), module, Trigsplit::NOTE_GSHARP_LIGHT));
addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 92.761)), module, Trigsplit::NOTE_A_LIGHT));
addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 96.777)), module, Trigsplit::NOTE_ASHARP_LIGHT));
addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 100.792)), module, Trigsplit::NOTE_B_LIGHT));
}
};
Model* modelTrigsplit = createModel<Trigsplit, TrigsplitWidget>("Trigsplit");
Folder structure
Code /
/ Rack-SDK
/ modulaer
/ src
/ plugin.cpp, plugin.hpp, etc.
/ res/, Makefile, etc.
I can also provide plugin.json/plugin.cpp/plugin.hpp
, but I don’t think that’s where my error is coming from.