Luke Cartwright / Mbed 2 deprecated ELEC2645_Project_el18loc_nearlythere

Dependencies:   mbed

Revision:
15:1c67f064278e
Parent:
14:9cfe0041cc4e
Child:
18:204cd747b54a
diff -r 9cfe0041cc4e -r 1c67f064278e Sound/Sound.cpp
--- a/Sound/Sound.cpp	Tue May 19 15:04:33 2020 +0000
+++ b/Sound/Sound.cpp	Tue May 19 18:38:33 2020 +0000
@@ -21,20 +21,34 @@
         i=0;
         return(i);
     }
+    
     i=wavetable_itt(i,frequency);
+    
     if (waveform==1) {
         #ifdef SLOW_TIME
-        printf("SIN_wavtable[%u]=",i)
+        printf("SIN_wavtable[%u]=",i);
         #endif
         return (sin_wavtable[i]);
     }
+        if (waveform==2) {
+        #ifdef SLOW_TIME
+        printf("TRI_wavtable[%u]=",i);
+        #endif
+        return (tri_wavtable[i]);
+    }
+        if (waveform==3) {
+        #ifdef SLOW_TIME
+        printf("SQR_wavtable[%u]=",i);
+        #endif
+        return (pulse_wavtable[i]);
+    }
     return(0);
 }
 
 //PRIVATE:----------------------------------------------------------------------
 uint16_t Sound::wavetable_itt(uint16_t i, int frequency)
 {
-    i_d = i + ((1024*frequency)/4000); //i+((samples*f)*Ts)
+    i_d = i + ((1024*frequency)/ 16000); //i+((samples*f)*Ts)
     i=ceil(i_d); //ROUND IN FUTURE*************
 
     if (i>=1024) {