Skip to content

Commit c4d3154

Browse files
committed
refactor: remove unused synth/psg busy code which used to power LEDs
1 parent c08689e commit c4d3154

File tree

10 files changed

+0
-54
lines changed

10 files changed

+0
-54
lines changed

src/midi_psg.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ typedef struct MidiPsgChannel {
4848
static u8 userDefinedEnvelope[256];
4949
static u8* userDefinedEnvelopePtr;
5050
static const u8** envelopes;
51-
static u8 audible;
5251
static MidiPsgChannel psgChannels[MAX_PSG_CHANS];
5352

5453
static u16 tone_for_midi_key(u8 midiKey);
@@ -182,11 +181,6 @@ static void apply_attenuation(MidiPsgChannel* psgChan, u8 newAtt)
182181
{
183182
if (newAtt != psgChan->attenuation) {
184183
PSG_setEnvelope(psgChan->chanNum, newAtt);
185-
if (newAtt == PSG_ATTENUATION_SILENCE) {
186-
CLEAR_BIT(audible, psgChan->chanNum);
187-
} else {
188-
SET_BIT(audible, psgChan->chanNum);
189-
}
190184
psgChan->attenuation = newAtt;
191185
}
192186
}
@@ -316,11 +310,6 @@ static MidiPsgChannel* psg_channel(u8 chan)
316310
return &psgChannels[chan];
317311
}
318312

319-
u8 midi_psg_busy(void)
320-
{
321-
return audible;
322-
}
323-
324313
void midi_psg_pitch(u8 chan, u8 pitch, s8 cents)
325314
{
326315
MidiPsgChannel* psgChan = psg_channel(chan);

src/midi_psg.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,4 @@ void midi_psg_program(u8 chan, u8 program);
2424
void midi_psg_pan(u8 chan, u8 pan);
2525
void midi_psg_tick(u16 delta);
2626
void midi_psg_load_envelope(const u8* eef);
27-
u8 midi_psg_busy(void);
2827
void midi_psg_pitch(u8 chan, u8 pitch, s8 cents);

src/synth.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
static Global global;
66
static FmChannel fmChannels[MAX_FM_CHANS];
7-
static u8 noteOn;
87
static u8 volumes[MAX_FM_CHANS];
98

109
static ParameterUpdatedCallback* parameterUpdatedCallback = NULL;
@@ -105,13 +104,11 @@ static void init_global(void)
105104
void synth_note_on(u8 channel)
106105
{
107106
write_reg_safe(0, YM_KEY_ON_OFF, 0xF0 + key_on_off_reg_offset(channel));
108-
SET_BIT(noteOn, channel);
109107
}
110108

111109
void synth_note_off(u8 channel)
112110
{
113111
write_reg_safe(0, YM_KEY_ON_OFF, key_on_off_reg_offset(channel));
114-
CLEAR_BIT(noteOn, channel);
115112
}
116113

117114
void synth_pitch(u8 channel, u8 octave, u16 freqNumber)
@@ -263,11 +260,6 @@ void synth_fms(u8 channel, u8 fms)
263260
channel_parameter_updated(channel);
264261
}
265262

266-
u8 synth_busy(void)
267-
{
268-
return noteOn;
269-
}
270-
271263
void synth_preset(u8 channel, const FmPreset* preset)
272264
{
273265
FmChannel* chan = &fmChannels[channel];

src/synth.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ void synth_enable_lfo(u8 enable);
7878
void synth_global_lfo_frequency(u8 freq);
7979
void synth_ams(u8 channel, u8 ams);
8080
void synth_fms(u8 channel, u8 fms);
81-
u8 synth_busy(void);
8281
void synth_preset(u8 channel, const FmPreset* preset);
8382
const FmChannel* synth_channel_parameters(u8 channel);
8483
void synth_extract_preset(u8 channel, FmPreset* preset);

src/utils.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#pragma once
22
#include "genesis.h"
33

4-
#define SET_BIT(var, pos) var |= 1 << pos;
5-
#define CLEAR_BIT(var, pos) var &= ~(1 << pos);
64
#define CHECK_BIT(var, pos) ((var) & (1 << (pos)))
75
#define LENGTH_OF(array) (sizeof(array) / sizeof(array[0]))
86

tests/unit/main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ int main(void)
104104
midi_test(test_midi_shifts_semitone_in_psg_envelope),
105105
midi_test(test_midi_pitch_shift_handles_upper_limit_psg_envelope),
106106
midi_test(test_midi_pitch_shift_handles_lower_limit_psg_envelope),
107-
midi_test(test_midi_psg_sets_busy_indicators),
108107
midi_test(test_midi_channel_volume_sets_volume),
109108
midi_test(test_midi_pan_sets_synth_stereo_mode_right),
110109
midi_test(test_midi_pan_sets_synth_stereo_mode_left),
@@ -262,7 +261,6 @@ int main(void)
262261
test_synth_sets_operator_amplitude_modulation_and_decay_rate),
263262
synth_test(test_synth_sets_operator_ssg_eg),
264263
synth_test(test_synth_sets_global_LFO_enable_and_frequency),
265-
synth_test(test_synth_sets_busy_indicators),
266264
synth_test(test_synth_sets_preset),
267265
synth_test(test_synth_sets_preset_retaining_pan),
268266
synth_test(

tests/unit/test_midi_psg.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -412,23 +412,6 @@ void test_midi_loads_psg_envelope(UNUSED void** state)
412412
__real_midi_psg_tick();
413413
}
414414

