Music Visualizer
Dependencies: mbed SDFileSystem NeoStrip PinDetect
Diff: main.cpp
- Revision:
- 8:fa37292cf52c
- Parent:
- 6:2f0706de9553
- Parent:
- 7:c2ef4232feb4
- Child:
- 9:0e16d1e33c4b
--- a/main.cpp Thu Apr 30 02:33:57 2020 +0000 +++ b/main.cpp Thu Apr 30 02:46:26 2020 +0000 @@ -263,14 +263,16 @@ if (bhit == '1') { switch (bnum) { 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; + if (src) { + 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; + } } break; case '2': // Button 2 for mute/unmute @@ -297,7 +299,7 @@ } break; case '7': // Left arrow for previous - if (sd_mtx.trylock()) { + if (sd_mtx.trylock() && src) { sd_mtx.lock(); waver.set_play_state(0); if (cur_song > 0) { @@ -313,7 +315,7 @@ } break; case '8': // Right arrow for skip - if (sd_mtx.trylock()) { + if (sd_mtx.trylock() && src) { sd_mtx.lock(); waver.set_play_state(0); if (cur_song < filenames.size() - 1) {