From 057ea3107ad97742c7af33bc2a312f1d2e4daa8f Mon Sep 17 00:00:00 2001 From: rhargreaves Date: Sun, 8 Mar 2020 22:21:16 +0000 Subject: [PATCH] Refactor; remove redundant test --- src/midi_psg.c | 3 +-- tests/unit/main.c | 1 - tests/unit/test_midi_psg.c | 17 ----------------- 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/midi_psg.c b/src/midi_psg.c index b591d781..3e258aca 100644 --- a/src/midi_psg.c +++ b/src/midi_psg.c @@ -200,11 +200,10 @@ void midi_psg_noteOn(u8 chan, u8 key, u8 velocity) MidiPsgChannel* psgChan = psgChannel(chan); psgChan->noteReleased = false; psgChan->key = key; - applyFrequency(psgChan, freqForMidiKey(key)); psgChan->velocity = velocity; + psgChan->noteOn = true; initEnvelope(psgChan); applyEnvelopeStep(psgChan); - psgChan->noteOn = true; } void midi_psg_noteOff(u8 chan, u8 pitch) diff --git a/tests/unit/main.c b/tests/unit/main.c index 8649f295..487b017c 100644 --- a/tests/unit/main.c +++ b/tests/unit/main.c @@ -72,7 +72,6 @@ int main(void) midi_test(test_midi_plays_advanced_psg_envelope), midi_test(test_midi_loops_psg_envelope), midi_test(test_midi_psg_envelope_with_only_end_flag_is_silent), - midi_test(test_midi_psg_envelope_with_end_flag_sends_note_off), midi_test( test_midi_psg_envelope_with_loop_end_continues_playing_after_note_off), midi_test( diff --git a/tests/unit/test_midi_psg.c b/tests/unit/test_midi_psg.c index 3e3d0ad8..04c8928c 100644 --- a/tests/unit/test_midi_psg.c +++ b/tests/unit/test_midi_psg.c @@ -270,26 +270,9 @@ static void test_midi_psg_envelope_with_only_end_flag_is_silent( UNUSED void** state) { u8 chan = MIN_PSG_CHAN; - u8 expectedPsgChan = 0; - - __real_midi_program(chan, 5); - - expect_psg_frequency(expectedPsgChan, 262); - __real_midi_noteOn(chan, 60, MAX_MIDI_VOLUME); - __real_midi_psg_tick(); -} - -static void test_midi_psg_envelope_with_end_flag_sends_note_off( - UNUSED void** state) -{ - u8 chan = MIN_PSG_CHAN; - u8 expectedPsgChan = 0; __real_midi_program(chan, 5); - - expect_psg_frequency(expectedPsgChan, 262); __real_midi_noteOn(chan, 60, MAX_MIDI_VOLUME); - __real_midi_psg_tick(); __real_midi_psg_tick(); }