Audio-Ecasound
view release on metacpan or search on metacpan
Ecasound.pm view on Meta::CPAN
my $cutoff_inc = 500.0;
while (1) {
sleep(1);
last if eci("engine-status") ne "running";
my $curpos = eci("get-position");
last if $curpos > 15;
my $next_cutoff = $cutoff_inc + eci("copp-get");
# Optional float argument
eci("copp-set", $next_cutoff);
}
eci("stop");
eci("cs-disconnect");
print "Chain operator status: ", eci("cop-status");
Object Interface
use Audio::Ecasound;
my $e = new Audio::Ecasound;
$e->on_error('');
$e->eci("cs-add play_chainsetup");
# etc.
Vanilla Ecasound Control Interface (See Ecasound's Programmer Guide):
use Audio::Ecasound qw(:std);
command("copp-get");
$precise_float = last_float() / 2;
command_float_arg("copp-set", $precise_float);
warn last_error() if error();
IAM Interface, pretend interactive mode commands are functions.
use Audio::Ecasound qw(:iam :simple);
# iam commands as functions with s/-/_/g
my $val = copp_get;
copp_set $val+0.1; # floats are stringified so beware
eci("-i /dev/dsp"); # not all commands are exported
=head1 DESCRIPTION
Audio::Ecasound provides perl bindings to the ecasound control interface of the
ecasound program. You can use perl to automate or interact with
ecasound so you don't have to turn you back on the adoring masses
packed into Wembly Stadium.
Ecasound is a software package designed for multitrack audio processing.
It can be used for audio playback, recording, format conversions,
effects processing, mixing, as a LADSPA plugin host and JACK node.
Version E<gt>= 2.2.X must be installed to use this package.
L<SEE ALSO> for more info.
=head1 INSTALLATION
perl Makefile.PL
If your perl wasn't built with -Dusethreads or -D_REENTRANT you
will be prompted whether to continue with the install. It's in
your hands... See L<THREADING NOTE>
make
make test
make install
=head1 THREADING NOTE
The ecasoundc library uses pthreads so will may only work if
your perl was compiled with threading enabled, check with:
% perl -V:usethreads
You are welcome to try using the module with non-threaded perls
(perhaps -D_REENTRANT alone would work) it have worked for some.
=head1 EXPORT
=over 4
=item *
Nothing by default as when going OO.
=item *
:simple gives eci() which does most everything, also errmsg and on_error.
Or you could just import 'eci' and call the others C<Audio::Ecasound::errmsg()>
=item *
:iam imports many iam commands so that you can use them as perl functions.
Basically everything listed by ecasound's 'int-cmd-list' except the single
letter commands and hyphens are replaced by underscores.
The list is produced at run-time and returned by Audio::Ecasound::get_iam_cmds().
See L<IAM COMMANDS>;
=item *
:std to import the full ecasound control interface detailed in the
Ecasound Programmer's Guide.
=item *
:raw and raw_r, C functions with minimal wrapping, _r ones are reentrant
and must be passed the object returned by eci_init_r(). I don't know why
you would use these, presumably you do. These options may be removed in
future.
=back
=head1 METHODS AND FUNCTIONS
The procedural and OO interfaces use the same functions, the differences
are that when called on an Audio::Ecasound object the reentrant C versions
are used so you can have multiple independent engine (with independent
options).
=over 2
=item B<new()>
Constructor for Audio::Ecasound objects, inherits the on_error and
other options from the current package settings (defaults if untouched).
=item B<eci('ecasound command string', [$float_argument])>
Sends commands to the Ecasound engine. A single command may be called with an
optional float argument (to avoid precision loss). Alternatively,
multiple commands may be given separated by newlines (with C<#> starting
a comment).
If called in non-void context the result of the last command is
returned, it may be an integer, float, string (ie. scalar) or a list of
( run in 0.464 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )