File Coverage

blib/lib/Audio/LADSPA/Buffer.pm
Criterion Covered Total %
statement 17 40 42.5
branch 1 12 8.3
condition n/a
subroutine 6 10 60.0
pod 6 6 100.0
total 30 68 44.1


line stmt bran cond sub pod time code
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              
21              
22             package Audio::LADSPA::Buffer;
23 13     13   49234 use strict;
  13         27  
  13         502  
24 13     13   75 use base qw(DynaLoader);
  13         23  
  13         1402  
25             our $VERSION = "0.021";
26 13     13   70 use Carp qw(croak);
  13         23  
  13         6932  
27              
28             sub get_words {
29 0     0 1 0 my ($self,$amp) = @_;
30            
31 0 0       0 if ($self->filled) {
32 0 0       0 unless ($amp) {
33 0         0 return pack("v*",unpack("f*",$self->get_raw()));
34             }
35             else {
36 0         0 return pack("v*",map { $_ * $amp } unpack("f*",$self->get_raw()));
  0         0  
37             }
38             }
39 0         0 return undef;
40             }
41              
42             sub set_words {
43 0     0 1 0 my ($self,$string,$amp) = @_;
44 0 0       0 unless ($amp) {
45 0         0 $self->set_raw(pack("f*",unpack("v*",$string)));
46             }
47             else {
48 0         0 $self->set_raw(pack("f*",map { $_ * $amp } unpack("v*",$string)));
  0         0  
49             }
50 0         0 return undef;
51             }
52              
53             sub set_list {
54 5     5 1 10099 my $self = shift;
55 5         67 $self->set_raw(pack("f*",@_));
56             }
57              
58             sub get_list {
59 5     5 1 12257 my ($self) = @_;
60 5 50       37 if ($self->filled) {
61 5         54 return unpack("f*",$self->get_raw);
62             }
63 0           return;
64             }
65              
66             sub set {
67 0     0 1   my $self = shift;
68 0 0         if (@_ > 1) {
69 0           $self->set_list(@_);
70 0           return;
71             }
72 0           $self->set_1($_[0]);
73             }
74              
75             sub get {
76 0     0 1   my ($self) = @_;
77 0 0         if (wantarray) {
78 0           return $self->get_list();
79             }
80             else {
81 0           return $self->get_1();
82             }
83             }
84              
85             __PACKAGE__->bootstrap($VERSION);
86              
87             use overload
88 13         3972 fallback => 1,
89             '*=' => \&is_mult,
90             '/=' => \&is_div,
91             '*' => \&mult,
92 13     13   3581 '/' => \÷
  13         2407  
93              
94              
95              
96              
97             1;
98              
99             __END__