| 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::LibraryLoader; |
|
23
|
11
|
|
|
11
|
|
58
|
use strict; |
|
|
11
|
|
|
|
|
19
|
|
|
|
11
|
|
|
|
|
432
|
|
|
24
|
11
|
|
|
11
|
|
57
|
use base qw(DynaLoader); |
|
|
11
|
|
|
|
|
20
|
|
|
|
11
|
|
|
|
|
1482
|
|
|
25
|
11
|
|
|
11
|
|
66
|
use Carp; |
|
|
11
|
|
|
|
|
20
|
|
|
|
11
|
|
|
|
|
1455
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $VERSION = "0.021"; |
|
28
|
11
|
|
|
11
|
|
6023
|
use Audio::LADSPA::Library; |
|
|
11
|
|
|
|
|
68
|
|
|
|
11
|
|
|
|
|
278
|
|
|
29
|
11
|
|
|
11
|
|
12546
|
use Audio::LADSPA::Plugin::XS; |
|
|
11
|
|
|
|
|
38
|
|
|
|
11
|
|
|
|
|
519
|
|
|
30
|
11
|
|
|
11
|
|
81
|
use Config; |
|
|
11
|
|
|
|
|
20
|
|
|
|
11
|
|
|
|
|
4896
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub find_libraries { |
|
33
|
22
|
|
|
|
|
59
|
my @libs = map { |
|
34
|
11
|
|
50
|
11
|
0
|
197
|
find_libraries_in_dir($_) |
|
35
|
|
|
|
|
|
|
} split/:/,($ENV{LADSPA_PATH} || '/usr/lib/ladspa:/usr/local/lib/ladspa'); |
|
36
|
11
|
50
|
|
|
|
53
|
unless (scalar @libs) { |
|
37
|
11
|
50
|
|
|
|
47
|
if ($ENV{LADSPA_PATH}) { |
|
38
|
0
|
|
|
|
|
0
|
carp "No libraries found in LADSPA_PATH ($ENV{LADSPA_PATH})"; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
else { |
|
41
|
11
|
|
|
|
|
13024
|
carp "No libraries found in /usr/lib/ladspa and /usr/local/lib/ladspa. Please set LADSPA_PATH."; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
} |
|
44
|
11
|
|
|
|
|
74
|
return @libs; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub find_libraries_in_dir { |
|
48
|
22
|
|
|
22
|
0
|
39
|
my $dir = shift; |
|
49
|
22
|
50
|
|
|
|
876
|
opendir D,$dir or return; |
|
50
|
0
|
|
|
|
|
|
my @files = map "$dir/$_",grep /\.$Config{so}$/, readdir(D); |
|
51
|
0
|
|
|
|
|
|
closedir D; |
|
52
|
0
|
|
|
|
|
|
@files; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub load { |
|
57
|
0
|
|
|
0
|
0
|
|
my ($self,$library_path) = @_; |
|
58
|
0
|
0
|
|
|
|
|
$library_path =~ /([\w\-\+]+)\.($Config{so})$/ or die "Cannot form a package name from $library_path"; |
|
59
|
0
|
|
|
|
|
|
my $package = "Audio::LADSPA::Library::$1"; |
|
60
|
0
|
0
|
|
|
|
|
if ($package->can("library_file")) { |
|
61
|
|
|
|
|
|
|
# warn "Already made a package $package for ".$package->library_file.", skipping $library_path"; |
|
62
|
0
|
|
|
|
|
|
return; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
# warn "loading $library_path to $package\n"; |
|
65
|
|
|
|
|
|
|
$self->load_lib_to_package( |
|
66
|
0
|
|
|
|
|
|
$library_path, |
|
67
|
|
|
|
|
|
|
$package, |
|
68
|
|
|
|
|
|
|
); |
|
69
|
0
|
|
|
|
|
|
return $package; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Audio::LADSPA::LibraryLoader->bootstrap($VERSION); |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
|
76
|
|
|
|
|
|
|
|