aboutsummaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/process_keycode/process_audio.c4
-rw-r--r--quantum/process_keycode/process_music.c2
-rw-r--r--quantum/process_keycode/process_music.h1
-rw-r--r--quantum/quantum.c4
-rw-r--r--quantum/quantum_keycodes.h28
-rw-r--r--quantum/template/config.h3
6 files changed, 23 insertions, 19 deletions
diff --git a/quantum/process_keycode/process_audio.c b/quantum/process_keycode/process_audio.c
index d45242c9e..71c0297ee 100644
--- a/quantum/process_keycode/process_audio.c
+++ b/quantum/process_keycode/process_audio.c
@@ -1,5 +1,5 @@
1#include "process_audio.h"
2#include "audio.h" 1#include "audio.h"
2#include "process_audio.h"
3 3
4static float compute_freq_for_midi_note(uint8_t note) 4static float compute_freq_for_midi_note(uint8_t note)
5{ 5{
@@ -43,7 +43,7 @@ bool process_audio(uint16_t keycode, keyrecord_t *record) {
43 return false; 43 return false;
44 } 44 }
45 45
46 return true 46 return true;
47} 47}
48 48
49void process_audio_noteon(uint8_t note) { 49void process_audio_noteon(uint8_t note) {
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c
index 43bcf973e..4b86b91f0 100644
--- a/quantum/process_keycode/process_music.c
+++ b/quantum/process_keycode/process_music.c
@@ -42,7 +42,7 @@ static void music_noteoff(uint8_t note) {
42 #endif 42 #endif
43} 43}
44 44
45static void music_all_notes_off(void) { 45void music_all_notes_off(void) {
46 #ifdef AUDIO_ENABLE 46 #ifdef AUDIO_ENABLE
47 process_audio_stop_all_notes(); 47 process_audio_stop_all_notes();
48 #endif 48 #endif
diff --git a/quantum/process_keycode/process_music.h b/quantum/process_keycode/process_music.h
index 69913b276..a36514a44 100644
--- a/quantum/process_keycode/process_music.h
+++ b/quantum/process_keycode/process_music.h
@@ -14,6 +14,7 @@ void music_off(void);
14 14
15void music_on_user(void); 15void music_on_user(void);
16void music_scale_user(void); 16void music_scale_user(void);
17void music_all_notes_off(void);
17 18
18void matrix_scan_music(void); 19void matrix_scan_music(void);
19 20
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 7a27a568a..a4a12061b 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -95,8 +95,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
95 95
96void reset_keyboard(void) { 96void reset_keyboard(void) {
97 clear_keyboard(); 97 clear_keyboard();
98#ifdef AUDIO_ENABLE 98#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_ENABLE_BASIC))
99 stop_all_notes(); 99 music_all_notes_off();
100 shutdown_user(); 100 shutdown_user();
101#endif 101#endif
102 wait_ms(250); 102 wait_ms(250);
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index 3b82b7208..56228f276 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -1,8 +1,11 @@
1
2#ifndef QUANTUM_KEYCODES_H 1#ifndef QUANTUM_KEYCODES_H
3#define QUANTUM_KEYCODES_H 2#define QUANTUM_KEYCODES_H
4 3
5#if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED) 4#ifndef MIDI_ENABLE_STRICT
5#define MIDI_ENABLE_STRICT 0
6#endif
7
8#if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_ADVANCED))
6#ifndef MIDI_TONE_KEYCODE_OCTAVES 9#ifndef MIDI_TONE_KEYCODE_OCTAVES
7#define MIDI_TONE_KEYCODE_OCTAVES 3 10#define MIDI_TONE_KEYCODE_OCTAVES 3
8#endif 11#endif
@@ -113,18 +116,16 @@ enum quantum_keycodes {
113 MUV_IN, 116 MUV_IN,
114 MUV_DE, 117 MUV_DE,
115 118
116#ifdef MIDI_ENABLE
117 // Midi 119 // Midi
118 120#if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
119#ifdef MIDI_BASIC
120 MI_ON, // send midi notes when music mode is enabled 121 MI_ON, // send midi notes when music mode is enabled
121 MI_OFF, // don't send midi notes when music mode is enabled 122 MI_OFF, // don't send midi notes when music mode is enabled
122#endif 123#endif
123 124
124#ifdef MIDI_ADVANCED 125#if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_ADVANCED))
125 MIDI_TONE_MIN, 126 MIDI_TONE_MIN,
126 127
127#if MIDI_TONE_KEYCODE_OCTAVES > 0 128#if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 0
128 MI_C = MIDI_TONE_MIN, 129 MI_C = MIDI_TONE_MIN,
129 MI_Cs, 130 MI_Cs,
130 MI_Db = MI_Cs, 131 MI_Db = MI_Cs,
@@ -144,7 +145,7 @@ enum quantum_keycodes {
144 MI_B, 145 MI_B,
145#endif 146#endif
146 147
147#if MIDI_TONE_KEYCODE_OCTAVES > 1 148#if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 1
148 MI_C_1, 149 MI_C_1,
149 MI_Cs_1, 150 MI_Cs_1,
150 MI_Db_1 = MI_Cs_1, 151 MI_Db_1 = MI_Cs_1,
@@ -164,7 +165,7 @@ enum quantum_keycodes {
164 MI_B_1, 165 MI_B_1,
165#endif 166#endif
166 167
167#if MIDI_TONE_KEYCODE_OCTAVES > 2 168#if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 2
168 MI_C_2, 169 MI_C_2,
169 MI_Cs_2, 170 MI_Cs_2,
170 MI_Db_2 = MI_Cs_2, 171 MI_Db_2 = MI_Cs_2,
@@ -184,7 +185,7 @@ enum quantum_keycodes {
184 MI_B_2, 185 MI_B_2,
185#endif 186#endif
186 187
187#if MIDI_TONE_KEYCODE_OCTAVES > 3 188#if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 3
188 MI_C_3, 189 MI_C_3,
189 MI_Cs_3, 190 MI_Cs_3,
190 MI_Db_3 = MI_Cs_3, 191 MI_Db_3 = MI_Cs_3,
@@ -204,7 +205,7 @@ enum quantum_keycodes {
204 MI_B_3, 205 MI_B_3,
205#endif 206#endif
206 207
207#if MIDI_TONE_KEYCODE_OCTAVES > 4 208#if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 4
208 MI_C_4, 209 MI_C_4,
209 MI_Cs_4, 210 MI_Cs_4,
210 MI_Db_4 = MI_Cs_4, 211 MI_Db_4 = MI_Cs_4,
@@ -224,7 +225,7 @@ enum quantum_keycodes {
224 MI_B_4, 225 MI_B_4,
225#endif 226#endif
226 227
227#if MIDI_TONE_KEYCODE_OCTAVES > 5 228#if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 5
228 MI_C_5, 229 MI_C_5,
229 MI_Cs_5, 230 MI_Cs_5,
230 MI_Db_5 = MI_Cs_5, 231 MI_Db_5 = MI_Cs_5,
@@ -244,7 +245,7 @@ enum quantum_keycodes {
244 MI_B_5, 245 MI_B_5,
245#endif 246#endif
246 247
247#if MIDI_TONE_KEYCODE_OCTAVES > 5 248#if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 5
248 MIDI_TONE_MAX = MI_B_5, 249 MIDI_TONE_MAX = MI_B_5,
249#elif MIDI_TONE_KEYCODE_OCTAVES > 4 250#elif MIDI_TONE_KEYCODE_OCTAVES > 4
250 MIDI_TONE_MAX = MI_B_4, 251 MIDI_TONE_MAX = MI_B_4,
@@ -339,7 +340,6 @@ enum quantum_keycodes {
339 MI_MODSD, // decrease modulation speed 340 MI_MODSD, // decrease modulation speed
340 MI_MODSU, // increase modulation speed 341 MI_MODSU, // increase modulation speed
341#endif // MIDI_ADVANCED 342#endif // MIDI_ADVANCED
342#endif // MIDI_ENABLE
343 343
344 // Backlight functionality 344 // Backlight functionality
345 BL_0, 345 BL_0,
diff --git a/quantum/template/config.h b/quantum/template/config.h
index 54db4f242..7393097e1 100644
--- a/quantum/template/config.h
+++ b/quantum/template/config.h
@@ -163,6 +163,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
163 * MIDI options 163 * MIDI options
164 */ 164 */
165 165
166/* Prevent use of disabled MIDI features in the keymap */
167//#define MIDI_ENABLE_STRICT 1
168
166/* enable basic MIDI features: 169/* enable basic MIDI features:
167 - MIDI notes can be sent when in Music mode is on 170 - MIDI notes can be sent when in Music mode is on
168*/ 171*/