Skip to content

Commit 9bd42b8

Browse files
committed
make darwin/linux interfaces consistent
1 parent 59a1c80 commit 9bd42b8

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

midi_linux.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,23 @@ func (d *Device) Close() error {
4646
}
4747

4848
// Packets returns a read-only channel that emits packets.
49-
func (d *Device) Packets() (<-chan Packet, error) {
49+
func (d *Device) Packets() (<-chan []Packet, error) {
5050
var (
5151
buf = make([]byte, 3)
52-
ch = make(chan Packet, d.QueueSize)
52+
ch = make(chan []Packet, d.QueueSize)
5353
)
5454
go func() {
5555
for {
5656
if _, err := d.Read(buf); err != nil {
57-
ch <- Packet{Err: err}
57+
ch <- []Packet{
58+
{Err: err},
59+
}
5860
return
5961
}
60-
ch <- Packet{
61-
Data: [3]byte{buf[0], buf[1], buf[2]},
62+
ch <- []Packet{
63+
{
64+
Data: [3]byte{buf[0], buf[1], buf[2]},
65+
},
6266
}
6367
}
6468
}()

0 commit comments

Comments
 (0)