NAME
MIDI::RtController::Filter - Parent class of RtController filters
VERSION
version 0.0101
SYNOPSIS
package Your::Filter;
extends 'MIDI::RtController::Filter';
DESCRIPTION
MIDI::RtController::Filter
is the parent class of MIDI::RtController filters.
Making filters
All filter methods must accept the object, a MIDI device name, a delta-time, and a MIDI event ARRAY reference, like:
sub breathe ($self, $device, $delta, $event) {
return 0 if $self->running;
my ($event_type, $chan, $control, $value) = $event->@*;
...
return $self->continue;
}
A filter also must return a boolean value. This tells MIDI::RtController to continue processing other known filters or not. The continue attribute is used for this purpose.
Calling filters
$controller->add_filter('breathe', note_on => $filter->curry::breathe);
Passing all
to the add_filter
method means that any MIDI event will fire the filter. But note_on
, [qw(note_on note_off)]
, or control_change
works, as well.
ATTRIBUTES
rtc
$controller = $filter->rtc;
A MIDI::RtController instance provided in the constructor.
channel
$channel = $filter->channel;
$filter->channel($number);
The current MIDI channel value between 0
and 15
.
Default: 0
value
$value = $filter->value;
$filter->value($number);
Return or set the MIDI event value. This is a generic setting that can be used by filters to set or retrieve state. This often a whole number between 0
and 127
, but can be undef
.
Default: undef
trigger
$trigger = $filter->trigger;
$filter->trigger($number);
Return or set the trigger. This is a generic setting that can be used by filters to set or retrieve state. This often a whole number between 0
and 127
representing an event note or control-change.
Default: undef
running
$running = $filter->running;
$filter->running($boolean);
Are we running a filter?
Default: 0
halt
$halt = $filter->halt;
$filter->halt($boolean);
This Boolean can be used to terminate running filters.
Default: 0
continue
$continue = $filter->continue;
$filter->continue($boolean);
This Boolean can be used to either stop or continue processing other filters by MIDI::RtController when returned from a filter.
Default: 0
verbose
$verbose = $filter->verbose;
Show progress.
SEE ALSO
MIDI::RtController::Filter-Drums
MIDI::RtController::Filter-Tonal
AUTHOR
Gene Boggs <gene.boggs@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2025 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.