1
0
Fork 0

Update existing keymaps

Update existing keymaps to enable MIDI_BASIC functionality.  Also added
an option MIDI_ENABLE_STRICT to be strict about keycode use (which also
reduces memory footprint at runtime)
This commit is contained in:
Gabriel Young 2017-02-25 20:41:13 -08:00
parent ea14ed122f
commit a64ae10662
23 changed files with 472 additions and 19 deletions

View file

@ -0,0 +1,29 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif

View file

@ -0,0 +1,29 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif

View file

@ -14,4 +14,27 @@
#define RGBLIGHT_HUE_STEP 10 #define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17 #define RGBLIGHT_SAT_STEP 17
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif #endif

View file

@ -0,0 +1,29 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif

View file

@ -0,0 +1,29 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif

View file

@ -6,4 +6,27 @@
#define FORCE_NKRO #define FORCE_NKRO
#define WORKMAN_SOUND COLEMAK_SOUND #define WORKMAN_SOUND COLEMAK_SOUND
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif #endif

View file

@ -0,0 +1,29 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif

View file

@ -0,0 +1,29 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif

View file

@ -0,0 +1,29 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif

View file

@ -20,4 +20,27 @@
sei(); \ sei(); \
} while(0) } while(0)
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif #endif

View file

@ -0,0 +1,29 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif

View file

@ -0,0 +1,29 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif

View file

@ -0,0 +1,29 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif

View file

@ -0,0 +1,29 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif

View file

@ -0,0 +1,29 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif

View file

@ -7,6 +7,9 @@
* MIDI options * MIDI options
*/ */
/* Prevent use of disabled MIDI features in the keymap */
#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features: /* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on - MIDI notes can be sent when in Music mode is on
*/ */

View file

@ -0,0 +1,29 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif

View file

