BogaudioModules

BogaudioModules for VCV Rack
Log | Files | Refs | README | LICENSE

commit 82c9fb2e7f5747011dcbdf92a16855c8c490d728
parent d05de2804f4a9f3f05e7a5834895defc1ad2d7ea
Author: Matt Demanett <matt@demanett.net>
Date:   Sun, 19 Nov 2017 00:18:12 -0500

Added "Manual" gate/trig utility module.

Diffstat:
MREADME.md | 4++++
Ares/Manual-src.svg | 0
Ares/Manual.svg | 0
Mres/www/modules.png | 0
Msrc/BogaudioModules.cpp | 1+
Msrc/BogaudioModules.hpp | 4++--
Asrc/Manual.cpp | 97+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 104 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md @@ -64,6 +64,10 @@ A 3-HP CV offset and scaler. The OFFSET and SCALE knobs have CV inputs. With a A 3-HP, dual sample-and-hold. Sampling may be triggered by CV or button press. If nothing is connected to an IN port, sampling for that channel is from an internal white noise source (range 0-10). +#### Manual + +A 3-HP, manual trigger/gate with 8 outputs. A constant high value is sent from each output for as long as the TRIG button is held. + ## Issues and Feedback Bug reports and feedback are welcome: please use the [issue tracker](https://github.com/bogaudio/BogaudioModules/issues). diff --git a/res/Manual-src.svg b/res/Manual-src.svg Binary files differ. diff --git a/res/Manual.svg b/res/Manual.svg Binary files differ. diff --git a/res/www/modules.png b/res/www/modules.png Binary files differ. diff --git a/src/BogaudioModules.cpp b/src/BogaudioModules.cpp @@ -14,4 +14,5 @@ void init(rack::Plugin *p) { p->addModel(createModel<DADSRHPlusWidget>("Bogaudio", "Bogaudio-DADSRHPlus", "DADSR(H)+", ENVELOPE_GENERATOR_TAG)); p->addModel(createModel<OffsetWidget>("Bogaudio", "Bogaudio-Offset", "Offset", ATTENUATOR_TAG)); p->addModel(createModel<SampleHoldWidget>("Bogaudio", "Bogaudio-SampleHold", "S&H", SAMPLE_AND_HOLD_TAG, DUAL_TAG)); + p->addModel(createModel<ManualWidget>("Bogaudio", "Bogaudio-Manual", "Manual")); } diff --git a/src/BogaudioModules.hpp b/src/BogaudioModules.hpp @@ -28,8 +28,8 @@ struct SampleHoldWidget : ModuleWidget { SampleHoldWidget(); }; -struct GaussWidget : ModuleWidget { - GaussWidget(); +struct ManualWidget : ModuleWidget { + ManualWidget(); }; diff --git a/src/Manual.cpp b/src/Manual.cpp @@ -0,0 +1,97 @@ + +#include "dsp/digital.hpp" +#include "BogaudioModules.hpp" + +struct Manual : Module { + enum ParamsIds { + TRIGGER_PARAM, + NUM_PARAMS + }; + + enum InputsIds { + NUM_INPUTS + }; + + enum OutputsIds { + OUT1_OUTPUT, + OUT2_OUTPUT, + OUT3_OUTPUT, + OUT4_OUTPUT, + OUT5_OUTPUT, + OUT6_OUTPUT, + OUT7_OUTPUT, + OUT8_OUTPUT, + NUM_OUTPUTS + }; + + enum LightsIds { + NUM_LIGHTS + }; + + SchmittTrigger _trigger; + + Manual() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) { + reset(); + } + + virtual void reset() override; + virtual void step() override; +}; + +void Manual::reset() { + _trigger.reset(); +} + +void Manual::step() { + bool high = _trigger.process(params[TRIGGER_PARAM].value) || _trigger.isHigh(); + float out = high ? 5.0 : 0.0; + outputs[OUT1_OUTPUT].value = out; + outputs[OUT2_OUTPUT].value = out; + outputs[OUT3_OUTPUT].value = out; + outputs[OUT4_OUTPUT].value = out; + outputs[OUT5_OUTPUT].value = out; + outputs[OUT6_OUTPUT].value = out; + outputs[OUT7_OUTPUT].value = out; + outputs[OUT8_OUTPUT].value = out; +} + + +ManualWidget::ManualWidget() { + Manual *module = new Manual(); + setModule(module); + box.size = Vec(RACK_GRID_WIDTH * 3, RACK_GRID_HEIGHT); + + { + SVGPanel *panel = new SVGPanel(); + panel->box.size = box.size; + panel->setBackground(SVG::load(assetPlugin(plugin, "res/Manual.svg"))); + addChild(panel); + } + + addChild(createScrew<ScrewSilver>(Vec(0, 0))); + addChild(createScrew<ScrewSilver>(Vec(box.size.x - 15, 365))); + + // generated by svg_widgets.rb + auto triggerParamPosition = Vec(13.5, 28.0); + + auto out1OutputPosition = Vec(10.5, 64.0); + auto out2OutputPosition = Vec(10.5, 94.0); + auto out3OutputPosition = Vec(10.5, 124.0); + auto out4OutputPosition = Vec(10.5, 154.0); + auto out5OutputPosition = Vec(10.5, 184.0); + auto out6OutputPosition = Vec(10.5, 214.0); + auto out7OutputPosition = Vec(10.5, 244.0); + auto out8OutputPosition = Vec(10.5, 274.0); + // end generated by svg_widgets.rb + + addParam(createParam<Button18>(triggerParamPosition, module, Manual::TRIGGER_PARAM, 0.0, 1.0, 0.0)); + + addOutput(createOutput<PJ301MPort>(out1OutputPosition, module, Manual::OUT1_OUTPUT)); + addOutput(createOutput<PJ301MPort>(out2OutputPosition, module, Manual::OUT2_OUTPUT)); + addOutput(createOutput<PJ301MPort>(out3OutputPosition, module, Manual::OUT3_OUTPUT)); + addOutput(createOutput<PJ301MPort>(out4OutputPosition, module, Manual::OUT4_OUTPUT)); + addOutput(createOutput<PJ301MPort>(out5OutputPosition, module, Manual::OUT5_OUTPUT)); + addOutput(createOutput<PJ301MPort>(out6OutputPosition, module, Manual::OUT6_OUTPUT)); + addOutput(createOutput<PJ301MPort>(out7OutputPosition, module, Manual::OUT7_OUTPUT)); + addOutput(createOutput<PJ301MPort>(out8OutputPosition, module, Manual::OUT8_OUTPUT)); +}