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

/media/uploads/casiotone401/tumblr_nsg7y4pkfg1qlle9fo1_540.png

Files at this revision

API Documentation at this revision

Comitter:
casiotone401
Date:
Thu May 26 10:46:48 2016 +0000
Parent:
30:d82b42321364
Commit message:
bugfix

Changed in this revision

FastIO.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rpc.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/FastIO.lib	Tue Mar 08 11:50:43 2016 +0000
+++ b/FastIO.lib	Thu May 26 10:46:48 2016 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/Sissors/code/FastIO/#89d6ae484a35
+http://developer.mbed.org/users/Sissors/code/FastIO/#ed72895a2402
--- a/main.cpp	Tue Mar 08 11:50:43 2016 +0000
+++ b/main.cpp	Thu May 26 10:46:48 2016 +0000
@@ -108,9 +108,6 @@
 // Init LCD        
     UpdateLCD();
     
-    gLCD.locate( 0, 1 );
-    gLCD.printf("12345678 G>>%3.2f", gGlide);
-        
 // Main loop
     while (1) 
     {
@@ -317,7 +314,6 @@
                 qcv = calibMap1[(unsigned int)MapFloat(gOSC_cv[ch], 0, SCALING_N, 0, (QUAN_RES1 - 1))];
                     
                 glidecv[ch] = glidecv[ch] * gGlide + (qcv * SCALING_N) * (1.0f - gGlide);
-
                 break;
                 
             case Maj:
@@ -325,7 +321,6 @@
                 qcv = calibMap2[(unsigned int)MapFloat(gOSC_cv[ch], 0, SCALING_N, 0, (QUAN_RES2 - 1))];
 
                 glidecv[ch] = glidecv[ch] * gGlide + (qcv * SCALING_N) * (1.0f - gGlide);
-
                 break;
             
             case M7:
@@ -333,7 +328,6 @@
                 qcv = calibMap3[(unsigned int)MapFloat(gOSC_cv[ch], 0, SCALING_N, 0, (QUAN_RES3 - 1))];
                     
                 glidecv[ch] = glidecv[ch] * gGlide + (qcv * SCALING_N) * (1.0f - gGlide);
-
                 break;
                 
             case Min7:
@@ -341,7 +335,6 @@
                 qcv = calibMap4[(unsigned int)MapFloat(gOSC_cv[ch], 0, SCALING_N, 0, (QUAN_RES4 - 1))];
 
                 glidecv[ch] = glidecv[ch] * gGlide + (qcv * SCALING_N) * (1.0f - gGlide);
-
                 break;
                     
             case Dor:
@@ -357,7 +350,6 @@
                 qcv = calibMap6[(unsigned int)MapFloat(gOSC_cv[ch], 0, SCALING_N, 0, (QUAN_RES6 - 1))];
 
                 glidecv[ch] = glidecv[ch] * gGlide + (qcv * SCALING_N) * (1.0f - gGlide);
-
                 break;
                 
             case S5th:
@@ -365,7 +357,6 @@
                 qcv = calibMap7[(unsigned int)MapFloat(gOSC_cv[ch], 0, SCALING_N, 0, (QUAN_RES7 - 1))];
 
                 glidecv[ch] = glidecv[ch] * gGlide + (qcv * SCALING_N) * (1.0f - gGlide);
-
                 break;
                 
             case Wht:
@@ -373,7 +364,6 @@
                 qcv = calibMap8[(unsigned int)MapFloat(gOSC_cv[ch], 0, SCALING_N, 0, (QUAN_RES8 - 1))];
 
                 glidecv[ch] = glidecv[ch] * gGlide + (qcv * SCALING_N) * (1.0f - gGlide);
-                
                 break;
         }
         
@@ -540,7 +530,6 @@
                     sendMes.setArgs("s", "880Hz");
                     
                     _qmode = -1;
-                    
                     break;
                 
                 case MODE_OSC:
@@ -548,7 +537,6 @@
                     gLCD.printf("OSC|");
                     
                     sendMes.setArgs("s", "OSCtoCV");
-                    
                     break;
 
                 case MODE_SEQ:  
@@ -556,7 +544,6 @@
                     gLCD.printf("ASR|");
                     
                     sendMes.setArgs("s", "ASR SEQ");
-                    
                     break;
                     
                 case MODE_185:  
@@ -564,7 +551,6 @@
                     gLCD.printf("185|");
             
                     sendMes.setArgs("s", "M185 SEQ");
-            
                     break;
                     
                 case MODE_437:  
@@ -580,7 +566,6 @@
                     gLCD.printf("EUC|");
                     
                     sendMes.setArgs("s", "Euclidean SEQ");
-                    
                     break;
                 
                 case MODE_RND:  
@@ -588,7 +573,6 @@
                     gLCD.printf("RND|");
                 
                     sendMes.setArgs("s", "Xorshift Random");
-                
                     break;
                     
                 case MODE_LFO:  
@@ -596,7 +580,6 @@
                     gLCD.printf("LFO|");
                 
                     sendMes.setArgs("s", "Stepped LFO");