@ -1,5 +1,5 @@
#include "process_audio.h"
#include "audio.h" #include "audio.h"
#include "process_audio.h"
static float compute_freq_for_midi_note(uint8_t note) static float compute_freq_for_midi_note(uint8_t note)
{ {
@ -43,7 +43,7 @@ bool process_audio(uint16_t keycode, keyrecord_t *record) {
return false; return false;
} }
return true return true;
} }
void process_audio_noteon(uint8_t note) { void process_audio_noteon(uint8_t note) {

View file

@ -42,7 +42,7 @@ static void music_noteoff(uint8_t note) {
#endif #endif
} }
static void music_all_notes_off(void) { void music_all_notes_off(void) {
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
process_audio_stop_all_notes(); process_audio_stop_all_notes();
#endif #endif

View file

@ -14,6 +14,7 @@ void music_off(void);
void music_on_user(void); void music_on_user(void);
void music_scale_user(void); void music_scale_user(void);
void music_all_notes_off(void);
void matrix_scan_music(void); void matrix_scan_music(void);

View file

@ -95,8 +95,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
void reset_keyboard(void) { void reset_keyboard(void) {
clear_keyboard(); clear_keyboard();
#ifdef AUDIO_ENABLE #if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_ENABLE_BASIC))
stop_all_notes(); music_all_notes_off();
shutdown_user(); shutdown_user();
#endif #endif
wait_ms(250); wait_ms(250);

View file

@ -1,8 +1,11 @@
#ifndef QUANTUM_KEYCODES_H #ifndef QUANTUM_KEYCODES_H
#define QUANTUM_KEYCODES_H #define QUANTUM_KEYCODES_H
#if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED) #ifndef MIDI_ENABLE_STRICT
#define MIDI_ENABLE_STRICT 0
#endif
#if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_ADVANCED))
#ifndef MIDI_TONE_KEYCODE_OCTAVES #ifndef MIDI_TONE_KEYCODE_OCTAVES
#define MIDI_TONE_KEYCODE_OCTAVES 3 #define MIDI_TONE_KEYCODE_OCTAVES 3
#endif #endif
@ -113,18 +116,16 @@ enum quantum_keycodes {
MUV_IN, MUV_IN,
MUV_DE, MUV_DE,
#ifdef MIDI_ENABLE
// Midi // Midi
#if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
#ifdef MIDI_BASIC
MI_ON, // send midi notes when music mode is enabled MI_ON, // send midi notes when music mode is enabled
MI_OFF, // don't send midi notes when music mode is enabled MI_OFF, // don't send midi notes when music mode is enabled
#endif #endif
#ifdef MIDI_ADVANCED #if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_ADVANCED))
MIDI_TONE_MIN, MIDI_TONE_MIN,
#if MIDI_TONE_KEYCODE_OCTAVES > 0 #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 0
MI_C = MIDI_TONE_MIN, MI_C = MIDI_TONE_MIN,
MI_Cs, MI_Cs,
MI_Db = MI_Cs, MI_Db = MI_Cs,
@ -144,7 +145,7 @@ enum quantum_keycodes {
MI_B, MI_B,
#endif #endif
#if MIDI_TONE_KEYCODE_OCTAVES > 1 #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 1
MI_C_1, MI_C_1,
MI_Cs_1, MI_Cs_1,
MI_Db_1 = MI_Cs_1, MI_Db_1 = MI_Cs_1,
@ -164,7 +165,7 @@ enum quantum_keycodes {
MI_B_1, MI_B_1,
#endif #endif
#if MIDI_TONE_KEYCODE_OCTAVES > 2 #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 2
MI_C_2, MI_C_2,
MI_Cs_2, MI_Cs_2,
MI_Db_2 = MI_Cs_2, MI_Db_2 = MI_Cs_2,
@ -184,7 +185,7 @@ enum quantum_keycodes {
MI_B_2, MI_B_2,
#endif #endif
#if MIDI_TONE_KEYCODE_OCTAVES > 3 #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 3
MI_C_3, MI_C_3,
MI_Cs_3, MI_Cs_3,
MI_Db_3 = MI_Cs_3, MI_Db_3 = MI_Cs_3,
@ -204,7 +205,7 @@ enum quantum_keycodes {
MI_B_3, MI_B_3,
#endif #endif
#if MIDI_TONE_KEYCODE_OCTAVES > 4 #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 4
MI_C_4, MI_C_4,
MI_Cs_4, MI_Cs_4,
MI_Db_4 = MI_Cs_4, MI_Db_4 = MI_Cs_4,
@ -224,7 +225,7 @@ enum quantum_keycodes {
MI_B_4, MI_B_4,
#endif #endif
#if MIDI_TONE_KEYCODE_OCTAVES > 5 #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 5
MI_C_5, MI_C_5,
MI_Cs_5, MI_Cs_5,
MI_Db_5 = MI_Cs_5, MI_Db_5 = MI_Cs_5,
@ -244,7 +245,7 @@ enum quantum_keycodes {
MI_B_5, MI_B_5,
#endif #endif
#if MIDI_TONE_KEYCODE_OCTAVES > 5 #if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 5
MIDI_TONE_MAX = MI_B_5, MIDI_TONE_MAX = MI_B_5,
#elif MIDI_TONE_KEYCODE_OCTAVES > 4 #elif MIDI_TONE_KEYCODE_OCTAVES > 4
MIDI_TONE_MAX = MI_B_4, MIDI_TONE_MAX = MI_B_4,
@ -339,7 +340,6 @@ enum quantum_keycodes {
MI_MODSD, // decrease modulation speed MI_MODSD, // decrease modulation speed
MI_MODSU, // increase modulation speed MI_MODSU, // increase modulation speed
#endif // MIDI_ADVANCED #endif // MIDI_ADVANCED
#endif // MIDI_ENABLE
// Backlight functionality // Backlight functionality
BL_0, BL_0,

View file

@ -163,6 +163,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* MIDI options * MIDI options
*/ */
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features: /* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on - MIDI notes can be sent when in Music mode is on
*/ */