-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsndfile.plug
76 lines (72 loc) · 2.99 KB
/
sndfile.plug
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# -*-Mode:Tcl-*-
#
# Copyright (C) 2012 Giampiero Salvi
#
# Based on Giulio Paci's libsndfile extension for snack
#
# Libsndfile blug-in for WaveSurfer
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
# -----------------------------------------------------------------------------
if [info exists ::wsurf::Info(CurrentPluginPath)] {
set dir [file dirname $::wsurf::Info(CurrentPluginPath)]
} else {
set dir [file dirname [info script]]
}
# try to load the package from the tcl-tk installation
set res [catch {package require snack_sndfile_ext}]
# if it didn't work, load the version coming with this plugin
if {$res} {
set shlib [file join $dir libsnack_sndfile_ext[info sharedlibextension]]
catch {load $shlib}
}
# here check if plugin is functional and add formats to wavesurfer as well
# as snack. This is redundant as it is already done when loading the package,
# but it is necessary to let wavesurfer aware of the format in case other
# plugins add their own formats.
if [info exists snack::snack_sndfile_ext::extTypes] {
wsurf::RegisterPlugin sndfile \
-description "This plug-in adds support for all the audio file\
formats supported by libsndfile. Note that the plug-in currently\
only supports reading the files.\
The plug-in has been developed by Giulio Paci, with valuable\
contributions from Giampiero Salvi.\
For more information http://www.mega-nerd.com/libsndfile/,\
https://github.com/snacksndfileext/SnackSndfileExt/.\
If you have any question, feel free to contact\
Giulio Paci <giuliopaci@gmail.com>." \
-url https://github.com/snacksndfileext/SnackSndfileExt/
if {![info exists ::surf(extTypes)]} {
set ::surf(extTypes) {}
}
if {![info exists ::surf(loadTypes)]} {
set ::surf(loadTypes) {}
}
if {![info exists ::surf(loadKeys)]} {
set ::surf(loadKeys) {}
}
set ::surf(extTypes) [concat $::surf(extTypes) \
$snack::snack_sndfile_ext::extTypes]
set ::surf(loadTypes) [concat $::surf(loadTypes) \
$snack::snack_sndfile_ext::loadTypes]
set ::surf(loadKeys) [concat $::surf(loadKeys) \
$snack::snack_sndfile_ext::loadKeys]
snack::addLoadTypes $::surf(loadTypes) $::surf(loadKeys)
snack::addExtTypes $::surf(extTypes)
} else {
wsurf::RegisterPlugin sndfile \
-description "Not functional. Could not find the libsnack_sndfile_ext library."
}