Skip to content

Commit

Permalink
Update to V 0.6.9
Browse files Browse the repository at this point in the history
Switch added to Flow module
Signal Delay CV input fix(take proper values from BPM Calc module)
New module Triggers MKIII
New module ReScale
  • Loading branch information
AScustomWorks committed Aug 5, 2018
1 parent bf05ff6 commit 773cf3e
Show file tree
Hide file tree
Showing 12 changed files with 1,617 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
RACK_DIR ?= ../..
SLUG = AS
VERSION = 0.6.8
VERSION = 0.6.9

FLAGS +=
SOURCES += $(wildcard src/*.cpp freeverb/*.cpp)
Expand Down
49 changes: 42 additions & 7 deletions res/Flow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
805 changes: 805 additions & 0 deletions res/ReScale.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
368 changes: 368 additions & 0 deletions res/TriggersMKIII.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/AS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ void init(rack::Plugin *p) {
p->addModel(modelMerge2_5);
p->addModel(modelTriggersMKI);
p->addModel(modelTriggersMKII);
p->addModel(modelTriggersMKIII);
p->addModel(modelBPMCalc);
p->addModel(modelCv2T);

p->addModel(modelReScale);

//EFFECTS
p->addModel(modelDelayPlusFx);
Expand Down
20 changes: 20 additions & 0 deletions src/AS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ extern Model *modelMerge2_5;
extern Model *modelSteps;
extern Model *modelTriggersMKI;
extern Model *modelTriggersMKII;
extern Model *modelTriggersMKIII;
extern Model *modelLaunchGate;
extern Model *modelKillGate;
extern Model *modelFlow;
extern Model *modelSignalDelay;
extern Model *modelBPMCalc;
extern Model *modelCv2T;
extern Model *modelReScale;

extern Model *modelDelayPlusFx;
extern Model *modelDelayPlusStereoFx;
Expand Down Expand Up @@ -81,6 +83,24 @@ struct as_KnobBlack : SVGKnob {
}
};

struct as_KnobBlackSnap : as_KnobBlack {
as_KnobBlackSnap() {
snap = true;
}
};

struct as_KnobBlackSnap4 : as_KnobBlack {
as_KnobBlackSnap4() {
minAngle = -0.30 * M_PI;
maxAngle = 0.30 * M_PI;
snap = true;
}
};





struct as_FxKnobWhite : SVGKnob {
as_FxKnobWhite() {
minAngle = -0.83 * M_PI;
Expand Down
10 changes: 7 additions & 3 deletions src/BPMClock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ struct BPMClock : Module {

float tempo =120.0f;
int time_sig_top, time_sig_bottom = 0;
int time_sig_bottom_old = 0;
float frequency = 2.0f;
int quarters_count_limit = 4;
int eighths_count_limit = 2;
Expand Down Expand Up @@ -160,6 +161,7 @@ void BPMClock::step() {
time_sig_top = std::round(params[TIMESIGTOP_PARAM].value);
time_sig_bottom = std::round(params[TIMESIGBOTTOM_PARAM].value);
time_sig_bottom = std::pow(2,time_sig_bottom+1);


frequency = tempo/60.0f;

Expand Down Expand Up @@ -192,15 +194,17 @@ void BPMClock::step() {
}else{

if (time_sig_top == time_sig_bottom){
clock.setFreq(frequency*4);
quarters_count_limit = 4;
eighths_count_limit = 2;
bars_count_limit = 16;
bars_count_limit = 16;
clock.setFreq(frequency*4);
}else{
//clock divisions
if(time_sig_bottom == 4){
//debug("time sig bottom = %i", time_sig_bottom);
quarters_count_limit = 4;
eighths_count_limit = 2;
bars_count_limit = time_sig_top * 4;
bars_count_limit = time_sig_top * 4;
clock.setFreq(frequency*4);
}
if(time_sig_bottom == 8){
Expand Down
27 changes: 25 additions & 2 deletions src/Flow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct Flow: Module {
enum ParamIds {
SWITCH_1,
SWITCH_2,
MODE_PARAM,
NUM_PARAMS
};
enum InputIds {
Expand Down Expand Up @@ -40,6 +41,7 @@ struct Flow: Module {

bool on_1 = false;
bool on_2 = false;
bool light_inverted = false;

float mute_fade1 =0.0f;
float mute_fade2 =0.0f;
Expand Down Expand Up @@ -79,6 +81,14 @@ struct Flow: Module {

void Flow::step() {

if (params[MODE_PARAM].value){
//switch lights turn on when the switch is enabled
light_inverted = false;
}else{
//switch lights turn off when the switch is enabled
light_inverted = true;
}

//TRIGGER 1
if (btnTrigger1.process(params[SWITCH_1].value)||extTrigger1.process(inputs[CV_TRIG_INPUT_1].value)) {
on_1 = !on_1;
Expand All @@ -94,7 +104,12 @@ void Flow::step() {
mute_fade1 = 1.0f;
}
outputs[OUTPUT_1].value = inputs[INPUT_1].value * mute_fade1;
lights[TRIGGER_LED_1].value = on_1 ? 1.0f : 0.0f;
if(light_inverted){
lights[TRIGGER_LED_1].value = on_1 ? 0.0f : 1.0f;
}else{
lights[TRIGGER_LED_1].value = on_1 ? 1.0f : 0.0f;
}

//TRIGGER 2
if (btnTrigger2.process(params[SWITCH_2].value)||extTrigger2.process(inputs[CV_TRIG_INPUT_2].value)) {
on_2 = !on_2;
Expand All @@ -110,7 +125,12 @@ void Flow::step() {
mute_fade2 = 1.0f;
}
outputs[OUTPUT_2].value = inputs[INPUT_2].value * mute_fade2;
lights[TRIGGER_LED_2].value = on_2 ? 1.0f : 0.0f;
if(light_inverted){
lights[TRIGGER_LED_2].value = on_2 ? 0.0f : 1.0f;
}else{
lights[TRIGGER_LED_2].value = on_2 ? 1.0f : 0.0f;
}

}

////////////////////////////////////
Expand All @@ -129,6 +149,9 @@ FlowWidget::FlowWidget(Flow *module) : ModuleWidget(module) {
addChild(Widget::create<as_HexScrew>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
addChild(Widget::create<as_HexScrew>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));

//OLD/NEW SWITCH FROM 40-250 TO 30-300
addParam(ParamWidget::create<as_CKSS>(Vec(67, 23), module, Flow::MODE_PARAM, 0.0f, 1.0f, 1.0f));

static const float led_offset = 3.3;
static const float led_center = 15;
static const float y_offset = 150;
Expand Down
3 changes: 1 addition & 2 deletions src/Phaser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ class Phaser{

float Update( float inSamp ){
//calculate and update phaser sweep lfo...
float d = _dmin + (_dmax-_dmin) * ((sin( _lfoPhase ) +
1.f)/2.f);
float d = _dmin + (_dmax-_dmin) * ((sin( _lfoPhase ) + 1.f)/2.f);
_lfoPhase += _lfoInc;
if( _lfoPhase >= F_PI * 2.0f )
_lfoPhase -= F_PI * 2.0f;
Expand Down
134 changes: 134 additions & 0 deletions src/ReScale.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
//**************************************************************************************
//Volt rescale module module for VCV Rack by Alfredo Santamaria - AS - https://github.com/AScustomWorks/AS
//
//**************************************************************************************
#include "AS.hpp"

struct ReScale: Module {
enum ParamIds {
CONVERT_PARAM,
NUM_PARAMS
};
enum InputIds {
INPUT_0,
INPUT_1,
INPUT_2,
INPUT_3,
NUM_INPUTS
};
enum OutputIds {
OUTPUT,
NUM_OUTPUTS
};
enum LightIds {
NUM_LIGHTS
};

int selection = 0;
float rescaled_value = 0.0f;
float input_value = 0.0f;

float getNoteInVolts(float noteValue) {
int octaveInVolts = int(floorf(noteValue));
float voltMinusOct = noteValue - octaveInVolts;
return voltMinusOct;
}

ReScale() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {

}
void step() override;

};

void ReScale::step() {

selection = params[CONVERT_PARAM].value;

if(inputs[INPUT_0].active){

input_value = clamp(inputs[INPUT_0].value, -5.0f,5.0f);
if(selection==0){
rescaled_value = input_value;
}else if(selection==1){
rescaled_value = rescale(input_value, -5.0f, 5.0f, 0.0f, 5.0f);
}else if(selection==2){
rescaled_value = rescale(input_value, -5.0f, 5.0f, -10.0f, 10.0f);
}else if(selection==3){
rescaled_value = rescale(input_value, -5.0f, 5.0f, 0.0f, 10.0f);
}

}else if(inputs[INPUT_1].active){

input_value = clamp(inputs[INPUT_1].value, 0.0f, 5.0f);
if(selection==0){
rescaled_value = rescale(input_value, 0.0f, 5.0f, -5.0f, 5.0f);
}else if(selection==1){
rescaled_value = input_value;
}else if(selection==2){
rescaled_value = rescale(input_value, 0.0f, 5.0f, -10.0f, 10.0f);
}else if(selection==3){
rescaled_value = rescale(input_value, -5.0f, 5.0f, 0.0f, 10.0f);
}

}else if(inputs[INPUT_2].active){

input_value = clamp(inputs[INPUT_2].value, 0.0f, 10.0f);
if(selection==0){
rescaled_value = rescale(input_value, 0.0f, 10.0f, -5.0f, 5.0f);
}else if(selection==1){
rescaled_value = rescale(input_value, 0.0f, 10.0f, 0.0f, 5.0f);
}else if(selection==2){
rescaled_value = rescale(input_value, 0.0f, 10.0f, -10.0f, 10.0f);
}else if(selection==3){
rescaled_value = input_value;
}

}else if(inputs[INPUT_3].active){

input_value = inputs[INPUT_3].value;
if(selection==0){
rescaled_value = input_value;
}else if(selection==1){
rescaled_value = input_value;
}else if(selection==2){
rescaled_value = input_value;
}else if(selection==3){
//take the input of a midi KB, get the voltage minus octave, convert it to 1V/KEY
float ext_key = getNoteInVolts(input_value);
rescaled_value = clamp( rescale( ext_key, 0.0f, 1.0f, 0.0f, 11.0f ), 0.0f, 10.0f );
}

}
outputs[OUTPUT].value = rescaled_value;

}

////////////////////////////////////
struct ReScaleWidget : ModuleWidget
{
ReScaleWidget(ReScale *module);
};

ReScaleWidget::ReScaleWidget(ReScale *module) : ModuleWidget(module) {

setPanel(SVG::load(assetPlugin(plugin, "res/ReScale.svg")));

//SCREWS - SPECIAL SPACING FOR RACK WIDTH*4
addChild(Widget::create<as_HexScrew>(Vec(0, 0)));
addChild(Widget::create<as_HexScrew>(Vec(box.size.x - RACK_GRID_WIDTH, 0)));
addChild(Widget::create<as_HexScrew>(Vec(0, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
addChild(Widget::create<as_HexScrew>(Vec(box.size.x - RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
//PORTS
addInput(Port::create<as_PJ301MPort>(Vec(18, 65), Port::INPUT, module, ReScale::INPUT_0));
addInput(Port::create<as_PJ301MPort>(Vec(18, 105), Port::INPUT, module, ReScale::INPUT_1));
addInput(Port::create<as_PJ301MPort>(Vec(18, 145), Port::INPUT, module, ReScale::INPUT_2));
addInput(Port::create<as_PJ301MPort>(Vec(18, 185), Port::INPUT, module, ReScale::INPUT_3));

addParam(ParamWidget::create<as_KnobBlackSnap4>(Vec(12, 230), module, ReScale::CONVERT_PARAM, 0.0f, 3.0f, 0.0f));

addOutput(Port::create<as_PJ301MPort>(Vec(18, 280), Port::OUTPUT, module, ReScale::OUTPUT));


}
Model *modelReScale = Model::create<ReScale, ReScaleWidget>("AS", "ReScale", "Voltage Converter", UTILITY_TAG);
Loading

0 comments on commit 773cf3e

Please sign in to comment.