OSCtoCV Library
Revision 6:7fb15b1b5459, committed 2016-02-25
- Comitter:
- casiotone401
- Date:
- Thu Feb 25 11:21:37 2016 +0000
- Parent:
- 5:abe335652add
- Commit message:
- minor change
Changed in this revision
diff -r abe335652add -r 7fb15b1b5459 OSCtoCV.cpp --- a/OSCtoCV.cpp Thu Feb 18 13:26:48 2016 +0000 +++ b/OSCtoCV.cpp Thu Feb 25 11:21:37 2016 +0000 @@ -13,30 +13,30 @@ // Chromatic Scale const float calibMap1[QUAN_RES1] = { -0.00076928, 0.00900736, 0.01724544, 0.02548352, 0.03372160, -0.04195968, 0.05019776, 0.05843584, 0.06667392, 0.07491200, -0.08315008, 0.09138816, 0.09962624, 0.10786432, 0.11610240, -0.12434047, 0.13258974, 0.14083999, 0.14909023, 0.15734047, -0.16559070, 0.17384095, 0.18209119, 0.19034143, 0.19859168, -0.20684192, 0.21509215, 0.22334240, 0.23159264, 0.23984288, -0.24809311, 0.25634655, 0.26460093, 0.27285531, 0.28110969, -0.28936407, 0.29761845, 0.30587283, 0.31412721, 0.32238159, -0.33063596, 0.33889034, 0.34714472, 0.35539910, 0.36365348, -0.37190786, 0.38017464, 0.38844886, 0.39672306, 0.40499726, -0.41327149, 0.42154568, 0.42981988, 0.43809411, 0.44636831, -0.45464250, 0.46291673, 0.47119093, 0.47946513, 0.48773935, -0.49601355, 0.50430328, 0.51260746, 0.52091163, 0.52921581, -0.53751999, 0.54582411, 0.55412829, 0.56243247, 0.57073665, -0.57904083, 0.58734500, 0.59564912, 0.60395330, 0.61225748, -0.62056166, 0.62890279, 0.63728637, 0.64566994, 0.65405351, -0.66243708, 0.67082065, 0.67920423, 0.68758780, 0.69597137, -0.70435494, 0.71273851, 0.72112209, 0.72950566, 0.73788923, -0.74627280, 0.75476575, 0.76334614, 0.77192658, 0.78050703, -0.78908741, 0.79766786, 0.80624831, 0.81482869, 0.82340914, -0.83198959, 0.84056997, 0.84915042, 0.85773087, 0.86631125, -0.87489170, 0.88425636, 0.89363104, 0.90300572, 0.91238040, -0.92175508, 0.93112975, 0.94050443, 0.94987911, 0.95925385, -0.96862853 +0.00076928f, 0.00900736f, 0.01724544f, 0.02548352f, 0.03372160f, +0.04195968f, 0.05019776f, 0.05843584f, 0.06667392f, 0.07491200f, +0.08315008f, 0.09138816f, 0.09962624f, 0.10786432f, 0.11610240f, +0.12434047f, 0.13258974f, 0.14083999f, 0.14909023f, 0.15734047f, +0.16559070f, 0.17384095f, 0.18209119f, 0.19034143f, 0.19859168f, +0.20684192f, 0.21509215f, 0.22334240f, 0.23159264f, 0.23984288f, +0.24809311f, 0.25634655f, 0.26460093f, 0.27285531f, 0.28110969f, +0.28936407f, 0.29761845f, 0.30587283f, 0.31412721f, 0.32238159f, +0.33063596f, 0.33889034f, 0.34714472f, 0.35539910f, 0.36365348f, +0.37190786f, 0.38017464f, 0.38844886f, 0.39672306f, 0.40499726f, +0.41327149f, 0.42154568f, 0.42981988f, 0.43809411f, 0.44636831f, +0.45464250f, 0.46291673f, 0.47119093f, 0.47946513f, 0.48773935f, +0.49601355f, 0.50430328f, 0.51260746f, 0.52091163f, 0.52921581f, +0.53751999f, 0.54582411f, 0.55412829f, 0.56243247f, 0.57073665f, +0.57904083f, 0.58734500f, 0.59564912f, 0.60395330f, 0.61225748f, +0.62056166f, 0.62890279f, 0.63728637f, 0.64566994f, 0.65405351f, +0.66243708f, 0.67082065f, 0.67920423f, 0.68758780f, 0.69597137f, +0.70435494f, 0.71273851f, 0.72112209f, 0.72950566f, 0.73788923f, +0.74627280f, 0.75476575f, 0.76334614f, 0.77192658f, 0.78050703f, +0.78908741f, 0.79766786f, 0.80624831f, 0.81482869f, 0.82340914f, +0.83198959f, 0.84056997f, 0.84915042f, 0.85773087f, 0.86631125f, +0.87489170f, 0.88425636f, 0.89363104f, 0.90300572f, 0.91238040f, +0.92175508f, 0.93112975f, 0.94050443f, 0.94987911f, 0.95925385f, +0.96862853f }; // Major Scale @@ -165,8 +165,8 @@ float gAccent185[8] = {0}; float gPulseCountBeats[16] = {0}; -float gBeatsLevel[8] = {1}; -float gBeatsDecay[8] = {1}; +float gBeatsLevel[8]; +float gBeatsDecay[8]; unsigned int gBeatsMatrix[8][16] = {{0}}; // Euclidean SEQ Variables @@ -195,12 +195,12 @@ gArdSW[1] /sw2 Arduino sw2 */ -float gCtrl[8]; +float gCtrl[8] = {0.398f, 0, 0, 0, 1.0f, 1.0f, 1.0f, 1.0f}; bool gCtrlSW[8] = {false}; // Variables for Arduino -uint16_t gArdCV[4]; -float gArdPot[2] = {408.0f, 350.0f}; +uint16_t gArdCV[4] = {0}; +float gArdPot[2] = {408.0f, 350}; bool gArdSW[2] = {false}; //------------------------------------------------------------- @@ -240,7 +240,6 @@ ); #endif - // touchOSC Address uint8_t touchOSCAddress[] = {192, 168, 1, 7}; int touchOSCPort = TOSC_PORT;
diff -r abe335652add -r 7fb15b1b5459 OSCtoCV_GateSequencer.cpp --- a/OSCtoCV_GateSequencer.cpp Thu Feb 18 13:26:48 2016 +0000 +++ b/OSCtoCV_GateSequencer.cpp Thu Feb 25 11:21:37 2016 +0000 @@ -9,7 +9,7 @@ //------------------------------------------------------------- // Gate Sequencer beat(Note values) length(Gate time) invert(invert Gate) -int GateSeq(unsigned int bpm, unsigned int beat, unsigned int ch, float length, bool invert, bool gatesOff, bool syncoff) +int GateSeq(uint16_t bpm, uint16_t beat, uint8_t ch, float length, bool invert, bool gatesOff, bool syncoff) { int i; static int gatetime[GATE_TOTAL], oldgatetime[GATE_TOTAL]; @@ -26,7 +26,7 @@ } else { bar = (60.0f / bpm) * 4000000; - sync24 = (bar / 4) / 24; // sync24 not tested + //sync24 = (bar / 4) / 24; // sync24 not tested _bpm = bpm; } @@ -73,7 +73,7 @@ default: gatetime[ch] = bar / beat; - //sync24 = bar / 16; + sync24 = bar / 16; break; }
diff -r abe335652add -r 7fb15b1b5459 OSCtoCV_GateSequencer.h --- a/OSCtoCV_GateSequencer.h Thu Feb 18 13:26:48 2016 +0000 +++ b/OSCtoCV_GateSequencer.h Thu Feb 25 11:21:37 2016 +0000 @@ -10,6 +10,6 @@ // Gate Sequencer Functions // Gate Sequencer beat(Note values) length(Gate time) invert(invert Gate) gateoff, syncoff(Mute, SyncOut GateOut) -int GateSeq(unsigned int bpm, unsigned int beat, unsigned int ch, float length, bool invert, bool gatesOff, bool syncoff); +int GateSeq(uint16_t bpm, uint16_t beat, uint8_t ch, float length, bool invert, bool gatesOff, bool syncoff); #endif
diff -r abe335652add -r 7fb15b1b5459 OSCtoCV_LFO.cpp --- a/OSCtoCV_LFO.cpp Thu Feb 18 13:26:48 2016 +0000 +++ b/OSCtoCV_LFO.cpp Thu Feb 25 11:21:37 2016 +0000 @@ -103,7 +103,7 @@ //------------------------------------------------------------- // LFO cv generator -void SteppedLFO(unsigned int channelOffset, bool quantizeOff) +void SteppedLFO(uint8_t channelOffset, bool quantizeOff) { static uint8_t ch = channelOffset; static uint8_t mcount;
diff -r abe335652add -r 7fb15b1b5459 OSCtoCV_LFO.h --- a/OSCtoCV_LFO.h Thu Feb 18 13:26:48 2016 +0000 +++ b/OSCtoCV_LFO.h Thu Feb 25 11:21:37 2016 +0000 @@ -200,6 +200,6 @@ float Invert(float x); // LFO cv generator output LFO channelOffset ~ ch8 -void SteppedLFO(unsigned int channelOffset, bool quantizeOff); +void SteppedLFO(uint8_t channelOffset, bool quantizeOff); #endif
diff -r abe335652add -r 7fb15b1b5459 OSCtoCV_Sequencer.cpp --- a/OSCtoCV_Sequencer.cpp Thu Feb 18 13:26:48 2016 +0000 +++ b/OSCtoCV_Sequencer.cpp Thu Feb 25 11:21:37 2016 +0000 @@ -9,7 +9,7 @@ //------------------------------------------------------------- // Sequence & Shift Out CV -void ShiftCVSeq(int trigger, bool reset, unsigned int channelRange) +void ShiftCVSeq(int trigger, bool reset, uint8_t channelRange) { int i, j; static bool triggerState = false; @@ -247,7 +247,7 @@ //------------------------------------------------------------- // M185 Sequencer -void M185Seq(int trigger, bool reset, unsigned int channelRange) +void M185Seq(int trigger, bool reset, uint8_t channelRange) { int i, j; static bool triggerState = false; @@ -496,7 +496,7 @@ //------------------------------------------------------------- // M185 Sequencer -void PolyM185Seq(int trigger, bool reset, unsigned int channelRange) +void PolyM185Seq(int trigger, bool reset, uint8_t channelRange) { int i, j; static bool triggerState = false; @@ -733,8 +733,17 @@ } //------------------------------------------------------------- +// shift cv seq ch1 ~ ch4 m185 seq ch5 ~ ch8 + +void PolyCVSeq(int trigger, bool reset) +{ + ShiftCVSeq(trigger, reset, CV_CHANNEL4); + PolyM185Seq(trigger, reset, CV_CHANNEL8); +} + +//------------------------------------------------------------- // 8ch drum track sequecer -unsigned int BeatsSeq(int trigger, bool reset, bool gatesOff) +bool BeatsSeq(int trigger, bool reset, bool gatesOff) { int rndVel; static bool triggerState = false; @@ -747,7 +756,6 @@ static uint8_t ch; static float decay[8] = {1}; - if (trigger && !triggerState) // trigger ON { if (stepCount != 0) @@ -912,15 +920,6 @@ } //------------------------------------------------------------- -// shift cv seq ch1 ~ ch4 m185 seq ch5 ~ ch8 - -void PolyCVSeq(int trigger, bool reset) -{ - ShiftCVSeq(trigger, reset, CV_CHANNEL4); - PolyM185Seq(trigger, reset, CV_CHANNEL8); -} - -//------------------------------------------------------------- // check reset count & send osc void CheckResetCount(uint8_t resetCount, uint8_t mode)
diff -r abe335652add -r 7fb15b1b5459 OSCtoCV_Sequencer.h --- a/OSCtoCV_Sequencer.h Thu Feb 18 13:26:48 2016 +0000 +++ b/OSCtoCV_Sequencer.h Thu Feb 25 11:21:37 2016 +0000 @@ -15,25 +15,22 @@ // Sequencer Functions // Sequence & Shift Out CV sequence cv out ch1 ~ channelRange -void ShiftCVSeq(int trigger, bool reset, unsigned int channelRange); +void ShiftCVSeq(int trigger, bool reset, uint8_t channelRange); // M185 Sequencer sequence cv out ch1 ~ channelRange -void M185Seq(int trigger, bool reset, unsigned int channelRange); +void M185Seq(int trigger, bool reset, uint8_t channelRange); // Polyphonic CV sequence cv out ch1 ~ channelRange -void PolyM185Seq(int trigger, bool reset, unsigned int channelRange); - -// shift cv seq ch1 ~ ch4 m185 seq ch5 ~ ch8 -void PolyCVSeq(int trigger, bool reset); +void PolyM185Seq(int trigger, bool reset, uint8_t channelRange); // shift cv seq ch1 ~ ch4 m185 seq ch5 ~ ch8 void PolyCVSeq(int trigger, bool reset); // 8ch drum track(midi & gate) sequecer // gatesOff(Mute GateOut(midi out only)) return triggerState -unsigned int BeatsSeq(int trigger, bool reset, bool gatesOff); +bool BeatsSeq(int trigger, bool reset, bool gatesOff); // check resetCount -void CheckResetCount(uint8_t, uint8_t); +void CheckResetCount(uint8_t resetCount, uint8_t mode); // check Analog Mode void CheckAnalogMode(void);