Add a keymatrix_t type
This contains both the matrix number and key position, in preparation for multi-matrix support
This commit is contained in:
parent
c11c7948e6
commit
f9c61b1bbe
14 changed files with 59 additions and 49 deletions
|
@ -198,22 +198,23 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
|
||||
uint8_t note = 36;
|
||||
// Note: Multimatrix support is missing from this (it's probablly better to define it using keycodes)
|
||||
#ifdef MUSIC_MAP
|
||||
if (music_mode == MUSIC_MODE_CHROMATIC) {
|
||||
note = music_starting_note + music_offset + 36 + music_map[record->event.key.row][record->event.key.col];
|
||||
note = music_starting_note + music_offset + 36 + music_map[record->event.key.pos.row][record->event.key.pos.col];
|
||||
} else {
|
||||
uint8_t position = music_map[record->event.key.row][record->event.key.col];
|
||||
uint8_t position = music_map[record->event.key.pos.row][record->event.key.pos.col];
|
||||
note = music_starting_note + music_offset + 36 + SCALE[position % 12] + (position / 12)*12;
|
||||
}
|
||||
#else
|
||||
if (music_mode == MUSIC_MODE_CHROMATIC)
|
||||
note = (music_starting_note + record->event.key.col + music_offset - 3)+12*(MATRIX_ROWS - record->event.key.row);
|
||||
note = (music_starting_note + record->event.key.pos.col + music_offset - 3)+12*(MATRIX_ROWS - record->event.key.pos.row);
|
||||
else if (music_mode == MUSIC_MODE_GUITAR)
|
||||
note = (music_starting_note + record->event.key.col + music_offset + 32)+5*(MATRIX_ROWS - record->event.key.row);
|
||||
note = (music_starting_note + record->event.key.pos.col + music_offset + 32)+5*(MATRIX_ROWS - record->event.key.pos.row);
|
||||
else if (music_mode == MUSIC_MODE_VIOLIN)
|
||||
note = (music_starting_note + record->event.key.col + music_offset + 32)+7*(MATRIX_ROWS - record->event.key.row);
|
||||
note = (music_starting_note + record->event.key.pos.col + music_offset + 32)+7*(MATRIX_ROWS - record->event.key.pos.row);
|
||||
else if (music_mode == MUSIC_MODE_MAJOR)
|
||||
note = (music_starting_note + SCALE[record->event.key.col + music_offset] - 3)+12*(MATRIX_ROWS - record->event.key.row);
|
||||
note = (music_starting_note + SCALE[record->event.key.pos.col + music_offset] - 3)+12*(MATRIX_ROWS - record->event.key.pos.row);
|
||||
else
|
||||
note = music_starting_note;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue