Chris@0
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 Piper
|
Chris@0
|
5
|
Chris@0
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@0
|
7 Copyright 2015-2016 QMUL.
|
Chris@0
|
8
|
Chris@0
|
9 Permission is hereby granted, free of charge, to any person
|
Chris@0
|
10 obtaining a copy of this software and associated documentation
|
Chris@0
|
11 files (the "Software"), to deal in the Software without
|
Chris@0
|
12 restriction, including without limitation the rights to use, copy,
|
Chris@0
|
13 modify, merge, publish, distribute, sublicense, and/or sell copies
|
Chris@0
|
14 of the Software, and to permit persons to whom the Software is
|
Chris@0
|
15 furnished to do so, subject to the following conditions:
|
Chris@0
|
16
|
Chris@0
|
17 The above copyright notice and this permission notice shall be
|
Chris@0
|
18 included in all copies or substantial portions of the Software.
|
Chris@0
|
19
|
Chris@0
|
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
Chris@0
|
21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
Chris@0
|
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
Chris@0
|
23 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
|
Chris@0
|
24 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
Chris@0
|
25 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
Chris@0
|
26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Chris@0
|
27
|
Chris@0
|
28 Except as contained in this notice, the names of the Centre for
|
Chris@0
|
29 Digital Music; Queen Mary, University of London; and Chris Cannam
|
Chris@0
|
30 shall not be used in advertising or otherwise to promote the sale,
|
Chris@0
|
31 use or other dealings in this Software without prior written
|
Chris@0
|
32 authorization.
|
Chris@0
|
33 */
|
Chris@0
|
34
|
Chris@0
|
35 #include "PiperAdapter.h"
|
Chris@0
|
36 #include "PiperPluginLibrary.h"
|
Chris@0
|
37
|
Chris@0
|
38 #include "plugins/BeatTrack.h"
|
Chris@0
|
39 #include "plugins/OnsetDetect.h"
|
Chris@0
|
40 #include "plugins/ChromagramPlugin.h"
|
Chris@0
|
41 #include "plugins/ConstantQSpectrogram.h"
|
Chris@0
|
42 #include "plugins/TonalChangeDetect.h"
|
Chris@0
|
43 #include "plugins/KeyDetect.h"
|
Chris@0
|
44 #include "plugins/MFCCPlugin.h"
|
Chris@0
|
45 #include "plugins/SegmenterPlugin.h"
|
Chris@0
|
46 #include "plugins/SimilarityPlugin.h"
|
Chris@0
|
47 #include "plugins/BarBeatTrack.h"
|
Chris@0
|
48 //!!!#include "plugins/AdaptiveSpectrogram.h"
|
Chris@0
|
49 #include "plugins/DWT.h"
|
Chris@0
|
50 #include "plugins/Transcription.h"
|
Chris@0
|
51
|
Chris@2
|
52 using piper_vamp_js::PiperAdapter;
|
Chris@2
|
53 using piper_vamp_js::PiperPluginLibrary;
|
Chris@0
|
54
|
Chris@0
|
55 static std::string soname("qm-vamp-plugins");
|
Chris@0
|
56
|
Chris@0
|
57 static PiperAdapter<BeatTracker> beatTrackerAdapter(soname);
|
Chris@0
|
58 static PiperAdapter<OnsetDetector> onsetDetectorAdapter(soname);
|
Chris@0
|
59 static PiperAdapter<ChromagramPlugin> chromagramPluginAdapter(soname);
|
Chris@0
|
60 static PiperAdapter<ConstantQSpectrogram> constantQAdapter(soname);
|
Chris@0
|
61 static PiperAdapter<TonalChangeDetect> tonalChangeDetectorAdapter(soname);
|
Chris@0
|
62 static PiperAdapter<KeyDetector> keyDetectorAdapter(soname);
|
Chris@0
|
63 static PiperAdapter<MFCCPlugin> mfccPluginAdapter(soname);
|
Chris@0
|
64 static PiperAdapter<SegmenterPlugin> segmenterPluginAdapter(soname);
|
Chris@0
|
65 static PiperAdapter<SimilarityPlugin> similarityPluginAdapter(soname);
|
Chris@0
|
66 static PiperAdapter<BarBeatTracker> barBeatTrackPluginAdapter(soname);
|
Chris@0
|
67 //!!!static PiperAdapter<AdaptiveSpectrogram> adaptiveSpectrogramAdapter(soname);
|
Chris@0
|
68 static PiperAdapter<DWT> dwtAdapter(soname);
|
Chris@0
|
69 static PiperAdapter<Transcription> transcriptionAdapter(soname);
|
Chris@0
|
70
|
Chris@0
|
71 static PiperPluginLibrary library({
|
Chris@0
|
72 &beatTrackerAdapter,
|
Chris@0
|
73 &onsetDetectorAdapter,
|
Chris@0
|
74 &chromagramPluginAdapter,
|
Chris@0
|
75 &constantQAdapter,
|
Chris@0
|
76 &tonalChangeDetectorAdapter,
|
Chris@0
|
77 &keyDetectorAdapter,
|
Chris@0
|
78 &mfccPluginAdapter,
|
Chris@0
|
79 &segmenterPluginAdapter,
|
Chris@0
|
80 &similarityPluginAdapter,
|
Chris@0
|
81 &barBeatTrackPluginAdapter,
|
Chris@0
|
82 //!!! &adaptiveSpectrogramAdapter,
|
Chris@0
|
83 &dwtAdapter,
|
Chris@0
|
84 &transcriptionAdapter
|
Chris@0
|
85 });
|
Chris@0
|
86
|
Chris@0
|
87 extern "C" {
|
Chris@0
|
88
|
Chris@0
|
89 const char *piperRequestJson(const char *request) {
|
Chris@0
|
90 return library.requestJson(request);
|
Chris@0
|
91 }
|
Chris@0
|
92
|
Chris@0
|
93 const char *piperProcessRaw(int handle,
|
Chris@0
|
94 const float *const *inputBuffers,
|
Chris@0
|
95 int sec,
|
Chris@0
|
96 int nsec) {
|
Chris@0
|
97 return library.processRaw(handle, inputBuffers, sec, nsec);
|
Chris@0
|
98 }
|
Chris@0
|
99
|
Chris@0
|
100 void piperFreeJson(const char *json) {
|
Chris@0
|
101 return library.freeJson(json);
|
Chris@0
|
102 }
|
Chris@0
|
103
|
Chris@0
|
104 }
|
Chris@0
|
105
|