415-
void test_midi_psg_sets_busy_indicators(UNUSED void** state)
416-
{
417-
for (u8 chan = 0; chan < MAX_PSG_CHANS; chan++) {
418-
expect_psg_tone(chan, TONE_NTSC_C4);
419-
expect_psg_attenuation(chan, PSG_ATTENUATION_LOUDEST);
420-
__real_midi_note_on(chan + MIN_PSG_CHAN, MIDI_PITCH_C4, MAX_MIDI_VOLUME);
421-
}
422-
423-
for (u8 chan = 0; chan < MAX_PSG_CHANS; chan += 2) {
424-
expect_psg_attenuation(chan, PSG_ATTENUATION_SILENCE);
425-
__real_midi_note_off(chan + MIN_PSG_CHAN, MIDI_PITCH_C4);
426-
}
427-
428-
u8 busy = midi_psg_busy();
429-
assert_int_equal(busy, 0b1010);
430-
}
431-
432415
void test_midi_psg_supports_extreme_pitch_bend_sensitivity(UNUSED void** state)
433416
{
434417
expect_psg_tone(PSG_CH1, TONE_NTSC_C4);

tests/unit/test_midi_psg.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,4 @@ void test_midi_shifts_semitone_in_psg_envelope(UNUSED void** state);
2626
void test_midi_pitch_shift_handles_upper_limit_psg_envelope(UNUSED void** state);
2727
void test_midi_pitch_shift_handles_lower_limit_psg_envelope(UNUSED void** state);
2828
void test_midi_loads_psg_envelope(UNUSED void** state);
29-
void test_midi_psg_sets_busy_indicators(UNUSED void** state);
3029
void test_midi_psg_supports_extreme_pitch_bend_sensitivity(UNUSED void** state);

tests/unit/test_synth.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -509,16 +509,6 @@ void test_synth_sets_global_LFO_enable_and_frequency(UNUSED void** state)
509509
__real_synth_global_lfo_frequency(1);
510510
}
511511

512-
void test_synth_sets_busy_indicators(UNUSED void** state)
513-
{
514-
for (u8 chan = 0; chan < MAX_FM_CHANS; chan += 2) {
515-
expect_ym2612_write_reg_any_data(0, YM_KEY_ON_OFF);
516-
__real_synth_note_on(chan);
517-
}
518-
u8 busy = synth_busy();
519-
assert_int_equal(busy, 0b00010101);
520-
}
521-
522512
void test_synth_sets_preset(UNUSED void** state)
523513
{
524514
const u8 chan = 0;

tests/unit/test_synth.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ void test_synth_sets_operator_release_rate_and_sustain_level(UNUSED void** state
2222
void test_synth_sets_operator_amplitude_modulation_and_decay_rate(UNUSED void** state);
2323
void test_synth_sets_operator_ssg_eg(UNUSED void** state);
2424
void test_synth_sets_global_LFO_enable_and_frequency(UNUSED void** state);
25-
void test_synth_sets_busy_indicators(UNUSED void** state);
2625
void test_synth_sets_preset(UNUSED void** state);
2726
void test_synth_sets_preset_retaining_pan(UNUSED void** state);
2827
void test_synth_applies_volume_modifier_to_output_operators_algorithm_7(UNUSED void** state);

0 commit comments

Comments
 (0)