-                
                     break;
 
                 default:
@@ -620,7 +603,6 @@
                     gLCD.printf("lin");
 
                     sendMes.setArgs("s", "Linear");
-
                     break;
                     
                 case Chr:
@@ -628,7 +610,6 @@
                     gLCD.printf("chr");
 
                     sendMes.setArgs("s", "Chromatic");
-
                     break;
                 
                 case Maj:
@@ -636,7 +617,6 @@
                     gLCD.printf("maj");
                     
                     sendMes.setArgs("s", "Major");
-
                     break;
             
                 case M7:
@@ -644,7 +624,6 @@
                     gLCD.printf("ma7");
                     
                     sendMes.setArgs("s", "Major7");
-
                     break;
                 
                 case Min7:
@@ -660,7 +639,6 @@
                     gLCD.printf("dor");
                     
                     sendMes.setArgs("s", "Dorian");
-
                     break;
         
                 case Min:
@@ -669,7 +647,6 @@
                     
                     sendMes.setTopAddress("/scale");
                     sendMes.setArgs("s", "Minor");
-
                     break;
                 
                 case S5th:
@@ -677,7 +654,6 @@
                     gLCD.printf("5th");
                     
                     sendMes.setArgs("s", "5th");
-
                     break;
                 
                 case Wht:
@@ -755,7 +731,7 @@
 inline void onUDPSocketEvent(UDPSocketEvent e)
 {
     static union OSCarg msg[10];
-    static char buf[1024] = {0};
+    static char buf[768] = {0};
     int recvlen;
     int num, numrow, len, offset;
     int messagepos = 0;
@@ -767,7 +743,7 @@
     {
         case UDPSOCKET_READABLE: // The only event for now
         
-            recvlen = gUdp.recvfrom(buf, 1024, &host);  // packet length    
+            recvlen = gUdp.recvfrom(buf, 768, &host);  // packet length    
 
             if (recvlen <= 0)  break;
 
@@ -786,7 +762,7 @@
                     messagepos += 4;
                     recvlen -= 4;
 
-                    if (recvlen <= 8)
+                    if (recvlen < 0)
                     {
                         bundleflag = false;
                         break;
@@ -814,15 +790,19 @@
                     num = -1;
                 }
 
-                // address pattern SYNC & GATE (Type Tag int, float)
-                if (!strncmp(msg[0].address + (len - offset) - 4, "sync", 4)) 
+                if (!strncmp(msg[0].address + (len - offset) - 4, "page", 4)) // touchOSC page
                 { 
-                    gCLOCKOUT = (msg[2].i != 0) ? true: false;
+                    continue;
+
+                } else if (!strncmp(msg[0].address + (len - offset) - 4, "sync", 4)) { 
+                    if (msg[2].i != 0) gCLOCKOUT = true;
+                    else              gCLOCKOUT = false;
                     continue;
 
                 } else if (!strncmp(msg[0].address + (len - offset) - 4, "gate", 4) && (num != -1)) {
                     if (num > 3) continue;
-                    gGATES[num] = (msg[2].i != 0) ? true: false;
+                    if (msg[2].i != 0) gGATES[num] = true;
+                    else              gGATES[num] = false;
                     continue;
                     // (touchOSC Control push, toggle)
                 } else if (!strncmp(msg[0].address + (len - offset) - 5, "fader", 5) && (num != -1)) {
@@ -853,7 +833,8 @@
 
                 } else if (!strncmp(msg[0].address + (len - offset) - 6, "ctrlsw", 6) && (num != -1)) {
                     if (num > 7) continue;
-                    gCtrlSW[num] = (msg[2].i != 0) ? true: false;
+                    if (msg[2].i != 0) gCtrlSW[num] = true;
+                    else              gCtrlSW[num] = false;
                     continue;
 
                 } else if (!strncmp(msg[0].address + (len - offset) - 4, "ctrl", 4) && (num != -1)) {
@@ -1005,7 +986,8 @@
 
                     } else if (!strncmp(msg[0].address + (len - offset) - 2, "sw", 2) && (num != -1)) {
                         if (num > 1) continue;
-                        gArdSW[num] = (msg[2].i != 0) ? true: false;                              
+                        if (msg[2].i != 0) gArdSW[num] = true;
+                        else               gArdSW[num] = false;                                       
                         continue;
 
                     }
@@ -1015,6 +997,6 @@
                     continue;
                 }
 
-            } while (bundleflag);                   
+            } while (bundleflag);
     }
 }
--- a/mbed-rpc.lib	Tue Mar 08 11:50:43 2016 +0000
+++ b/mbed-rpc.lib	Thu May 26 10:46:48 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/mbed-official/code/mbed-rpc/#325e3da833e1
+http://mbed.org/teams/mbed-official/code/mbed-rpc/#33e21ae4d434
--- a/mbed.bld	Tue Mar 08 11:50:43 2016 +0000
+++ b/mbed.bld	Thu May 26 10:46:48 2016 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/87f2f5183dfb
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34
\ No newline at end of file