Initial commit: MIDI port discovery tool
This commit is contained in:
Binary file not shown.
5
go.mod
Normal file
5
go.mod
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
module qrun
|
||||||
|
|
||||||
|
go 1.25.6
|
||||||
|
|
||||||
|
require gitlab.com/gomidi/midi/v2 v2.3.22
|
||||||
2
go.sum
Normal file
2
go.sum
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
gitlab.com/gomidi/midi/v2 v2.3.22 h1:4Q20o6q4BDo7i/KGvnwASeytOlrPI7MwsS7F2hA7fOM=
|
||||||
|
gitlab.com/gomidi/midi/v2 v2.3.22/go.mod h1:jDpP4O4skYi+7iVwt6Zyp18bd2M4hkjtMuw2cmgKgfw=
|
||||||
37
main.go
Normal file
37
main.go
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"gitlab.com/gomidi/midi/v2"
|
||||||
|
_ "gitlab.com/gomidi/midi/v2/drivers/rtmididrv"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
defer midi.CloseDriver()
|
||||||
|
|
||||||
|
inPorts := midi.GetInPorts()
|
||||||
|
outPorts := midi.GetOutPorts()
|
||||||
|
|
||||||
|
fmt.Println("MIDI Input Ports:")
|
||||||
|
if len(inPorts) == 0 {
|
||||||
|
fmt.Println(" (none)")
|
||||||
|
}
|
||||||
|
for i, port := range inPorts {
|
||||||
|
fmt.Printf(" [%d] %s\n", i, port)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("\nMIDI Output Ports:")
|
||||||
|
if len(outPorts) == 0 {
|
||||||
|
fmt.Println(" (none)")
|
||||||
|
}
|
||||||
|
for i, port := range outPorts {
|
||||||
|
fmt.Printf(" [%d] %s\n", i, port)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(inPorts) == 0 && len(outPorts) == 0 {
|
||||||
|
fmt.Println("\nNo MIDI devices found.")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user