https://github.com/youpy/go-coremidi
A Go library to use MIDI on Mac
https://github.com/youpy/go-coremidi
Last synced: 10 months ago
JSON representation
A Go library to use MIDI on Mac
- Host: GitHub
- URL: https://github.com/youpy/go-coremidi
- Owner: youpy
- License: mit
- Created: 2013-02-05T12:50:11.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2024-11-17T11:18:36.000Z (over 1 year ago)
- Last Synced: 2024-11-17T12:20:24.832Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 47.9 KB
- Stars: 15
- Watchers: 3
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-coremidi
A Go library to use MIDI on Mac
## Installation
```
go get github.com/youpy/go-coremidi
```
## Synopsis
### Monitor MIDI Messages
```go
package main
import (
"fmt"
"github.com/youpy/go-coremidi"
)
func main() {
client, err := coremidi.NewClient("a client")
if err != nil {
fmt.Println(err)
return
}
port, err := coremidi.NewInputPort(
client,
"test",
func(source coremidi.Source, packet coremidi.Packet) {
fmt.Printf(
"device: %v, manufacturer: %v, source: %v, data: %v\n",
source.Entity().Device().Name(),
source.Manufacturer(),
source.Name(),
packet.Data,
)
return
},
)
if err != nil {
fmt.Println(err)
return
}
sources, err := coremidi.AllSources()
if err != nil {
fmt.Println(err)
return
}
for _, source := range sources {
func(source coremidi.Source) {
port.Connect(source)
}(source)
}
ch := make(chan int)
<-ch
}
```
## Documents
* http://godoc.org/github.com/youpy/go-coremidi