
Bluetooth Enabled Keyboard/Synthesizer for mbed
Dependencies: mbed 4DGL-uLCD-SE SDFileSystem mbed-rtos
Diff: main.cpp
- Revision:
- 17:7dd298995c14
- Parent:
- 16:e01a77428828
- Child:
- 18:24f56dcc5a59
--- a/main.cpp Fri Apr 29 22:40:35 2016 +0000 +++ b/main.cpp Fri Apr 29 22:43:06 2016 +0000 @@ -564,6 +564,7 @@ if((keyPress == C_NOTE_KEY) && (readyFlag)){ // Play note C set_Note_Freq(noteArray[currentOctave-1][0]); // set the note frequency to the proper value create_samples(noteFreq, myWave); // creates the samples that are going to be output to the waveform + output_samples(); // outputs the samples that are currently in the buffer to p18 write_to_SDCard('C'); // writes to the SD card readyFlag = false; // set this flag to false so that the program will not try to process the key press more than once @@ -571,6 +572,7 @@ else if((keyPress == D_NOTE_KEY) && (readyFlag)){ // Play note D set_Note_Freq(noteArray[currentOctave-1][1]); create_samples(noteFreq, myWave); + output_samples(); write_to_SDCard('D'); readyFlag = false; @@ -578,30 +580,35 @@ else if((keyPress == E_NOTE_KEY) && (readyFlag)){ // Play note E set_Note_Freq(noteArray[currentOctave-1][2]); create_samples(noteFreq, myWave); + output_samples(); write_to_SDCard('E'); readyFlag = false; } else if((keyPress == F_NOTE_KEY) && (readyFlag)){ // Play note F set_Note_Freq(noteArray[currentOctave-1][3]); create_samples(noteFreq, myWave); + output_samples(); write_to_SDCard('F'); readyFlag = false; } else if((keyPress == G_NOTE_KEY) && (readyFlag)){ // Play note G set_Note_Freq(noteArray[currentOctave-1][4]); create_samples(noteFreq, myWave); + output_samples(); write_to_SDCard('G'); readyFlag = false; } else if((keyPress == A_NOTE_KEY) && (readyFlag)){ // Play note A set_Note_Freq(noteArray[currentOctave][5]); create_samples(noteFreq, myWave); + output_samples(); write_to_SDCard('A'); readyFlag = false; } else if((keyPress == B_NOTE_KEY) && (readyFlag)){ // Play note B set_Note_Freq(noteArray[currentOctave][6]); create_samples(noteFreq, myWave); + output_samples(); write_to_SDCard('B'); readyFlag = false; }