1 package ARDOUR
::AutomationSRConverter
;
4 my ($type, $input, $output, $inputSR, $outputSR) = @_;
6 my $self = bless {}, $type;
8 $self->{Input
} = $input;
9 $self->{Output
} = $output;
10 $self->{Ratio
} = ($outputSR+0) / ($inputSR+0);
23 $c=$self->{Input
}->getc;
24 } while ($c ne '' && $c ne "\n");
30 my ($self, $line) = @_;
32 $self->{Output
}->print($line."\n");
38 my $version=$self->readline;
40 if ($version ne "version 1") {
41 die ("Unsupported automation version $version");
44 $self->writeline($version);
46 my $buf = $self->readline;
47 while ( $buf ne "" ) {
48 if ( $buf eq "begin" ||
50 $self->writeline($buf);
52 my ($type, $position, $value) = split(' ', $buf);
54 $self->writeline($type." ".sprintf("%.0f",$position*$self->{Ratio
})." ".$value);
57 $buf = $self->readline;