Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
cfoulc authored Sep 30, 2018
1 parent be424ee commit cd18da4
Show file tree
Hide file tree
Showing 9 changed files with 479 additions and 51 deletions.
97 changes: 97 additions & 0 deletions src/CHOKE.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#include "cf.hpp"
#include "dsp/digital.hpp"


using namespace std;


struct CHOKE : Module {
enum ParamIds {
TR1_PARAM,
TR2_PARAM,
PAN_PARAM,
NUM_PARAMS
};
enum InputIds {
TRIG1_INPUT,
TRIG2_INPUT,
IN1_INPUT,
IN2_INPUT,
NUM_INPUTS
};
enum OutputIds {
OUT_OUTPUT,
NUM_OUTPUTS
};
enum LightIds {
L2_LIGHT,
NUM_LIGHTS
};

bool play = false;
SchmittTrigger tr1Trigger;
SchmittTrigger tr2Trigger;

CHOKE() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) { }

void step() override;


};




void CHOKE::step() {

if (tr1Trigger.process(inputs[TRIG1_INPUT].value))
{
play = false ;

};
if (tr2Trigger.process(inputs[TRIG2_INPUT].value))
{
play = true ;

};
if (play)
outputs[OUT_OUTPUT].value = inputs[IN2_INPUT].value*(1-clamp(-params[PAN_PARAM].value,0.0f,1.0f));
else outputs[OUT_OUTPUT].value = inputs[IN1_INPUT].value*(1-clamp(params[PAN_PARAM].value,0.0f,1.0f));


lights[L2_LIGHT].value=play;
}




struct CHOKEWidget : ModuleWidget {
CHOKEWidget(CHOKE *module);
//void step() override;

};

CHOKEWidget::CHOKEWidget(CHOKE *module) : ModuleWidget(module) {
setPanel(SVG::load(assetPlugin(plugin, "res/CHOKE.svg")));


addChild(Widget::create<ScrewSilver>(Vec(15, 0)));
addChild(Widget::create<ScrewSilver>(Vec(box.size.x-30, 365)));

addParam(ParamWidget::create<Trimpot>(Vec(6, 298), module, CHOKE::PAN_PARAM, -1.0f, 1.0f, 0.0f));

addInput(Port::create<PJ301MPort>(Vec(3, 61), Port::INPUT, module, CHOKE::IN1_INPUT));
addInput(Port::create<PJ301MPort>(Vec(3, 91), Port::INPUT, module, CHOKE::TRIG1_INPUT));

addInput(Port::create<PJ301MPort>(Vec(3, 181), Port::INPUT, module, CHOKE::IN2_INPUT));
addInput(Port::create<PJ301MPort>(Vec(3, 211), Port::INPUT, module, CHOKE::TRIG2_INPUT));

addChild(ModuleLightWidget::create<LargeLight<BlueLight>>(Vec(8, 276), module, CHOKE::L2_LIGHT));

addOutput(Port::create<PJ301MPort>(Vec(3, 321), Port::OUTPUT, module, CHOKE::OUT_OUTPUT));

}



Model *modelCHOKE = Model::create<CHOKE, CHOKEWidget>("cf", "CHOKE", "Choke", UTILITY_TAG);
23 changes: 7 additions & 16 deletions src/L3DS3Q.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@ struct L3DS3Q : Module {
};


int wait = 0;
int pas = 0;
bool ledState[80] = {};
int tempState[5] = {};
bool editState = false ;
SchmittTrigger rstTrigger;
SchmittTrigger upTrigger;
SchmittTrigger editTrigger;

SchmittTrigger ledTrigger[80] ={};

L3DS3Q() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {}
void step() override;
Expand Down Expand Up @@ -90,7 +89,7 @@ void L3DS3Q::step() {
if (upTrigger.process(inputs[UP_INPUT].value))
{
for (int i = 0; i < 5; i++) {
if (ledState[(i+pas*5)%80]) tempState [i] = 20;
if (ledState[(i+pas*5)%80]) tempState [i] = 50;
}
if (pas <15) pas = pas+1; else pas =0;
}
Expand All @@ -104,30 +103,22 @@ void L3DS3Q::step() {
{
for (int i = 0; i < 80; i++) {lights[LED_LIGHT +i].value=ledState[(i+pas*5)%80];}

if (wait == 0) {
for (int i = 0; i < 80; i++) {
if (params[ON_PARAM +i].value) {ledState[(i+pas*5)%80]=!ledState[(i+pas*5)%80]; wait = 20000;}
}} else wait = wait-1;
if (ledTrigger[i].process(params[ON_PARAM +i].value)) {ledState[(i+pas*5)%80]=!ledState[(i+pas*5)%80];}
};

} else {
for (int i = 0; i < 80; i++) {lights[LED_LIGHT +i].value=ledState[i];}
if (wait == 0) {

for (int i = 0; i < 80; i++) {
if (params[ON_PARAM +i].value) {ledState[i]=!ledState[i]; wait = 20000;}
}} else wait = wait-1;
if (ledTrigger[i].process(params[ON_PARAM +i].value)) {ledState[i]=!ledState[i];}
};
}

