Skip to content

Commit

Permalink
Handle all TL OP CCs (1-4)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhargreaves committed Nov 14, 2018
1 parent aa0c4c0 commit 1ea6734
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
12 changes: 12 additions & 0 deletions src/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#define CC_PAN 0xA
#define CC_GENMDM_ALGORITHM 0xE
#define CC_GENMDM_TOTAL_LEVEL_OP1 16
#define CC_GENMDM_TOTAL_LEVEL_OP2 17
#define CC_GENMDM_TOTAL_LEVEL_OP3 18
#define CC_GENMDM_TOTAL_LEVEL_OP4 19
#define CC_ALL_NOTES_OFF 0x7B

static u8 lastUnknownStatus = 0;
Expand Down Expand Up @@ -82,6 +85,15 @@ static void controlChange(u8 status)
case CC_GENMDM_TOTAL_LEVEL_OP1:
synth_operatorTotalLevel(chan, 0, value);
break;
case CC_GENMDM_TOTAL_LEVEL_OP2:
synth_operatorTotalLevel(chan, 1, value);
break;
case CC_GENMDM_TOTAL_LEVEL_OP3:
synth_operatorTotalLevel(chan, 2, value);
break;
case CC_GENMDM_TOTAL_LEVEL_OP4:
synth_operatorTotalLevel(chan, 3, value);
break;
default:
lastUnknownControlChange.controller = controller;
lastUnknownControlChange.value = value;
Expand Down
18 changes: 10 additions & 8 deletions tests/test_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,18 @@ static void test_interface_sets_all_notes_off(void** state)
static void test_interface_sets_operator_total_level(void** state)
{
u8 expectedStatus = STATUS_CC;
u8 expectedController = 16;
u8 expectedValue = 50;

will_return(__wrap_comm_read, expectedStatus);
will_return(__wrap_comm_read, expectedController);
will_return(__wrap_comm_read, expectedValue);
for (u8 cc = 16; cc <= 19; cc++) {
will_return(__wrap_comm_read, expectedStatus);
will_return(__wrap_comm_read, cc);
will_return(__wrap_comm_read, expectedValue);

expect_value(__wrap_synth_operatorTotalLevel, channel, 0);
expect_value(__wrap_synth_operatorTotalLevel, op, 0);
expect_value(__wrap_synth_operatorTotalLevel, totalLevel, expectedValue);
u8 expectedOp = cc - 16;
expect_value(__wrap_synth_operatorTotalLevel, channel, 0);
expect_value(__wrap_synth_operatorTotalLevel, op, expectedOp);
expect_value(__wrap_synth_operatorTotalLevel, totalLevel, expectedValue);

interface_tick();
interface_tick();
}
}

0 comments on commit 1ea6734

Please sign in to comment.