Bluetooth Enabled Keyboard/Synthesizer for mbed

Dependencies:   mbed 4DGL-uLCD-SE SDFileSystem mbed-rtos

Revision:
21:0df25c61c475
Parent:
8:f6699fd30737
Child:
23:cf9d43d5a5b4
--- a/Speaker.h	Fri Apr 29 23:26:49 2016 +0000
+++ b/Speaker.h	Sat Apr 30 20:44:20 2016 +0000
@@ -5,14 +5,10 @@
 // _pin(pin) means pass pin to the Speaker Constructor
 // precompute 32 sample points on one sine wave cycle
 // used for continuous sine wave output later
-        for(int k=0; k<32; k++) {
-            Analog_out_data[k] = int (65536.0 * ((1.0 + sin((float(k)/32.0*6.28318530717959)))/2.0));
-            // scale the sine wave to 16-bits - as needed for AnalogOut write_u16 arg
-        }
 
     }
 // class method to play a note based on AnalogOut class
-    void PlayNote(float frequency, float duration, float volume) {
+    void PlayNote(float frequency, float duration, float volume, short unsigned Analog_out_data[32]) {
         // scale samples using current volume level arg
         for(int k=0; k<32; k++) {
             Analog_scaled_data[k] = Analog_out_data[k] * volume;
@@ -37,7 +33,6 @@
 
     //variables used by interrupt routine and PlayNote
     volatile int i;
-    short unsigned Analog_out_data[32];
     short unsigned Analog_scaled_data[32];
 
 // Interrupt routine