c@35
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
c@35
|
2 /*
|
c@69
|
3 Constant-Q library
|
c@69
|
4 Copyright (c) 2013-2014 Queen Mary, University of London
|
c@69
|
5
|
c@35
|
6 Permission is hereby granted, free of charge, to any person
|
c@35
|
7 obtaining a copy of this software and associated documentation
|
c@35
|
8 files (the "Software"), to deal in the Software without
|
c@35
|
9 restriction, including without limitation the rights to use, copy,
|
c@35
|
10 modify, merge, publish, distribute, sublicense, and/or sell copies
|
c@35
|
11 of the Software, and to permit persons to whom the Software is
|
c@35
|
12 furnished to do so, subject to the following conditions:
|
c@35
|
13
|
c@35
|
14 The above copyright notice and this permission notice shall be
|
c@35
|
15 included in all copies or substantial portions of the Software.
|
c@35
|
16
|
c@35
|
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
c@35
|
18 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
c@35
|
19 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
c@69
|
20 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
c@69
|
21 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
c@35
|
22 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
c@35
|
23 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
c@69
|
24
|
c@69
|
25 Except as contained in this notice, the names of the Centre for
|
c@69
|
26 Digital Music; Queen Mary, University of London; and Chris Cannam
|
c@69
|
27 shall not be used in advertising or otherwise to promote the sale,
|
c@69
|
28 use or other dealings in this Software without prior written
|
c@69
|
29 authorization.
|
c@35
|
30 */
|
c@35
|
31
|
c@35
|
32 #include <vamp/vamp.h>
|
c@35
|
33 #include <vamp-sdk/PluginAdapter.h>
|
c@35
|
34
|
c@35
|
35 #include "CQVamp.h"
|
c@110
|
36 #include "CQChromaVamp.h"
|
c@35
|
37
|
c@109
|
38 class CQVampPluginAdapter : public Vamp::PluginAdapterBase
|
c@109
|
39 {
|
c@109
|
40 public:
|
c@109
|
41 CQVampPluginAdapter(bool midiPitchParameters) :
|
c@109
|
42 PluginAdapterBase(),
|
c@109
|
43 m_midiPitchParameters(midiPitchParameters)
|
c@109
|
44 { }
|
c@109
|
45
|
c@109
|
46 virtual ~CQVampPluginAdapter() { }
|
c@109
|
47
|
c@109
|
48 protected:
|
c@109
|
49 bool m_midiPitchParameters;
|
c@109
|
50
|
c@109
|
51 Vamp::Plugin *createPlugin(float inputSampleRate) {
|
c@109
|
52 return new CQVamp(inputSampleRate, m_midiPitchParameters);
|
c@109
|
53 }
|
c@109
|
54 };
|
c@109
|
55
|
c@109
|
56 static CQVampPluginAdapter midiAdapter(true);
|
c@109
|
57 static CQVampPluginAdapter hzAdapter(false);
|
c@110
|
58 static Vamp::PluginAdapter<CQChromaVamp> chromaAdapter;
|
c@35
|
59
|
c@35
|
60 const VampPluginDescriptor *
|
c@35
|
61 vampGetPluginDescriptor(unsigned int version, unsigned int index)
|
c@35
|
62 {
|
c@35
|
63 if (version < 1) return 0;
|
c@35
|
64
|
c@35
|
65 switch (index) {
|
c@109
|
66 case 0: return hzAdapter.getDescriptor();
|
c@109
|
67 case 1: return midiAdapter.getDescriptor();
|
c@110
|
68 case 2: return chromaAdapter.getDescriptor();
|
c@35
|
69 default: return 0;
|
c@35
|
70 }
|
c@35
|
71 }
|
c@35
|
72
|
c@35
|
73
|