Skip to content

Commit

Permalink
Upgrade to use rack-helpers. Mono case fixes in place
Browse files Browse the repository at this point in the history
  • Loading branch information
baconpaul committed Nov 30, 2023
1 parent 985471f commit 6330582
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "libs/sst/sst-basic-blocks"]
path = libs/sst/sst-basic-blocks
url = https://github.com/surge-synthesizer/sst-basic-blocks
[submodule "libs/sst/sst-rackhelpers"]
path = libs/sst/sst-rackhelpers
url = https://github.com/surge-synthesizer/sst-rackhelpers
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ message(STATUS "BaconMusic for Rack Build Process" )
message(STATUS "Installing into '${CMAKE_INSTALL_PREFIX}'")

add_subdirectory(libs/sst/sst-basic-blocks)
add_subdirectory(libs/sst/sst-rackhelpers)

file(GLOB SOURCES src/*.cpp libs/midifile/src/*.cpp libs/open303-code/Source/DSPCode/*.cpp)
add_compile_options(-fvisibility=hidden -fvisibility-inlines-hidden)

target_include_directories(${RACK_PLUGIN_LIB} PRIVATE src libs/midifile/include libs/open303-code/Source/DSPCode)
target_sources(${RACK_PLUGIN_LIB} PRIVATE
${SOURCES})
target_link_libraries(${RACK_PLUGIN_LIB} PRIVATE sst-basic-blocks)
target_link_libraries(${RACK_PLUGIN_LIB}
PRIVATE
sst-basic-blocks
sst-rackhelpers)

1 change: 1 addition & 0 deletions libs/sst/sst-rackhelpers
Submodule sst-rackhelpers added at e6fc2c
30 changes: 24 additions & 6 deletions src/Bitulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
#include "BaconModule.hpp"
#include "BaconModuleWidget.h"

#include "sst/rackhelpers/module_connector.h"
#include "sst/rackhelpers/neighbor_connectable.h"

namespace bp = baconpaul::rackplugs;
/*
** ToDo:
** Add lights for on/off
** Add a 7 segment display for step count
*/

struct Bitulator : bp::BaconModule
struct Bitulator : bp::BaconModule, sst::rackhelpers::module_connector::NeighborConnectable_V1
{
enum ParamIds
{
Expand Down Expand Up @@ -105,6 +108,15 @@ struct Bitulator : bp::BaconModule
outputs[CRUNCHED_OUTPUT].setVoltage(wd * res + (1.0 - wd) * vin, i);
}
}

std::optional<std::vector<labeledStereoPort_t>> getPrimaryInputs() override
{
return {{std::make_pair("Input", std::make_pair(SIGNAL_INPUT, -1))}};
}
virtual std::optional<std::vector<labeledStereoPort_t>> getPrimaryOutputs()
{
return {{std::make_pair("Outputs", std::make_pair(CRUNCHED_OUTPUT, -1))}};
}
};

struct BitulatorWidget : bp::BaconModuleWidget
Expand Down Expand Up @@ -143,7 +155,7 @@ BitulatorWidget::BitulatorWidget(Bitulator *model)
bg->addLabel(knobCtr.plus(Vec(8, 21)), "dist", 10, NVG_ALIGN_LEFT | NVG_ALIGN_TOP);
bg->addLabel(knobCtr.plus(Vec(-8, 21)), "clean", 10, NVG_ALIGN_RIGHT | NVG_ALIGN_TOP);
knobPos.x = cr.x + rs.x - 3 - 24;
;

knobPos.y += diffY2c<RoundLargeBlackKnob, PJ301MPort>();
addInput(createInput<PJ301MPort>(knobPos, module, Bitulator::MIX_CV));

Expand All @@ -161,7 +173,7 @@ BitulatorWidget::BitulatorWidget(Bitulator *model)
bg->addLabel(knobCtr.plus(Vec(8, 21)), "smth", 10, NVG_ALIGN_LEFT | NVG_ALIGN_TOP);
bg->addLabel(knobCtr.plus(Vec(-8, 21)), "crnch", 10, NVG_ALIGN_RIGHT | NVG_ALIGN_TOP);
knobPos.x = cr.x + rs.x - 3 - 24;
;

knobPos.y += diffY2c<RoundLargeBlackKnob, PJ301MPort>();
addInput(createInput<PJ301MPort>(knobPos, module, Bitulator::BIT_CV));

Expand All @@ -179,18 +191,24 @@ BitulatorWidget::BitulatorWidget(Bitulator *model)
bg->addLabel(knobCtr.plus(Vec(8, 21)), "11", 10, NVG_ALIGN_LEFT | NVG_ALIGN_TOP);
bg->addLabel(knobCtr.plus(Vec(-8, 21)), "one", 10, NVG_ALIGN_RIGHT | NVG_ALIGN_TOP);
knobPos.x = cr.x + rs.x - 3 - 24;
;

knobPos.y += diffY2c<RoundLargeBlackKnob, PJ301MPort>();
addInput(createInput<PJ301MPort>(knobPos, module, Bitulator::AMP_CV));

Vec inP = Vec(10, RACK_HEIGHT - 15 - 43);
Vec outP = Vec(box.size.x - 24 - 10, RACK_HEIGHT - 15 - 43);

bg->addPlugLabel(inP, BaconBackground::SIG_IN, "in");
addInput(createInput<PJ301MPort>(inP, module, Bitulator::SIGNAL_INPUT));
using mcPt = sst::rackhelpers::module_connector::PortConnectionMixin<PJ301MPort>;
auto inp = createInput<mcPt>(inP, module, Bitulator::SIGNAL_INPUT);
inp->connectAsInputFromMixmaster = true;
addInput(inp);

bg->addPlugLabel(outP, BaconBackground::SIG_OUT, "out");
addOutput(createOutput<PJ301MPort>(outP, module, Bitulator::CRUNCHED_OUTPUT));
auto out = createOutput<mcPt>(outP, module, Bitulator::CRUNCHED_OUTPUT);
out->connectAsOutputToMixmaster = true;
out->connectOutputToNeighbor = true;
addOutput(out);
}

Model *modelBitulator = createModel<Bitulator, BitulatorWidget>("Bitulator");

0 comments on commit 6330582

Please sign in to comment.