Last active
April 21, 2026 09:33
-
-
Save ology/9bb1a752507e570f602a506a0cd1c674 to your computer and use it in GitHub Desktop.
Not getting clock ticks with get_message_decoded()
This file contains hidden or 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
| #!/usr/bin/env perl | |
| use v5.36; | |
| use feature 'try'; | |
| use Data::Dumper::Compact qw(ddc); | |
| use MIDI::RtMidi::FFI::Device (); | |
| my $port_name = shift || 'iac'; # on a mac | |
| $SIG{INT} = sub { | |
| say "\nStopping..."; | |
| exit; | |
| }; | |
| my $device = RtMidiIn->new; | |
| try { # this will die on Windows but is needed for Mac | |
| $device->open_virtual_port('RtMidiIn'); | |
| } | |
| catch ($e) {} | |
| $device->open_port_by_name(qr/\Q$port_name/i); | |
| print "Listening on '$port_name'...\n"; | |
| while (1) { | |
| my $event = $device->get_message_decoded; | |
| if ($event) { | |
| say ddc $event; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment