Skip to content

Commit

Permalink
Merge pull request #552 from robertdale/music-play-fix
Browse files Browse the repository at this point in the history
Fixes issue #551 - ensure there's a recording to play before playing
  • Loading branch information
jackhumbert authored Jul 25, 2016
2 parents 41f15d8 + 3ea738e commit 24bd931
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion quantum/process_keycode/process_music.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -77,19 +78,23 @@ 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;
}

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;
Expand Down

0 comments on commit 24bd931

Please sign in to comment.