diff --git a/Out.cpp b/Out.cpp deleted file mode 100644 index 33beeb2..0000000 --- a/Out.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// Out.cpp -#include "Arduino.h" -#include "Out.h" -#include "globals.h" - -Out::Out(byte pin) { - this->pin = pin; - state = LOW; - - divideMode = 1; // 1 divison | 0 multiplication - modifier = 1; // divide mode modifier (4x, /32, etc) - div = 1; // cycles needed before a pulse based on divide mode and modifier - cycle = 0; // how many cycles have passed since last pulse - divString = ""; // string for screen .. probably does not belong here - - dur = 0; // how long pulse is on - width = 50; // pulse width - len = 0; // max len a pulse can be on, as determined by width - - p = 100; // probability of a pulse - - - pinMode(pin, OUTPUT); -} - -int Out::getState() { - return state; -} - -void Out::setLen(unsigned long currentPeriod) { - len = (unsigned long)((double)currentPeriod * (width / 100.0) / 1000.0); -} - -void Out::setDiv(int modifier, byte divide = 1) { - if (divide == 1) { - div = ppqn * modifier; - divString = "/" + modifier; - } else { - div = ppqn / modifier; - divString = "x" + modifier; - } - divideMode = divide; - this->modifier = modifier; -}; - -void Out::setWidth(int newWidth) { - width = newWidth; - if (divideMode == 1) { - len = (unsigned long)((double)(minute / BPM) * (width / 100.0) / 1000.0); - } else { - len = (unsigned long)((double)(minute / BPM / modifier) * (width / 100.0) / 1000.0); - } -}; - -void Out::setP(int prob) { - this->p = prob; -} - -void Out::turnOn() { - cycle += 1; - byte pRes = 1; - - if (cycle == div) { - if (p < 100) { - long r = random(1, 101); - if (r > p) { - pRes = 0; - } - } - - if (pRes == 1) { - state = HIGH; - digitalWrite(pin, state); - dur = millis(); - } - cycle = 0; - }; -} - -void Out::turnOff() { - if (state == HIGH && millis() - dur >= len) { - state = LOW; - digitalWrite(pin, state); - dur = 0; - }; -} - diff --git a/Out.h b/Out.h deleted file mode 100644 index c5e3833..0000000 --- a/Out.h +++ /dev/null @@ -1,33 +0,0 @@ -// Out.h -#ifndef Out_h -#define Out_h - -#include - -class Out { - private: - byte pin; - unsigned char state; - int cycle; - unsigned long dur; - unsigned long len; - byte width; - byte divideMode; - int div; - int modifier; - String divString; - int p; - - public: - Out(byte pin); - void turnOn(); - void turnOff(); - void setLen(unsigned long currentPeriod); - void setDiv(int newDiv, byte divide = 1); - void setWidth(int newWidth); - void setP(int prob); - int getState(); - -}; - -#endif diff --git a/globals.h b/globals.h deleted file mode 100644 index d2ea81a..0000000 --- a/globals.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef GLOBALS_H -#define GLOBALS_H - -#include - -extern byte BPM; -extern unsigned long minute; -extern unsigned long period; -extern byte ppqn; -#endif // GLOBALS_H - -/* -TODO: - -PRE-DAC: -[x] Figure out multiplicative beats X2 X4 X8 X16 X32? -[ ] Swing/Phase (same thing) -[x] Probability -[ ] Humanization -[ ] Euclidian Rhythms - [ ] Steps - # of steps for a full pattern - [ ] Hits - how many hits across the steps, must be less than steps - [ ] Offset - move the starting point of the pattern -[ ] Logic (NO | AND | OR | XOR) -[ ] Mute -[ ] Save -[ ] Load - -POST-DAC: -[ ] Different Wave Forms -[ ] Different Voltage levels -[ ] v/oct? - -100BPM -4800BPM - -POSSIBLE DIVISIONS: -1: x48 -16: x32 -32: x16 -40: x8 -44: x4 -46: x2 ---- -48*1: 1 ** THIS NEEDS TO BE PASSED IN AS DIVIDE MODE -48*2 = 96: /2 -48*4 = 192: /4 -48*8 = /8 -48*16 = /16 - -*/