process_midi.h 843 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef PROCESS_MIDI_H
  2. #define PROCESS_MIDI_H
  3. #include "quantum.h"
  4. #ifdef MIDI_ENABLE
  5. #ifdef MIDI_BASIC
  6. void process_midi_basic_noteon(uint8_t note);
  7. void process_midi_basic_noteoff(uint8_t note);
  8. void process_midi_basic_stop_all_notes(void);
  9. #endif
  10. #ifdef MIDI_ADVANCED
  11. typedef union {
  12. uint32_t raw;
  13. struct {
  14. uint8_t octave :4;
  15. int8_t transpose :4;
  16. uint8_t velocity :4;
  17. uint8_t channel :4;
  18. uint8_t modulation_interval :4;
  19. };
  20. } midi_config_t;
  21. midi_config_t midi_config;
  22. void midi_init(void);
  23. void midi_task(void);
  24. bool process_midi(uint16_t keycode, keyrecord_t *record);
  25. #define MIDI_INVALID_NOTE 0xFF
  26. #define MIDI_TONE_COUNT (MIDI_TONE_MAX - MIDI_TONE_MIN + 1)
  27. uint8_t midi_compute_note(uint16_t keycode);
  28. #endif // MIDI_ADVANCED
  29. #endif // MIDI_ENABLE
  30. #endif