NAME

MIDI::RtMidi::Util - Handy Utilities for Real-time MIDI

VERSION

version 0.0201

SYNOPSIS

use MIDI::RtMidi::Util qw(out_port halt input_ports output_ports);

my $ports = input_ports(); # e.g. ['USB MIDI Interface', ...]
$ports = output_ports();

my $midi_out = out_port('usb');

END {
  halt($midi_out);
}

# redefine what happens on ^C:
$SIG{INT} = sub {
  print "\nStop sequencer\n";
  halt($midi_out);
};

DESCRIPTION

MIDI::RtMidi::Util is a junk drawer for Real-time MIDI utilities.

FUNCTIONS

out_port

$out_port = out_port($name);

Open and return a named MIDI::RtMidi::FFI::Device RtMidiOut device.

This function takes a unique part of an open port name as its argument.

halt

halt();

Stop and close an open RtMidiOut device.

input_ports

$input_ports = input_ports();

Return an array-reference of open MIDI input port names.

output_ports

$output_ports = output_ports();

Return an array-reference of open MIDI output port names.

SEE ALSO

MIDI::RtMidi::FFI::Device

AUTHOR

Gene Boggs <gene.boggs@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Gene Boggs.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.