for (int i = 0; i < 5; i++) {
if (tempState [i]>0) {tempState [i] = tempState [i]-1;outputs[TR_OUTPUT+i].value=10.0f;} else outputs[TR_OUTPUT+i].value=0.0f;
}

//if (wait == 0) {
// for (int i = 0; i < 80; i++) {

// if (params[ON_PARAM +i].value) {ledState[i]=!ledState[i]; wait = 20000;}
// lights[LED_LIGHT +i].value=ledState[i];
//}} else wait = wait-1;


}

Expand Down
7 changes: 4 additions & 3 deletions src/LEDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ bool ledState[100] = {};
bool tempState[5] = {};
SchmittTrigger rndTrigger;
SchmittTrigger upTrigger;
SchmittTrigger ledTrigger[100];


LEDS() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {}
Expand Down Expand Up @@ -93,12 +94,12 @@ void LEDS::step() {
{ledState[i+95] = tempState[i];}
}

if (wait == 0) {

for (int i = 0; i < 100; i++) {

if (params[ON_PARAM +i].value) {ledState[i]=!ledState[i]; wait = 20000;}
if (ledTrigger[i].process(params[ON_PARAM +i].value)) {ledState[i]=!ledState[i];}
lights[LED_LIGHT +i].value=ledState[i];
}} else wait = wait-1;
}


}
Expand Down
17 changes: 9 additions & 8 deletions src/LEDSEQ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ struct LEDSEQ : Module {
};


int wait = 0;

int pas = 0;
bool ledState[80] = {};
int tempState[5] = {};
bool editState = false ;
SchmittTrigger rstTrigger;
SchmittTrigger upTrigger;
SchmittTrigger editTrigger;
SchmittTrigger ledTrigger[80] ={};


LEDSEQ() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {}
Expand Down Expand Up @@ -90,7 +91,7 @@ void LEDSEQ::step() {
if (upTrigger.process(inputs[UP_INPUT].value))
{
for (int i = 0; i < 5; i++) {
if (ledState[(i+pas*5)%80]) tempState [i] = 20;
if (ledState[(i+pas*5)%80]) tempState [i] = 50;
}
if (pas <15) pas = pas+1; else pas =0;
}
Expand All @@ -104,17 +105,17 @@ void LEDSEQ::step() {
{
for (int i = 0; i < 80; i++) {lights[LED_LIGHT +i].value=ledState[(i+pas*5)%80];}

if (wait == 0) {

for (int i = 0; i < 80; i++) {
if (params[ON_PARAM +i].value) {ledState[(i+pas*5)%80]=!ledState[(i+pas*5)%80]; wait = 20000;}
}} else wait = wait-1;
if (ledTrigger[i].process(params[ON_PARAM +i].value)) {ledState[(i+pas*5)%80]=!ledState[(i+pas*5)%80];}
};

} else {
for (int i = 0; i < 80; i++) {lights[LED_LIGHT +i].value=ledState[i];}
if (wait == 0) {

for (int i = 0; i < 80; i++) {
if (params[ON_PARAM +i].value) {ledState[i]=!ledState[i]; wait = 20000;}
}} else wait = wait-1;
if (ledTrigger[i].process(params[ON_PARAM +i].value)) {ledState[i]=!ledState[i];}
};
}

for (int i = 0; i < 5; i++) {
Expand Down
1 change: 1 addition & 0 deletions src/MONO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ struct MOTORPOTDisplay : TransparentWidget {
}
};


struct MONOWidget : ModuleWidget {
MONOWidget(MONO *module);
};
Expand Down
Loading

0 comments on commit cd18da4

Please sign in to comment.