process_sequencer.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #include "process_sequencer.h"
  17. bool process_sequencer(uint16_t keycode, keyrecord_t *record) {
  18. if (record->event.pressed) {
  19. switch (keycode) {
  20. case SQ_ON:
  21. sequencer_on();
  22. return false;
  23. case SQ_OFF:
  24. sequencer_off();
  25. return false;
  26. case SQ_TOG:
  27. sequencer_toggle();
  28. return false;
  29. case SQ_TMPD:
  30. sequencer_decrease_tempo();
  31. return false;
  32. case SQ_TMPU:
  33. sequencer_increase_tempo();
  34. return false;
  35. case SEQUENCER_RESOLUTION_MIN ... SEQUENCER_RESOLUTION_MAX:
  36. sequencer_set_resolution(keycode - SEQUENCER_RESOLUTION_MIN);
  37. return false;
  38. case SQ_RESD:
  39. sequencer_decrease_resolution();
  40. return false;
  41. case SQ_RESU:
  42. sequencer_increase_resolution();
  43. return false;
  44. case SQ_SALL:
  45. sequencer_set_all_steps_on();
  46. return false;
  47. case SQ_SCLR:
  48. sequencer_set_all_steps_off();
  49. return false;
  50. case SEQUENCER_STEP_MIN ... SEQUENCER_STEP_MAX:
  51. sequencer_toggle_step(keycode - SEQUENCER_STEP_MIN);
  52. return false;
  53. case SEQUENCER_TRACK_MIN ... SEQUENCER_TRACK_MAX:
  54. sequencer_toggle_single_active_track(keycode - SEQUENCER_TRACK_MIN);
  55. return false;
  56. }
  57. }
  58. return true;
  59. }