process_sequencer.c
2412 bytes
1/* Copyright 2020 Rodolphe Belouin
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "process_sequencer.h"
18
19bool process_sequencer(uint16_t keycode, keyrecord_t *record) {
20 if (record->event.pressed) {
21 switch (keycode) {
22 case QK_SEQUENCER_ON:
23 sequencer_on();
24 return false;
25 case QK_SEQUENCER_OFF:
26 sequencer_off();
27 return false;
28 case QK_SEQUENCER_TOGGLE:
29 sequencer_toggle();
30 return false;
31 case QK_SEQUENCER_TEMPO_DOWN:
32 sequencer_decrease_tempo();
33 return false;
34 case QK_SEQUENCER_TEMPO_UP:
35 sequencer_increase_tempo();
36 return false;
37 case QK_SEQUENCER_RESOLUTION_DOWN:
38 sequencer_decrease_resolution();
39 return false;
40 case QK_SEQUENCER_RESOLUTION_UP:
41 sequencer_increase_resolution();
42 return false;
43 case QK_SEQUENCER_STEPS_ALL:
44 sequencer_set_all_steps_on();
45 return false;
46 case QK_SEQUENCER_STEPS_CLEAR:
47 sequencer_set_all_steps_off();
48 return false;
49 case SEQUENCER_STEP_MIN ... SEQUENCER_STEP_MAX:
50 sequencer_toggle_step(keycode - SEQUENCER_STEP_MIN);
51 return false;
52 case SEQUENCER_RESOLUTION_MIN ... SEQUENCER_RESOLUTION_MAX:
53 sequencer_set_resolution(keycode - SEQUENCER_RESOLUTION_MIN);
54 return false;
55 case SEQUENCER_TRACK_MIN ... SEQUENCER_TRACK_MAX:
56 sequencer_toggle_single_active_track(keycode - SEQUENCER_TRACK_MIN);
57 return false;
58 }
59 }
60
61 return true;
62}