Skip to content

Commit

Permalink
Update naming convention for polyphonic mode CC
Browse files Browse the repository at this point in the history
  • Loading branch information
rhargreaves committed Jun 24, 2024
1 parent a01922d commit 454ebda
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/midi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 11 additions & 11 deletions tests/unit/test_midi_polyphony.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -127,27 +127,27 @@ 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());
}

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++) {
Expand Down

0 comments on commit 454ebda

Please sign in to comment.