aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorsago35 <[email protected]>2024-10-25 08:43:13 +0900
committerRon Evans <[email protected]>2024-10-25 06:25:49 +0100
commitf0d523f7782f9088c3841e955a37fcddb9d2da56 (patch)
treee50aca0e2fc70c0c11a9c4ff4372e31ddf2a410b /src
parent6e6507bf77466754c8e949809a4e62569c085c90 (diff)
downloadtinygo-f0d523f7782f9088c3841e955a37fcddb9d2da56.tar.gz
tinygo-f0d523f7782f9088c3841e955a37fcddb9d2da56.zip
machine/usb/adc/midi: clarify operator precedence
Diffstat (limited to 'src')
-rw-r--r--src/machine/usb/adc/midi/messages.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/machine/usb/adc/midi/messages.go b/src/machine/usb/adc/midi/messages.go
index 7a681f9bf..baeb0c409 100644
--- a/src/machine/usb/adc/midi/messages.go
+++ b/src/machine/usb/adc/midi/messages.go
@@ -97,7 +97,7 @@ func (m *midi) NoteOn(cable, channel uint8, note Note, velocity uint8) error {
return errInvalidMIDIVelocity
}
- m.msg[0], m.msg[1], m.msg[2], m.msg[3] = (cable&0xf<<4)|CINNoteOn, MsgNoteOn|(channel-1&0xf), byte(note)&0x7f, velocity&0x7f
+ m.msg[0], m.msg[1], m.msg[2], m.msg[3] = ((cable&0xf)<<4)|CINNoteOn, MsgNoteOn|((channel-1)&0xf), byte(note)&0x7f, velocity&0x7f
_, err := m.Write(m.msg[:])
return err
}
@@ -115,7 +115,7 @@ func (m *midi) NoteOff(cable, channel uint8, note Note, velocity uint8) error {
return errInvalidMIDIVelocity
}
- m.msg[0], m.msg[1], m.msg[2], m.msg[3] = (cable&0xf<<4)|CINNoteOff, MsgNoteOff|(channel-1&0xf), byte(note)&0x7f, velocity&0x7f
+ m.msg[0], m.msg[1], m.msg[2], m.msg[3] = ((cable&0xf)<<4)|CINNoteOff, MsgNoteOff|((channel-1)&0xf), byte(note)&0x7f, velocity&0x7f
_, err := m.Write(m.msg[:])
return err
}
@@ -137,7 +137,7 @@ func (m *midi) ControlChange(cable, channel, control, value uint8) error {
return errInvalidMIDIControlValue
}
- m.msg[0], m.msg[1], m.msg[2], m.msg[3] = (cable&0xf<<4)|CINControlChange, MsgControlChange|(channel-1&0xf), control&0x7f, value&0x7f
+ m.msg[0], m.msg[1], m.msg[2], m.msg[3] = ((cable&0xf)<<4)|CINControlChange, MsgControlChange|((channel-1)&0xf), control&0x7f, value&0x7f
_, err := m.Write(m.msg[:])
return err
}
@@ -156,7 +156,7 @@ func (m *midi) ProgramChange(cable, channel uint8, patch uint8) error {
return errInvalidMIDIPatch
}
- m.msg[0], m.msg[1], m.msg[2] = (cable&0xf<<4)|CINProgramChange, MsgProgramChange|(channel-1&0xf), patch&0x7f
+ m.msg[0], m.msg[1], m.msg[2] = ((cable&0xf)<<4)|CINProgramChange, MsgProgramChange|((channel-1)&0xf), patch&0x7f
_, err := m.Write(m.msg[:3])
return err
}
@@ -177,7 +177,7 @@ func (m *midi) PitchBend(cable, channel uint8, bend uint16) error {
return errInvalidMIDIPitchBend
}
- m.msg[0], m.msg[1], m.msg[2], m.msg[3] = (cable&0xf<<4)|CINPitchBendChange, MsgPitchBend|(channel-1&0xf), byte(bend&0x7f), byte(bend>>8)&0x7f
+ m.msg[0], m.msg[1], m.msg[2], m.msg[3] = ((cable&0xf)<<4)|CINPitchBendChange, MsgPitchBend|((channel-1)&0xf), byte(bend&0x7f), byte(bend>>8)&0x7f
_, err := m.Write(m.msg[:])
return err
}
@@ -198,7 +198,7 @@ func (m *midi) SysEx(cable uint8, data []byte) error {
}
// write start
- m.msg[0], m.msg[1] = (cable&0xf<<4)|CINSysExStart, MsgSysExStart
+ m.msg[0], m.msg[1] = ((cable&0xf)<<4)|CINSysExStart, MsgSysExStart
m.msg[2], m.msg[3] = data[0], data[1]
if _, err := m.Write(m.msg[:]); err != nil {
return err
@@ -207,7 +207,7 @@ func (m *midi) SysEx(cable uint8, data []byte) error {
// write middle
i := 2
for ; i < len(data)-2; i += 3 {
- m.msg[0], m.msg[1] = (cable&0xf<<4)|CINSysExStart, data[i]
+ m.msg[0], m.msg[1] = ((cable&0xf)<<4)|CINSysExStart, data[i]
m.msg[2], m.msg[3] = data[i+1], data[i+2]
if _, err := m.Write(m.msg[:]); err != nil {
return err
@@ -216,13 +216,13 @@ func (m *midi) SysEx(cable uint8, data []byte) error {
// write end
switch len(data) - i {
case 2:
- m.msg[0], m.msg[1] = (cable&0xf<<4)|CINSysExEnd3, data[i]
+ m.msg[0], m.msg[1] = ((cable&0xf)<<4)|CINSysExEnd3, data[i]
m.msg[2], m.msg[3] = data[i+1], MsgSysExEnd
case 1:
- m.msg[0], m.msg[1] = (cable&0xf<<4)|CINSysExEnd2, data[i]
+ m.msg[0], m.msg[1] = ((cable&0xf)<<4)|CINSysExEnd2, data[i]
m.msg[2], m.msg[3] = MsgSysExEnd, 0
case 0:
- m.msg[0], m.msg[1] = (cable&0xf<<4)|CINSysExEnd1, MsgSysExEnd
+ m.msg[0], m.msg[1] = ((cable&0xf)<<4)|CINSysExEnd1, MsgSysExEnd
m.msg[2], m.msg[3] = 0, 0
}
if _, err := m.Write(m.msg[:]); err != nil {