Skip to content

Commit dad4a91

Browse files
committed
midi: replace d.BytesLen(1) with d.U8()
1 parent 7fd9ad2 commit dad4a91

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

format/midi/midi.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,12 @@ func vlq(d *decode.D) uint64 {
175175
vlq := uint64(0)
176176

177177
for {
178-
b := d.BytesLen(1)
178+
b := d.U8()
179179

180180
vlq <<= 7
181-
vlq += uint64(b[0] & 0x7f)
181+
vlq += uint64(b & 0x7f)
182182

183-
if b[0]&0x80 == 0 {
183+
if b&0x80 == 0 {
184184
break
185185
}
186186
}

format/midi/midievents.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func decodeMIDIEvent(d *decode.D, status uint8, ctx *context) {
4747
channel := func(d *decode.D) uint64 {
4848
b := d.PeekBytes(1)
4949
if b[0] >= 0x80 {
50-
d.BytesLen(1)
50+
d.U8()
5151
}
5252

5353
return uint64(status & 0x0f)

format/midi/sysex.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func decodeSysExEvent(d *decode.D, status uint8, ctx *context) {
3131
d.FieldStruct("SysExMessage", func(d *decode.D) {
3232
d.FieldStruct("time", delta)
3333
d.FieldUintFn("event", func(d *decode.D) uint64 {
34-
d.BytesLen(1)
34+
d.U8()
3535

3636
return 0x00f0
3737
}, sysex)
@@ -42,7 +42,7 @@ func decodeSysExEvent(d *decode.D, status uint8, ctx *context) {
4242
d.FieldStruct("SysExContinuation", func(d *decode.D) {
4343
d.FieldStruct("time", delta)
4444
d.FieldUintFn("event", func(d *decode.D) uint64 {
45-
d.BytesLen(1)
45+
d.U8()
4646

4747
return 0x80f7
4848
}, sysex)
@@ -53,7 +53,7 @@ func decodeSysExEvent(d *decode.D, status uint8, ctx *context) {
5353
d.FieldStruct("SysExEscape", func(d *decode.D) {
5454
d.FieldStruct("time", delta)
5555
d.FieldUintFn("event", func(d *decode.D) uint64 {
56-
d.BytesLen(1)
56+
d.U8()
5757

5858
return 0x00f7
5959
}, sysex)

0 commit comments

Comments
 (0)