|
|
@@ -63,12 +63,18 @@ uint8_t IZ_GetMIDINoteFromName(char* name) { |
|
|
|
void IZ_HandleMIDINoteOnOffEvents(PmEvent e, IZ_MIDIInputState* state, IZ_Action* action) { |
|
|
|
uint32_t message = e.message; |
|
|
|
uint8_t status = message & 0xF0u; |
|
|
|
// uint8_t channel = message & 0x0Fu; |
|
|
|
uint8_t channel = message & 0x0Fu; |
|
|
|
uint8_t data1 = (message >> 8) & 0xFFu; |
|
|
|
// uint8_t data2 = (message >> 16) & 0xFFu; |
|
|
|
|
|
|
|
for (uint8_t i = 0; i < CONTROLS; i += 1) { |
|
|
|
if (data1 == state->config.control_mapping[i]) { |
|
|
|
if ( |
|
|
|
data1 == state->config.control_mapping[i] |
|
|
|
&& ( |
|
|
|
(state->config.channel < 16 && channel == state->config.channel) |
|
|
|
|| state->config.channel >= 16 |
|
|
|
) |
|
|
|
) { |
|
|
|
const uint16_t bitflag = (0x1 << i); |
|
|
|
if (status == IZ_MIDI_NOTE_ON) { |
|
|
|
*action |= bitflag; |
|
|
@@ -108,6 +114,15 @@ IZ_ProcedureResult IZ_SaveMIDIInputConfig(const char* config_path, IZ_MIDIInputS |
|
|
|
} |
|
|
|
|
|
|
|
sprintf_s(main_section_name, 12, "MIDIInput.%d", player_index); |
|
|
|
if (!ini_putl( |
|
|
|
main_section_name, |
|
|
|
"Channel", |
|
|
|
state[player_index]->config.channel, |
|
|
|
config_path |
|
|
|
)) { |
|
|
|
problem |= (1 << player_index); |
|
|
|
} |
|
|
|
|
|
|
|
if (!ini_putl( |
|
|
|
main_section_name, |
|
|
|
"DeviceID", |
|
|
@@ -142,6 +157,7 @@ void IZ_LoadMIDIInputConfig(const char* config_path, IZ_MIDIInputState(* state)[ |
|
|
|
} |
|
|
|
|
|
|
|
sprintf_s(main_section_name, 12, "MIDIInput.%d", player_index); |
|
|
|
state[player_index]->config.channel = ini_getl(main_section_name, "Channel", player_index, config_path); |
|
|
|
state[player_index]->config.device_id = ini_getl(main_section_name, "DeviceID", player_index, config_path); |
|
|
|
} |
|
|
|
} |
|
|
|