-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit 4ded137.
- Loading branch information
Showing
10 changed files
with
151 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "rtmidi"] | ||
path = rtmidi | ||
url = https://github.com/thestk/rtmidi.git | ||
[submodule "keykit"] | ||
path = keykit | ||
url = https://github.com/nosuchtim/keykit.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"time" | ||
|
||
midi "gitlab.com/gomidi/midi/v2" | ||
_ "gitlab.com/gomidi/midi/v2/drivers/rtmididrv" // autoregisters driver | ||
) | ||
|
||
func main() { | ||
|
||
log.Printf("Hi from main\n") | ||
|
||
defer midi.CloseDriver() | ||
|
||
port := "01. Internal MIDI" | ||
in, err := midi.FindInPort(port) | ||
if err != nil { | ||
fmt.Printf("can't find %s\n", port) | ||
return | ||
} | ||
|
||
stop, err := midi.ListenTo(in, func(msg midi.Message, timestampms int32) { | ||
var bt []byte | ||
var ch, key, vel uint8 | ||
switch { | ||
case msg.GetSysEx(&bt): | ||
fmt.Printf("got sysex: % X\n", bt) | ||
case msg.GetNoteStart(&ch, &key, &vel): | ||
fmt.Printf("starting note %s on channel %v with velocity %v\n", midi.Note(key), ch, vel) | ||
case msg.GetNoteEnd(&ch, &key): | ||
fmt.Printf("ending note %s on channel %v\n", midi.Note(key), ch) | ||
default: | ||
// ignore | ||
} | ||
}, midi.UseSysEx()) | ||
|
||
if err != nil { | ||
fmt.Printf("ERROR: %s\n", err) | ||
return | ||
} | ||
|
||
forever := true | ||
if forever { | ||
select {} | ||
} else { | ||
time.Sleep(time.Second * 10) | ||
stop() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters