simple_int.pl 777 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#!/usr/bin/perl -w

use ExtUtils::testlib;

use strict;

use Audio::Ecasound qw(:simple);

on_error('');
$_ = eci("
         cs-add play_chainsetup
        c-add 1st_chain
        -i:some_file.wav
        -o:/dev/dsp
        cop-add -efl:100
        cop-select 1
        copp-select 1
        cs-connect
        start
");
if(!defined) {
    die "Setup error, you need 'some_file.wav' in the current directory\n\n"
            . errmsg();
}

on_error('die');
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");
    eci("copp-set", $next_cutoff);
}
eci("stop");
eci("cs-disconnect");
print eci("cop-status"), "\n";