diff options
author | Jack Humbert <jack.humb@gmail.com> | 2016-07-25 03:58:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-25 03:58:01 +0200 |
commit | 24bd931962e0597d0a2f54b060c55a6cfd0a5bd5 (patch) | |
tree | c4fd886d38251367fa76d971e5c493dee591215e /quantum | |
parent | 41f15d8c346d41c47b992d430c9515a1ee0a4f9a (diff) | |
parent | 3ea738e450e9326b0d3ee4192da881cffb4c13c1 (diff) | |
download | qmk_firmware-24bd931962e0597d0a2f54b060c55a6cfd0a5bd5.tar.gz qmk_firmware-24bd931962e0597d0a2f54b060c55a6cfd0a5bd5.tar.xz |
Merge pull request #552 from robertdale/music-play-fix
Fixes issue #551 - ensure there's a recording to play before playing
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/process_keycode/process_music.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c index c8f3ddb90..2d52e47a7 100644 --- a/quantum/process_keycode/process_music.c +++ b/quantum/process_keycode/process_music.c @@ -6,6 +6,7 @@ int offset = 7; // music sequencer static bool music_sequence_recording = false; +static bool music_sequence_recorded = false; static bool music_sequence_playing = false; static float music_sequence[16] = {0}; static uint8_t music_sequence_count = 0; @@ -77,6 +78,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) { if (keycode == KC_LCTL && record->event.pressed) { // Start recording stop_all_notes(); music_sequence_recording = true; + music_sequence_recorded = false; music_sequence_playing = false; music_sequence_count = 0; return false; @@ -84,12 +86,15 @@ bool process_music(uint16_t keycode, keyrecord_t *record) { if (keycode == KC_LALT && record->event.pressed) { // Stop recording/playing stop_all_notes(); + if (music_sequence_recording) { // was recording + music_sequence_recorded = true; + } music_sequence_recording = false; music_sequence_playing = false; return false; } - if (keycode == KC_LGUI && record->event.pressed) { // Start playing + if (keycode == KC_LGUI && record->event.pressed && music_sequence_recorded) { // Start playing stop_all_notes(); music_sequence_recording = false; music_sequence_playing = true; |