Skip to content

Commit

Permalink
Remove synth_totalLevel()
Browse files Browse the repository at this point in the history
  • Loading branch information
rhargreaves committed Sep 7, 2019
1 parent 1e2c884 commit 583574d
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 88 deletions.
27 changes: 0 additions & 27 deletions src/synth.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,33 +102,6 @@ void synth_pitch(u8 channel, u8 octave, u16 freqNumber)
updateOctaveAndFrequency(channel);
}

void synth_totalLevel(u8 channel, u8 totalLevel)
{
const u8 REG_TOTAL_LEVEL = 0x40;
Channel* chan = getChannel(channel);
switch (chan->algorithm) {
case 7:
writeOperatorReg(channel, 0, REG_TOTAL_LEVEL, totalLevel);
writeOperatorReg(channel, 1, REG_TOTAL_LEVEL, totalLevel);
writeOperatorReg(channel, 2, REG_TOTAL_LEVEL, totalLevel);
writeOperatorReg(channel, 3, REG_TOTAL_LEVEL, totalLevel);
break;
case 6:
case 5:
writeOperatorReg(channel, 1, REG_TOTAL_LEVEL, totalLevel);
writeOperatorReg(channel, 2, REG_TOTAL_LEVEL, totalLevel);
writeOperatorReg(channel, 3, REG_TOTAL_LEVEL, totalLevel);
break;
case 4:
writeOperatorReg(channel, 2, REG_TOTAL_LEVEL, totalLevel);
writeOperatorReg(channel, 3, REG_TOTAL_LEVEL, totalLevel);
break;
default:
writeOperatorReg(channel, 3, REG_TOTAL_LEVEL, totalLevel);
break;
}
}

void synth_volume(u8 channel, u8 volume)
{
volumes[channel] = volume;
Expand Down
1 change: 0 additions & 1 deletion src/synth.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ void synth_init(void);
void synth_noteOn(u8 channel);
void synth_noteOff(u8 channel);
void synth_pitch(u8 channel, u8 octave, u16 freqNumber);
void synth_totalLevel(u8 channel, u8 totalLevel);
void synth_volume(u8 channel, u8 volume);
void synth_stereo(u8 channel, u8 mode);
void synth_algorithm(u8 channel, u8 algorithm);
Expand Down
1 change: 0 additions & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ MOCKS=midi_process \
synth_noteOn \
synth_noteOff \
synth_pitch \
synth_totalLevel \
synth_stereo \
synth_algorithm \
synth_feedback \
Expand Down
4 changes: 0 additions & 4 deletions tests/unit/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ int main(void)
synth_test(test_synth_sets_note_off_fm_reg_chan_0_to_2),
synth_test(test_synth_sets_note_off_fm_reg_chan_3_to_5),
synth_test(test_synth_sets_octave_and_freq_reg_chan),
synth_test(test_synth_sets_total_level_reg_chan_for_algorithms_0_to_3),
synth_test(test_synth_sets_total_level_reg_chan_for_algorithm_4),
synth_test(test_synth_sets_total_level_reg_chan_for_algorithms_5_and_6),
synth_test(test_synth_sets_total_level_reg_chan_for_algorithm_7),
synth_test(test_synth_sets_stereo_ams_and_freq),
synth_test(test_synth_sets_algorithm),
synth_test(test_synth_sets_feedback),
Expand Down
55 changes: 0 additions & 55 deletions tests/unit/test_synth.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ extern void __real_synth_noteOff(u8 channel);
extern void __real_synth_enableLfo(u8 enable);
extern void __real_synth_globalLfoFrequency(u8 freq);
extern void __real_synth_pitch(u8 channel, u8 octave, u16 freqNumber);
extern void __real_synth_totalLevel(u8 channel, u8 totalLevel);
extern void __real_synth_stereo(u8 channel, u8 stereo);
extern void __real_synth_ams(u8 channel, u8 ams);
extern void __real_synth_fms(u8 channel, u8 fms);
Expand Down Expand Up @@ -101,60 +100,6 @@ static void test_synth_sets_octave_and_freq_reg_chan(UNUSED void** state)
}
}

static void test_synth_sets_total_level_reg_chan_for_algorithms_0_to_3(
UNUSED void** state)
{
for (u8 algorithm = 0; algorithm < 4; algorithm++)
for (u8 chan = 0; chan < MAX_FM_CHANS; chan++) {
expect_ym2612_write_channel_any_data(chan, 0xB0);
expect_ym2612_write_operator(chan, 3, 0x40, 0);
__real_synth_algorithm(chan, algorithm);
__real_synth_totalLevel(chan, 0);
}
}

static void test_synth_sets_total_level_reg_chan_for_algorithm_4(
UNUSED void** state)
{
const u8 algorithm = 4;
for (u8 chan = 0; chan < MAX_FM_CHANS; chan++) {
expect_ym2612_write_channel_any_data(chan, 0xB0);
expect_ym2612_write_operator(chan, 2, 0x40, 0);
expect_ym2612_write_operator(chan, 3, 0x40, 0);
__real_synth_algorithm(chan, algorithm);
__real_synth_totalLevel(chan, 0);
}
}

static void test_synth_sets_total_level_reg_chan_for_algorithms_5_and_6(
UNUSED void** state)
{
for (u8 algorithm = 5; algorithm < 6; algorithm++)
for (u8 chan = 0; chan < MAX_FM_CHANS; chan++) {
expect_ym2612_write_channel_any_data(chan, 0xB0);
expect_ym2612_write_operator(chan, 1, 0x40, 0);
expect_ym2612_write_operator(chan, 2, 0x40, 0);
expect_ym2612_write_operator(chan, 3, 0x40, 0);
__real_synth_algorithm(chan, algorithm);
__real_synth_totalLevel(chan, 0);
}
}

static void test_synth_sets_total_level_reg_chan_for_algorithm_7(
UNUSED void** state)
{
const u8 algorithm = 7;
for (u8 chan = 0; chan < MAX_FM_CHANS; chan++) {
expect_ym2612_write_channel_any_data(chan, 0xB0);
expect_ym2612_write_operator(chan, 0, 0x40, 0);
expect_ym2612_write_operator(chan, 1, 0x40, 0);
expect_ym2612_write_operator(chan, 2, 0x40, 0);
expect_ym2612_write_operator(chan, 3, 0x40, 0);
__real_synth_algorithm(chan, algorithm);
__real_synth_totalLevel(chan, 0);
}
}

static void test_synth_sets_stereo_ams_and_freq(UNUSED void** state)
{
const u8 ams = 1;
Expand Down

0 comments on commit 583574d

Please sign in to comment.