OSC-CV Converter
Dependencies: Bonjour OSCReceiver TextLCD mbed mbed-rpc BurstSPI DebouncedInterrupt FastIO MIDI OSC OSCtoCV ClockControl
OSC to CV Converter
http://gtbts.tumblr.com/post/125663817741/osc-to-cv-converter-ver2-mbed-osctocv
Revision 8:fe50078d6b80, committed 2013-02-17
- Comitter:
- casiotone401
- Date:
- Sun Feb 17 08:47:25 2013 +0000
- Parent:
- 7:a04f8378662e
- Child:
- 9:1ac3d135d965
- Commit message:
- bug fix
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Feb 09 04:23:17 2013 +0000 +++ b/main.cpp Sun Feb 17 08:47:25 2013 +0000 @@ -232,13 +232,13 @@ float gOSC_cv[8]; float gSeq_cv1[8]; float gSeq_cv2[8]; -float gGlide; -volatile static int gMode; +volatile float gGlide; +volatile int gMode; // Variables for Control -float gCtrl[2]; -volatile int gCtrlSW[4]; +float gCtrl[2]; +volatile int gCtrlSW[4]; //------------------------------------------------------------- // mbed Functions @@ -270,7 +270,6 @@ { float pot, _pot; int bpm, _bpm; - int shift1, shift2, shift3, shift4; if(SetupEthNetIf() == -1) { @@ -333,39 +332,29 @@ if(gCtrlSW[2] == 0 && gCtrlSW[3] == 0) // Sequencer Mode1 { - shift1 = UpdateGate(bpm, N16TH, GATE1, 3, 0); // Shift Timming 16th note - + SeqCV((UpdateGate(bpm, N16TH, GATE1, 3, 0))); // Shift Timming 16th note UpdateGate(bpm, N8TH, GATE2, 3, 0); UpdateGate(bpm, NDOT8, GATE3, 3, 0); UpdateGate(bpm, TRIP4, GATE4, 3, 0); - - SeqCV(shift1); // Do shift ch all + continue; } else if (gCtrlSW[2] == 1 && gCtrlSW[3] == 0) { // Sequencer Mode2 (if gCtrlSW[2] ON) - shift1 = UpdateGate(bpm, N16TH, GATE1, 3, 0); - shift2 = UpdateGate(bpm, N8TH, GATE2, 3, 0); - shift3 = UpdateGate(bpm, NDOT4, GATE3, 3, 0); - shift4 = UpdateGate(bpm, TRIP8, GATE4, 3, 0); - - SeqCV(shift1); // Do shift ch 1~5 - SeqCV(shift2); // Do shift ch 6 - SeqCV(shift3); // Do shift ch 7 - SeqCV(shift4); // Do shift ch 8 + SeqCV((UpdateGate(bpm, N16TH, GATE1, 3, 0))); // Do shift ch 1~5 + SeqCV((UpdateGate(bpm, N4TH, GATE2, 3, 0))); // Do shift ch 6 + SeqCV((UpdateGate(bpm, NDOT4, GATE3, 3, 0))); // Do shift ch 7 + SeqCV((UpdateGate(bpm, TRIP8, GATE4, 3, 0))); // Do shift ch 8 + continue; } else if (gCtrlSW[3] == 1) { // Sequencer Mode3 (if gCtrlSW[3] ON) // (ch6,7,8, short loop) - shift1 = UpdateGate(bpm, N16TH, GATE1, 3, 0); - shift2 = UpdateGate(bpm, N8TH, GATE2, 3, 0); - shift3 = UpdateGate(bpm, NDOT8, GATE3, 3, 0); - shift4 = UpdateGate(bpm, TRIP4, GATE4, 3, 0); - - SeqCV(shift1); // Do shift ch 1~5 - SeqCV(shift2); // Do shift ch 6 - SeqCV(shift3); // Do shift ch 7 - SeqCV(shift4); // Do shift ch 8 + SeqCV((UpdateGate(bpm, N16TH, GATE1, 3, 0))); // Do shift ch 1~5 + SeqCV((UpdateGate(bpm, N8TH, GATE2, 3, 0))); // Do shift ch 6 + SeqCV((UpdateGate(bpm, NDOT8, GATE3, 3, 0))); // Do shift ch 7 + SeqCV((UpdateGate(bpm, TRIP4, GATE4, 3, 0))); // Do shift ch 8 + continue; } @@ -823,7 +812,7 @@ break; } - if((gCtrlSW[2] == 0 || gCtrlSW[2] == 1) && gCtrlSW[3] == 0)// Sequencer Mode1 + if(gCtrlSW[2] == 0 && gCtrlSW[3] == 0) // Sequencer Mode1 { for(i = 1; i < 8; ++i) { @@ -831,23 +820,31 @@ cv[i] = (unsigned int)glidecv[i]; UpdateCV(WRITE_UPDATE_N, i, &cv[i]); - - if(shift == 1) // GATE1 + } + + if(shift == 1) // GATE1 + { + for(j = 1; j < 8; ++j) // Shift ch2~8 { - for(i = 1; i < 8; ++i) // Shift ch2~8 - { - shiftcv[i] = glidecv[i-1]; - } - - ch++; - ch &= 0x0F; + shiftcv[j] = glidecv[j-1]; } - cnt1 = cnt2 = cnt3 = 0; + ch++; + ch &= 0x0F; } + + cnt1 = cnt2 = cnt3 = 0; - } else if (gCtrlSW[2] == 1 && gCtrlSW[3] == 0) { // Sequencer Mode2 + } else if (gCtrlSW[2] == 1 && gCtrlSW[3] == 0) { // Sequencer Mode2 + for(i = 1; i < 8; ++i) + { + glidecv[i] = glidecv[i] * gGlide + shiftcv[i] * (1.0f - gGlide); + cv[i] = (unsigned int)glidecv[i]; + + UpdateCV(WRITE_UPDATE_N, i, &cv[i]); + } + if(shift == 1) // GATE1 { for(j = 1; j < 5; ++j) @@ -869,31 +866,33 @@ } else if (shift == 4) { // GATE4 shiftcv[7] = glidecv[3]; // Shift ch8 - } + } + + cnt1 = cnt2 = cnt3 = 0; - } else if (gCtrlSW[3] == 1) { // Sequencer Mode3 + } else if (gCtrlSW[3] == 1) { // Sequencer Mode3 - for(j = 1; j < 5; ++j) + for(i = 1; i < 5; ++i) { - glidecv[j] = glidecv[j] * gGlide + shiftcv[j] * (1.0f - gGlide); + glidecv[i] = glidecv[i] * gGlide + shiftcv[i] * (1.0f - gGlide); + cv[i] = (unsigned int)glidecv[i]; + + UpdateCV(WRITE_UPDATE_N, i, &cv[i]); + } + + for(j = 5; j < 8; ++j) + { + glidecv[j] = glidecv[j] * gGlide + loopcv[j - 5] * (1.0f - gGlide); cv[j] = (unsigned int)glidecv[j]; UpdateCV(WRITE_UPDATE_N, j, &cv[j]); } - for(k = 5; k < 8; ++k) - { - glidecv[k] = glidecv[k] * gGlide + loopcv[k - 5] * (1.0f - gGlide); - cv[k] = (unsigned int)glidecv[k]; - - UpdateCV(WRITE_UPDATE_N, k, &cv[k]); - } - if(shift == 1) // GATE1 { - for(i = 1; i < 8; ++i) + for(k = 1; k < 8; ++k) { - shiftcv[i] = glidecv[i-1]; // Shift ch2~5 + shiftcv[k] = glidecv[k-1]; // Shift ch2~5 } ch++; @@ -1165,11 +1164,6 @@ else gLEDS[num] = gGATES[num] = 0; break; - } else if ((strncmp(msg[0].address,"/1/multipush",12)==0) && (num != -1)) { - if(num > 3) break; - if(absv >= 1 || msg[2].i >= 1) gLEDS[num] = gGATES[num] = 1; - else gLEDS[num] = gGATES[num] = 0; - break; } // address pattern CV (Type Tag float)