From 454ebdafdfc4434e12bdde2e065827d11a9bc35f Mon Sep 17 00:00:00 2001 From: Robert Hargreaves Date: Mon, 24 Jun 2024 18:47:22 +0100 Subject: [PATCH] Update naming convention for polyphonic mode CC --- src/midi.c | 2 +- src/midi.h | 2 +- tests/unit/test_midi.c | 4 ++-- tests/unit/test_midi_polyphony.c | 22 +++++++++++----------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/midi.c b/src/midi.c index 8c22825..3173403 100644 --- a/src/midi.c +++ b/src/midi.c @@ -822,7 +822,7 @@ void midi_cc(u8 chan, u8 controller, u8 value) case CC_ALL_SOUND_OFF: allNotesOff(chan); break; - case CC_POLYPHONIC_MODE: + case CC_GENMDM_POLYPHONIC_MODE: setPolyphonicMode(RANGE(value, 2) != 0); break; case CC_GENMDM_CH3_SPECIAL_MODE: diff --git a/src/midi.h b/src/midi.h index cb9cd9d..987b6ba 100644 --- a/src/midi.h +++ b/src/midi.h @@ -77,7 +77,7 @@ #define CC_GENMDM_AMS 76 #define CC_GENMDM_STEREO 77 #define CC_GENMDM_CH3_SPECIAL_MODE 80 -#define CC_POLYPHONIC_MODE 84 +#define CC_GENMDM_POLYPHONIC_MODE 84 #define CC_DEVICE_SELECT 86 #define CC_SHOW_PARAMETERS_ON_UI 83 #define CC_GENMDM_SSG_EG_OP1 90 diff --git a/tests/unit/test_midi.c b/tests/unit/test_midi.c index c2c3183..9a53b3a 100644 --- a/tests/unit/test_midi.c +++ b/tests/unit/test_midi.c @@ -76,11 +76,11 @@ int test_midi_setup(UNUSED void** state) void test_midi_polyphonic_mode_returns_state(UNUSED void** state) { - __real_midi_cc(0, CC_POLYPHONIC_MODE, 127); + __real_midi_cc(0, CC_GENMDM_POLYPHONIC_MODE, 127); assert_true(__real_midi_dynamic_mode()); - __real_midi_cc(0, CC_POLYPHONIC_MODE, 0); + __real_midi_cc(0, CC_GENMDM_POLYPHONIC_MODE, 0); } void test_midi_sets_all_notes_off(UNUSED void** state) diff --git a/tests/unit/test_midi_polyphony.c b/tests/unit/test_midi_polyphony.c index 5ace48f..7ca5cd1 100644 --- a/tests/unit/test_midi_polyphony.c +++ b/tests/unit/test_midi_polyphony.c @@ -3,7 +3,7 @@ static void test_midi_polyphonic_mode_sends_CCs_to_all_FM_channels( UNUSED void** state) { - __real_midi_cc(0, CC_POLYPHONIC_MODE, 127); + __real_midi_cc(0, CC_GENMDM_POLYPHONIC_MODE, 127); for (int chan = 0; chan <= MAX_FM_CHAN; chan++) { expect_synth_pitch_any(); @@ -23,7 +23,7 @@ static void test_midi_polyphonic_mode_sends_CCs_to_all_FM_channels( static void test_midi_set_overflow_flag_on_polyphony_breach(UNUSED void** state) { wraps_enable_logging_checks(); - __real_midi_cc(0, CC_POLYPHONIC_MODE, 127); + __real_midi_cc(0, CC_GENMDM_POLYPHONIC_MODE, 127); for (int chan = 0; chan <= MAX_FM_CHAN; chan++) { expect_synth_pitch(chan, 6, SYNTH_NTSC_AS); @@ -44,7 +44,7 @@ static void test_midi_set_overflow_flag_on_polyphony_breach(UNUSED void** state) static void test_midi_polyphonic_mode_uses_multiple_fm_channels( UNUSED void** state) { - __real_midi_cc(0, CC_POLYPHONIC_MODE, 127); + __real_midi_cc(0, CC_GENMDM_POLYPHONIC_MODE, 127); for (int chan = 0; chan <= MAX_FM_CHAN; chan++) { expect_synth_pitch(0, 6, SYNTH_NTSC_AS); @@ -68,13 +68,13 @@ static void test_midi_polyphonic_mode_uses_multiple_fm_channels( __real_midi_note_off(chan, MIDI_PITCH_B6); } - __real_midi_cc(0, CC_POLYPHONIC_MODE, 0); + __real_midi_cc(0, CC_GENMDM_POLYPHONIC_MODE, 0); } static void test_midi_polyphonic_mode_note_off_silences_all_matching_pitch( UNUSED void** state) { - __real_midi_cc(0, CC_POLYPHONIC_MODE, 127); + __real_midi_cc(0, CC_GENMDM_POLYPHONIC_MODE, 127); for (int chan = 0; chan <= MAX_FM_CHAN; chan++) { expect_synth_pitch(0, 6, SYNTH_NTSC_AS); @@ -95,12 +95,12 @@ static void test_midi_polyphonic_mode_note_off_silences_all_matching_pitch( __real_midi_note_off(chan, MIDI_PITCH_AS6); } - __real_midi_cc(0, CC_POLYPHONIC_MODE, 0); + __real_midi_cc(0, CC_GENMDM_POLYPHONIC_MODE, 0); } static void test_midi_sets_all_notes_off_in_polyphonic_mode(UNUSED void** state) { - __real_midi_cc(0, CC_POLYPHONIC_MODE, 64); + __real_midi_cc(0, CC_GENMDM_POLYPHONIC_MODE, 64); expect_value(__wrap_synth_pitch, channel, 0); expect_any(__wrap_synth_pitch, octave); @@ -127,19 +127,19 @@ static void test_midi_sets_all_notes_off_in_polyphonic_mode(UNUSED void** state) __real_midi_cc(0, CC_ALL_NOTES_OFF, 0); - __real_midi_cc(0, CC_POLYPHONIC_MODE, 0); + __real_midi_cc(0, CC_GENMDM_POLYPHONIC_MODE, 0); } static void test_midi_sets_polyphonic_mode(UNUSED void** state) { - __real_midi_cc(0, CC_POLYPHONIC_MODE, 64); + __real_midi_cc(0, CC_GENMDM_POLYPHONIC_MODE, 64); assert_true(__real_midi_dynamic_mode()); } static void test_midi_unsets_polyphonic_mode(UNUSED void** state) { - __real_midi_cc(0, CC_POLYPHONIC_MODE, 0); + __real_midi_cc(0, CC_GENMDM_POLYPHONIC_MODE, 0); assert_false(__real_midi_dynamic_mode()); } @@ -147,7 +147,7 @@ static void test_midi_unsets_polyphonic_mode(UNUSED void** state) static void test_midi_sets_all_channel_mappings_when_setting_polyphonic_mode( UNUSED void** state) { - __real_midi_cc(0, CC_POLYPHONIC_MODE, 64); + __real_midi_cc(0, CC_GENMDM_POLYPHONIC_MODE, 64); DeviceChannel* mappings = __real_midi_channel_mappings(); for (u8 i = 0; i <= DEV_CHAN_MAX_FM; i++) {