Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue #551 - ensure there's a recording to play before playing #552

Merged
merged 1 commit into from
Jul 25, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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