Music Visualizer

Dependencies:   mbed SDFileSystem NeoStrip PinDetect

Revision:
4:6fbdec5bc602
Parent:
1:2e32808bfc2b
Child:
5:b6f462ece58f
--- a/main.cpp	Thu Apr 30 01:54:03 2020 +0000
+++ b/main.cpp	Thu Apr 30 02:10:59 2020 +0000
@@ -30,7 +30,7 @@
 Thread thread2;
 Thread thread3;
 Mutex sd_mtx;
-volatile int src = 0;  // 0 for Mic, 1 for SD card
+volatile int src = 1;  // 0 for Mic, 1 for SD card
 
 vector<string> filenames;               // list of files in sd card
 volatile int cur_song = 1;
@@ -262,11 +262,13 @@
                             case '1':   // Button 1 for play/pause
                                 if (waver.get_play_state() == 1) {
                                     waver.set_play_state(0);
+                                    thread2.terminate();
+                                    mute = 0;
                                 } else if (waver.get_play_state() == 0) {
                                     waver.set_play_state(1);
                                     thread2.start(sound_thread);
+                                    mute = 1;
                                 }
-                                printf("%d\n\r", waver.get_play_state());
                                 break;
                             case '2':   // Button 2 for mute/unmute
                                 mute = !mute;