qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

process_music.h (3231B)


      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 
     17 #pragma once
     18 
     19 #include <stdint.h>
     20 #include <stdbool.h>
     21 #include "action.h"
     22 
     23 #if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
     24 
     25 enum music_modes { MUSIC_MODE_CHROMATIC, MUSIC_MODE_GUITAR, MUSIC_MODE_VIOLIN, MUSIC_MODE_MAJOR, NUMBER_OF_MODES };
     26 
     27 #    ifdef MUSIC_MAP
     28 extern const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS];
     29 #    endif
     30 
     31 bool process_music(uint16_t keycode, keyrecord_t *record);
     32 
     33 bool is_music_on(void);
     34 void music_toggle(void);
     35 void music_on(void);
     36 void music_off(void);
     37 
     38 bool is_midi_on(void);
     39 void midi_toggle(void);
     40 void midi_on(void);
     41 void midi_off(void);
     42 
     43 void music_on_user(void);
     44 void midi_on_user(void);
     45 void music_scale_user(void);
     46 void music_all_notes_off(void);
     47 void music_mode_cycle(void);
     48 
     49 void music_task(void);
     50 
     51 bool music_mask(uint16_t keycode);
     52 bool music_mask_kb(uint16_t keycode);
     53 bool music_mask_user(uint16_t keycode);
     54 
     55 #    ifndef SCALE
     56 #        define SCALE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          \
     57             (int8_t[]) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       \
     58                 0 + (12 * 0), 2 + (12 * 0), 4 + (12 * 0), 5 + (12 * 0), 7 + (12 * 0), 9 + (12 * 0), 11 + (12 * 0), 0 + (12 * 1), 2 + (12 * 1), 4 + (12 * 1), 5 + (12 * 1), 7 + (12 * 1), 9 + (12 * 1), 11 + (12 * 1), 0 + (12 * 2), 2 + (12 * 2), 4 + (12 * 2), 5 + (12 * 2), 7 + (12 * 2), 9 + (12 * 2), 11 + (12 * 2), 0 + (12 * 3), 2 + (12 * 3), 4 + (12 * 3), 5 + (12 * 3), 7 + (12 * 3), 9 + (12 * 3), 11 + (12 * 3), 0 + (12 * 4), 2 + (12 * 4), 4 + (12 * 4), 5 + (12 * 4), 7 + (12 * 4), 9 + (12 * 4), 11 + (12 * 4), \
     59             }
     60 #    endif
     61 
     62 #endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))