Skip to content

Commit

Permalink
Merge pull request #1 from andreasschneiderleipzig/add-argument-to-li…
Browse files Browse the repository at this point in the history
…sten-to-all-MIDI-events

add argument to listen to all MIDI events
  • Loading branch information
bzeiss authored Jan 8, 2025
2 parents 4484be3 + 64e6429 commit d7511d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Usage: midi2mqtt [options]
Options:
-list-ports List available MIDI ports and exit
-test Run in test mode (print MIDI events to stdout)
-all-events Listen to all MIDI events
```

Example outputs:
Expand Down
6 changes: 6 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func main() {
// Parse command line flags
showPorts := flag.Bool("list-ports", false, "List available MIDI ports and exit")
testMode := flag.Bool("test", false, "Run in test mode (print MIDI events to stdout)")
allEvents := flag.Bool("all-events", false, "Listening to all MIDI events")
flag.Parse()

// Handle list-ports command first, before loading config
Expand All @@ -161,6 +162,11 @@ func main() {

slog.Info("Using config file", "path", configPath)

if *allEvents {
cfg.MIDI.EventTypes = nil
slog.Info("Listening to all MIDI events")
}

if *testMode {
if err := runTestMode(cfg); err != nil {
slog.Error("Error running test mode", "error", err)
Expand Down

0 comments on commit d7511d2

Please sign in to comment.