diff options
Diffstat (limited to 'quantum/process_keycode/process_music.c')
-rw-r--r-- | quantum/process_keycode/process_music.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c index 742bb08b1..697aa237f 100644 --- a/quantum/process_keycode/process_music.c +++ b/quantum/process_keycode/process_music.c | |||
@@ -197,17 +197,26 @@ bool process_music(uint16_t keycode, keyrecord_t *record) { | |||
197 | } | 197 | } |
198 | } | 198 | } |
199 | 199 | ||
200 | uint8_t note; | 200 | uint8_t note = 36; |
201 | if (music_mode == MUSIC_MODE_CHROMATIC) | 201 | #ifdef MUSIC_MAP |
202 | note = (music_starting_note + record->event.key.col + music_offset - 3)+12*(MATRIX_ROWS - record->event.key.row); | 202 | if (music_mode == MUSIC_MODE_CHROMATIC) { |
203 | else if (music_mode == MUSIC_MODE_GUITAR) | 203 | note = music_starting_note + music_offset + 36 + music_map[record->event.key.row][record->event.key.col]; |
204 | note = (music_starting_note + record->event.key.col + music_offset + 32)+5*(MATRIX_ROWS - record->event.key.row); | 204 | } else { |
205 | else if (music_mode == MUSIC_MODE_VIOLIN) | 205 | uint8_t position = music_map[record->event.key.row][record->event.key.col]; |
206 | note = (music_starting_note + record->event.key.col + music_offset + 32)+7*(MATRIX_ROWS - record->event.key.row); | 206 | note = music_starting_note + music_offset + 36 + SCALE[position % 12] + (position / 12)*12; |
207 | else if (music_mode == MUSIC_MODE_MAJOR) | 207 | } |
208 | note = (music_starting_note + SCALE[record->event.key.col + music_offset] - 3)+12*(MATRIX_ROWS - record->event.key.row); | 208 | #else |
209 | else | 209 | if (music_mode == MUSIC_MODE_CHROMATIC) |
210 | note = music_starting_note; | 210 | note = (music_starting_note + record->event.key.col + music_offset - 3)+12*(MATRIX_ROWS - record->event.key.row); |
211 | else if (music_mode == MUSIC_MODE_GUITAR) | ||
212 | note = (music_starting_note + record->event.key.col + music_offset + 32)+5*(MATRIX_ROWS - record->event.key.row); | ||
213 | else if (music_mode == MUSIC_MODE_VIOLIN) | ||
214 | note = (music_starting_note + record->event.key.col + music_offset + 32)+7*(MATRIX_ROWS - record->event.key.row); | ||
215 | else if (music_mode == MUSIC_MODE_MAJOR) | ||
216 | note = (music_starting_note + SCALE[record->event.key.col + music_offset] - 3)+12*(MATRIX_ROWS - record->event.key.row); | ||
217 | else | ||
218 | note = music_starting_note; | ||
219 | #endif | ||
211 | 220 | ||
212 | if (record->event.pressed) { | 221 | if (record->event.pressed) { |
213 | music_noteon(note); | 222 | music_noteon(note); |