Skip to content

Commit d3486dc

Browse files
authored
Merge pull request #13 from T-vK/feat/fix-default-channel-bug
Fix default channel bug for cc messages etc
2 parents c080f1c + 0471cf5 commit d3486dc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/MidiCommon.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,24 @@ void MidiCommon :: pitchBend(uint16_t value, int8_t channelPar) {
5858
writeData(&outMessage, 2);
5959
}
6060

61-
void MidiCommon :: channelPressure(uint8_t valuePar, int8_t channel){
61+
void MidiCommon :: channelPressure(uint8_t valuePar, int8_t channelPar) {
62+
uint8_t channel = channelPar != -1 ? channelPar : sendingChannel;
6263
uint8_t value = valuePar & 0b1111111;
6364
this->outMessage.status = 0b1101 << 4 | channel;
6465
this->outMessage.arg1 = value ;
6566
writeData(&outMessage, 1);
6667
}
6768

68-
void MidiCommon :: polyPressure(uint8_t valuePar, int8_t channel){
69+
void MidiCommon :: polyPressure(uint8_t valuePar, int8_t channelPar) {
70+
uint8_t channel = channelPar != -1 ? channelPar : sendingChannel;
6971
uint8_t value = valuePar & 0b1111111;
7072
this->outMessage.status = 0b1010 << 4 | channel;
7173
this->outMessage.arg1 = value ;
7274
writeData(&outMessage, 1);
7375
}
7476

75-
void MidiCommon :: programChange(uint8_t program, int8_t channel){
77+
void MidiCommon :: programChange(uint8_t program, int8_t channelPar) {
78+
uint8_t channel = channelPar != -1 ? channelPar : sendingChannel;
7679
uint8_t value = program & 0b1111111;
7780
this->outMessage.status = 0b1100 << 4 | channel;
7881
this->outMessage.arg1 = value ;
@@ -91,7 +94,8 @@ void MidiCommon :: localControl( bool active, int8_t channel){
9194
controlChange(122,active ? 127 : 0, channel);
9295
}
9396

94-
void MidiCommon :: controlChange(uint8_t msg, uint8_t value, int8_t channel){
97+
void MidiCommon :: controlChange(uint8_t msg, uint8_t value, int8_t channelPar) {
98+
uint8_t channel = channelPar != -1 ? channelPar : sendingChannel;
9599
this->outMessage.status = 0b1011 << 4 | channel;
96100
this->outMessage.arg1 = msg;
97101
this->outMessage.arg2 = value;

0 commit comments

Comments
 (0)