
Music Visualizer
Dependencies: mbed SDFileSystem NeoStrip PinDetect
Revision 7:c2ef4232feb4, committed 2020-04-30
- Comitter:
- makkoli98
- Date:
- Thu Apr 30 02:40:20 2020 +0000
- Parent:
- 5:b6f462ece58f
- Child:
- 8:fa37292cf52c
- Commit message:
- Play/pause, skip, and back only work in sd card mode
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Apr 30 02:27:38 2020 +0000 +++ b/main.cpp Thu Apr 30 02:40:20 2020 +0000 @@ -260,14 +260,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 @@ -294,7 +296,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) { @@ -310,7 +312,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) {