logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

process_midi.h (1576B)


  1. /* Copyright 2016 Jack Humbert
  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. #pragma once
  17. #include <stdint.h>
  18. #include <stdbool.h>
  19. #include "action.h"
  20. #include "quantum_keycodes.h"
  21. #ifdef MIDI_ENABLE
  22. # ifdef MIDI_BASIC
  23. void process_midi_basic_noteon(uint8_t note);
  24. void process_midi_basic_noteoff(uint8_t note);
  25. void process_midi_all_notes_off(void);
  26. # endif
  27. void midi_task(void);
  28. # ifdef MIDI_ADVANCED
  29. typedef union {
  30. uint32_t raw;
  31. struct {
  32. uint8_t octave : 4;
  33. int8_t transpose : 4;
  34. uint8_t velocity : 7;
  35. uint8_t channel : 4;
  36. uint8_t modulation_interval : 4;
  37. };
  38. } midi_config_t;
  39. extern midi_config_t midi_config;
  40. void midi_init(void);
  41. bool process_midi(uint16_t keycode, keyrecord_t *record);
  42. # define MIDI_INVALID_NOTE 0xFF
  43. # define MIDI_TONE_COUNT (MIDI_TONE_MAX - MIDI_TONE_MIN + 1)
  44. uint8_t midi_compute_note(uint16_t keycode);
  45. # endif // MIDI_ADVANCED
  46. #endif // MIDI_ENABLE