Audio-LADSPA
view release on metacpan or search on metacpan
Plugin/Plugin.pod view on Meta::CPAN
# eg
@output = $sine_fcac->get('Output');
Get the data from the Audio::LADSPA::Buffer connected to the $port.
A shortcut for C<<$plugin->get_buffer($port)->get()>>
See L<Audio::LADSPA::Buffer/get>.
=head2 get_uniqid
my $uid = $plugin->get_uniqid();
Returns the uniqid for this plugin instance. See also L</new>.
=head1 Running the plugin
=head2 run
$plugin->run($num_samples);
Run the plugin for $num_samples samples. All ports should be connected to a buffer, and C<activate> is
called automatically if the plugin isn't active already.
Usually $plugin will read from all buffers connected to its input ports and write to all buffers connected to
its output ports.
=head2 run_adding
$plugin->run_adding($num_samples);
Same as C<run()> except that the plugin will add its output to the data in its output buffers,
instead of overwriting it. Use C<< $plugin->has_run_adding() >> to check whether the plugin supports this mode. Will throw an exception if not supported.
=head2 run_adding_gain
$plugin->run_adding_gain($gain);
Set the output gain for the C<run_adding()> method. Will throw an exception if the
plugin has no C<run_adding()> method. Check C<< $plugin->has_run_adding() >>.
=head2 activate
$plugin->activate();
Signal that the plugin should get ready to run. Is called automatically
when C<run>, C<run_adding> or C<run_adding_gain> is called and the plugin is not active.
Is ignored after the first call, except when C<deactivate()> is called.
=head2 deactivate
$plugin->deactivate();
Signal that the plugin can stop. Calling C<deactivate()> and then
C<activate()> should reset the plugin.
=head1 SETTING CALLBACKS
To ease the creation of 'container' objects for C<Audio::LADSPA::Plugin>s, you can register a
'monitor' object (usually, the container itself) that will recieve callbacks whenever certain
methods are called on the plugin.
Note that the monitor object should be kept in scope by the container; the reference counting
for the $monitor object is NOT increased by calling C<< $plugin->set_monitor($monitor) >>.
This is intentional; it allows the container to be the monitor, while still being DESTROYED
when going out of scope (this means you don't have to worry when the container is
the monitor; the Perl garbage collector will work as you would expect it to). See
L<Audio::LADSPA::Network> for a (as of yet buggy) implementation.
=head2 set_monitor
$plugin->set_monitor($monitor);
Sets the $monitor object for $plugin. Use C<< $plugin->set_monitor(undef) >> to remove a
monitor object.
=head2 monitor
my $monitor = $plugin->monitor();
Returns the $monitor object for $plugin, or C<undef> if there is no monitor set.
=head1 CALLBACK METHODS
In general, the callback methods will be called when the corresponing event is called, before
any processing of the event is done. Some callback methods can return true or false indicating
that the event should be processed or not. When a plugin has no monitor, or the callback is
not implemented, the event is processed (the plugin acts as if the callback returned true).
The monitor object may implement the following methods:
=head2 cb_connect
$monitor->cb_connect( $plugin, $port, $buffer );
Will be called when C<< $plugin->connect($port, $buffer) >> is called. If cb_connect returns
false, the connection will not be made.
=head2 cb_disconnect
$monitor->cb_disconnect( $plugin, $port );
Will be called when C<< $plugin->disconnect($port) >> is called.
=head1 SEE ALSO
L<Audio::LADSPA::UserGuide>, L<Audio::LADSPA::Network>. And the LADSPA SDK:
http://www.ladspa.org/ or the ladspa.h file in this distribution.
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2003 - 2004 Joost Diepenmaat <jdiepen@cpan.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
( run in 1.364 second using v1.01-cache-2.11-cpan-39bf76dae61 )