music map init, dip scan added
This commit is contained in:
parent
12a64ff24b
commit
91efe74365
10 changed files with 97 additions and 49 deletions
|
@ -28,7 +28,7 @@ bool music_activated = false;
|
|||
bool midi_activated = false;
|
||||
uint8_t music_starting_note = 0x0C;
|
||||
int music_offset = 7;
|
||||
uint8_t music_mode = MUSIC_MODE_CHROMATIC;
|
||||
uint8_t music_mode = MUSIC_MODE_MAJOR;
|
||||
|
||||
// music sequencer
|
||||
static bool music_sequence_recording = false;
|
||||
|
@ -201,17 +201,26 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t note;
|
||||
if (music_mode == MUSIC_MODE_CHROMATIC)
|
||||
note = (music_starting_note + record->event.key.col + music_offset - 3)+12*(MATRIX_ROWS - record->event.key.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);
|
||||
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);
|
||||
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);
|
||||
else
|
||||
note = music_starting_note;
|
||||
uint8_t note = 36;
|
||||
#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];
|
||||
} else {
|
||||
uint8_t position = music_map[record->event.key.row][record->event.key.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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
else
|
||||
note = music_starting_note;
|
||||
#endif
|
||||
|
||||
if (record->event.pressed) {
|
||||
music_noteon(note);
|
||||
|
|
|
@ -29,6 +29,11 @@ enum music_modes {
|
|||
NUMBER_OF_MODES
|
||||
};
|
||||
|
||||
|
||||
#ifdef MUSIC_MAP
|
||||
extern const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS];
|
||||
#endif
|
||||
|
||||
bool process_music(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
bool is_music_on(void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue