1#!/usr/bin/perl -w
2
3use ExtUtils::testlib;
4
5
6use Audio::Ecasound qw(:simple :iam);
7
8
9use strict;
10# :iam is nicer without strict 'subs'
11no strict 'subs';
12on_error('');
13
14# no strict 'subs' lets you do this:
15cs_add play_chainsetup;
16c_add chain1;
17eci("-i:some_file.wav
18        -o:/dev/dsp");
19cop_add '-efl:100';
20cop_select 1;
21copp_select 1;
22defined(cs_connect)
23    or die "Setup error, you need 'some_file.wav' in the current directory\n\n"
24                        . errmsg();
25
26on_error('die');
27start;
28
29my $cutoff_inc = 500.0;
30while (1) {
31    sleep(1);
32    last if engine_status ne "running";
33
34    my $curpos = get_position;
35    last if $curpos > 15;
36
37    my $next_cutoff = $cutoff_inc + copp_get;
38    # keep float precision
39    eci("copp-set", $next_cutoff);
40}
41stop;
42cs_disconnect;
43print cop_status, "\n";
44