| 1 | # Audio::LADSPA perl modules for interfacing with LADSPA plugins | ||
| 2 | # Copyright (C) 2003 Joost Diepenmaat. | ||
| 3 | # | ||
| 4 | # This program is free software; you can redistribute it and/or modify | ||
| 5 | # it under the terms of the GNU General Public License as published by | ||
| 6 | # the Free Software Foundation; either version 2 of the License, or | ||
| 7 | # (at your option) any later version. | ||
| 8 | # | ||
| 9 | # This program is distributed in the hope that it will be useful, | ||
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | # GNU General Public License for more details. | ||
| 13 | # | ||
| 14 | # You should have received a copy of the GNU General Public License | ||
| 15 | # along with this program; if not, write to the Free Software | ||
| 16 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 17 | # | ||
| 18 | # See the COPYING file for more information. | ||
| 19 | |||
| 20 | package Audio::LADSPA::Plugin::Play; | ||
| 21 | use strict; | ||
| 22 | use Audio::LADSPA::Plugin::Perl; | ||
| 23 | use Audio::Play (); | ||
| 24 | our @ISA = qw(Audio::LADSPA::Plugin::Perl); | ||
| 25 | our $VERSION = "0.021"; | ||
| 26 | use Carp; | ||
| 27 | |||
| 28 | sub init { | ||
| 29 | my ($self) = @_; | ||
| 30 | my $play = Audio::Play->new() or croak "Cannot create audio output"; | ||
| 31 | $self->{player} = $play; | ||
| 32 | } | ||
| 33 | |||
| 34 | __PACKAGE__->description( | ||
| 35 | name => 'Audio::LADSPA::Plugin::Play', | ||
| 36 | label => 'play', | ||
| 37 | maker => 'Joost Diepenmaat', | ||
| 38 | copyright => 'GPL', | ||
| 39 | id => '0', | ||
| 40 | ports => [ | ||
| 41 | { | ||
| 42 | name => 'Input', | ||
| 43 | is_input => 1, | ||
| 44 | is_control => 0, | ||
| 45 | }, | ||
| 46 | ], | ||
| 47 | ); | ||
| 48 | |||
| 49 | sub run { | ||
| 50 | my ($self,$samples) = @_; | ||
| 51 | my $bd = Audio::Data->new( rate => 44100 ); | ||
| 52 | $bd.= [$self->get_buffer('Input')->get_list() ]; # can this be made faster??? | ||
| 53 | $self->{player}->play( $bd ); | ||
| 54 | } | ||
| 55 | |||
| 56 | |||
| 57 | __END__ |