Stop the stream (if not already finished) and disconnect the
chainsetup. Print chain operator status info.
3.2: C++
3.2.1: Overview
C++ implementation is based around the ECA_CONTROL_INTERFACE class.
STL vector is used for representing collections of objects
(last_string_list()).
3.2.2: Usage
- #include <ecasound/eca-control-interface.h>
- create an instance of the ECA_CONTROL_INTERFACE class
and use its member functions
- link you app agains libecasound (-lecasound)
3.2.3: Example
#include <iostream>
#include <unistd.h>
#include <ecasound/eca-control-interface.h>
int main(int argc, char *argv[])
{
double cutoff_inc = 500.0;
ECA_CONTROL_INTERFACE e;
e.command("cs-add play_chainsetup");
e.command("c-add 1st_chain");
e.command("-i:some_file.wav");
e.command("-o:/dev/dsp");
e.command("cop-add -efl:100");
e.command("cop-select 1");
e.command("copp-select 1");
e.command("cs-connect");
e.command("start");
while(1) {
sleep(1);
e.command("engine-status");
if (e.last_string() != "running") break;
e.command("get-position");
double curpos = e.last_float();
if (curpos > 15.0) break;
e.command("copp-get");
double next_cutoff = cutoff_inc + e.last_float();
e.command_float_arg("copp-set", next_cutoff);
}
e.command("stop");
e.command("cs-disconnect");
e.command("cop-status");
cerr << "Chain operator status: " << e.last_string() << endl;
return(0);
}
3.3: C
3.3.1: Overview
All C ECI functions are prefixed with "eci_". When returning string
values, a const pointer to a null-terminated char array (const char*)
is returned. It's important to keep in mind that these are "borrowed"
references. If you need to later use the data, you must copy
it to application's own buffers.
Returning a list of strings is implemented using two functions:
eci_last_string_list_count() returns the number of strings
available, and eci_last_string_list_item(int n) returns a
pointer (const char*) to the string at index n.
Note! As of ecasound 2.0.1, the C ECI implementation also
provides reentrant access to the ECI API. These
alternative routines are marked with '_r' postfix.
3.3.2: Usage
- #include <ecasound/ecasoundc.h>
- use the eci_* routines
- link your app against libecasoundc (-lecasoundc)
3.3.3: Example
#include <stdio.h>
#include <unistd.h>
#include <ecasound/ecasoundc.h>
int main(int argc, char *argv[])
{
double cutoff_inc = 500.0;
eci_init();
eci_command("cs-add play_chainsetup");
eci_command("c-add 1st_chain");
eci_command("-i:some_file.wav");
eci_command("-o:/dev/dsp");
eci_command("cop-add -efl:100");
eci_command("cop-select 1");
eci_command("copp-select 1");
eci_command("cs-connect");
eci_command("start");
while(1) {
double curpos, next_cutoff;
sleep(1);
eci_command("engine-status");
if (strcmp(eci_last_string(), "running") != 0) break;
eci_command("get-position");
curpos = eci_last_float();
if (curpos > 15.0) break;
eci_command("copp-get");
next_cutoff = cutoff_inc + eci_last_float();
eci_command_float_arg("copp-set", next_cutoff);
}
eci_command("stop");
eci_command("cs-disconnect");
eci_command("cop-status");
printf("Chain operator status: %s", eci_last_string());
eci_cleanup();
return(0);
}
3.4: Python
3.4.1: Overview
Python implementation is based around the ECA_CONTROL_INTERFACE class.
Lists are used for representing collections of objects.
Note! Eric S. Tiedemann has written an alternative Python interface
to ECI. You'll find this interface included in the main
ecasound packege, in pyecasound/esteci.py. To use this instead
of the standard interface, just 'import eci' and you're set! :)
3.4.2: Usage
- import pyeca
- create an instance of the ECA_CONTROL_INTERFACE class
and use its member functions
- python 'yourapp.py' and that's it :)
3.4.3: Example
#!/usr/local/bin/python
import time
from pyeca import *
e = ECA_CONTROL_INTERFACE()
e.command("cs-add play_chainsetup")
e.command("c-add 1st_chain")
e.command("-i:some_file.wav")
e.command("-o:/dev/dsp")
e.command("cop-add -efl:100")
e.command("cop-select 1")
e.command("copp-select 1")
e.command("cs-connect")
e.command("start")
cutoff_inc = 500.0
while 1:
time.sleep(1)
e.command("engine-status")
if e.last_string() != "running": break
e.command("get-position")
curpos = e.last_float()
if curpos > 15: break
e.command("copp-get")
next_cutoff = cutoff_inc + e.last_float()
e.command_float_arg("copp-set", next_cutoff)
e.command("stop")
e.command("cs-disconnect")
e.command("cop-status")
print "Chain operator status: ", e.last_string()
3.5: Perl
3.5.1: Overview
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.
Audio::Ecasound was written by Brad Bowman. At the moment this module
is not distributed with ecasound. To get the latest version, check the
following CPAN link.
3.5.2: Usage
See the below example. For more info, here's another
CPAN link.
3.5.3: Example
use Audio::Ecasound qw(:simple);
eci("cs-add play_chainsetup");
eci("c-add 1st_chain");
eci("-i:some_file.wav");
eci("-o:/dev/dsp");
# multiple \n separated commands
eci("cop-add -efl:100
# with comments
cop-select 1
copp-select 1
cs-connect");
eci("start");
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");