Mac::CoreMIDI - XS Interface for the Mac OS X CoreMIDI API
use Mac::CoreMIDI qw(GetDevices); foreach (GetDevices()) { $_->Dump(); }
With Mac OS X, Apple introduced a flexible MIDI system called CoreMIDI. Mac::CoreMIDI translates the procedural CoreMIDI API into a set of OO Perl classes.
Mac::CoreMIDI
You will need the CoreAudio SDK installed to compile this module.
CoreMIDI models MIDI devices that can have several entities. These entities have endpoints (sources and destinations). The classes are Mac::CoreMIDI::Device, Mac::CoreMIDI::Entity and Mac::CoreMIDI::Endpoint (for both sources and destinations). The base class of most CoreMIDI classes is Mac::CoreMIDI::Object.
This module is work in progress. So far, information about the MIDI system can be collected and update messages can be received. However, the structure is subject to change. I hope to use code ref-based callbacks soon, which will help to implement the callbacks to read MIDI data more easily.
All of the following functions can be imported on demand.
my @dev = GetDevices()
Returns a list of all MIDI devices.
my $n = GetNumberOfDevices()
Returns the number of MIDI devices.
my $dev = GetDevice($i)
Returns the $i'th MIDI device (starting from 0).
$i
my @src = GetSources()
Returns a list of source endpoints.
my $n = GetNumberOfSources()
Returns the number of sources.
my $src = GetSource($i)
Returns the $i'th source (starting from 0).
my @dest = GetDestinations()
Returns a list of destination endpoints.
my $n = GetNumberOfDestinations()
Returns the number of destinations.
my $dest = GetDestination($i)
Returns the $i'th destination (starting from 0).
my @edev = GetExternalDevices()
Returns a list of external MIDI devices.
my $n = GetNumberOfExternalDevices()
Returns the number of external MIDI devices.
GetExternalDevice($i)
Returns the $i'th external MIDI device (starting from 0).
my $obj = FindObject($id)
Finds a MIDI object by its unique ID.
Restart()
Force MIDI drivers to rescan for the hardware.
RunLoopRun()
Starts "main" loop for receiving MIDI data.
RunLoopStop()
Stops "main" loop.
http://developer.apple.com/audio/ file:///Developer/Examples/CoreAudio/Documentation/MIDI/index.html
Christian Renz, <crenz @ web42.com>
Copyright 2004-2005 Christian Renz, <crenz @ web42.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Mac::CoreMIDI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mac::CoreMIDI
CPAN shell
perl -MCPAN -e shell install Mac::CoreMIDI
For more information on module installation, please visit the detailed CPAN module installation guide.