Chris@423
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@423
|
2
|
Chris@423
|
3 /*
|
Chris@423
|
4 Vamp
|
Chris@423
|
5
|
Chris@423
|
6 An API for audio analysis and feature extraction plugins.
|
Chris@423
|
7
|
Chris@423
|
8 Centre for Digital Music, Queen Mary, University of London.
|
Chris@423
|
9 Copyright 2006-2016 Chris Cannam and QMUL.
|
Chris@423
|
10
|
Chris@423
|
11 Permission is hereby granted, free of charge, to any person
|
Chris@423
|
12 obtaining a copy of this software and associated documentation
|
Chris@423
|
13 files (the "Software"), to deal in the Software without
|
Chris@423
|
14 restriction, including without limitation the rights to use, copy,
|
Chris@423
|
15 modify, merge, publish, distribute, sublicense, and/or sell copies
|
Chris@423
|
16 of the Software, and to permit persons to whom the Software is
|
Chris@423
|
17 furnished to do so, subject to the following conditions:
|
Chris@423
|
18
|
Chris@423
|
19 The above copyright notice and this permission notice shall be
|
Chris@423
|
20 included in all copies or substantial portions of the Software.
|
Chris@423
|
21
|
Chris@423
|
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
Chris@423
|
23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
Chris@423
|
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
Chris@423
|
25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
|
Chris@423
|
26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
Chris@423
|
27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
Chris@423
|
28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Chris@423
|
29
|
Chris@423
|
30 Except as contained in this notice, the names of the Centre for
|
Chris@423
|
31 Digital Music; Queen Mary, University of London; and Chris Cannam
|
Chris@423
|
32 shall not be used in advertising or otherwise to promote the sale,
|
Chris@423
|
33 use or other dealings in this Software without prior written
|
Chris@423
|
34 authorization.
|
Chris@423
|
35 */
|
Chris@423
|
36
|
Chris@423
|
37 #ifndef VAMP_PLUGIN_CONFIGURATION_H
|
Chris@423
|
38 #define VAMP_PLUGIN_CONFIGURATION_H
|
Chris@423
|
39
|
Chris@423
|
40 #include "hostguard.h"
|
Chris@423
|
41
|
Chris@428
|
42 #include "Plugin.h"
|
Chris@428
|
43
|
Chris@423
|
44 #include <map>
|
Chris@423
|
45 #include <string>
|
Chris@423
|
46
|
Chris@423
|
47 _VAMP_SDK_HOSTSPACE_BEGIN(PluginConfiguration.h)
|
Chris@423
|
48
|
Chris@423
|
49 namespace Vamp {
|
Chris@423
|
50
|
Chris@423
|
51 namespace HostExt {
|
Chris@423
|
52
|
Chris@423
|
53 /**
|
Chris@423
|
54 * \class PluginConfiguration PluginConfiguration.h <vamp-hostsdk/PluginConfiguration.h>
|
Chris@423
|
55 *
|
Chris@423
|
56 * Vamp::HostExt::PluginConfiguration is a structure bundling together
|
Chris@423
|
57 * data that affect the configuration of a plugin: parameter values,
|
Chris@423
|
58 * programs, and initialisation settings. Although an interactive Vamp
|
Chris@423
|
59 * plugin host may configure a plugin in stages, for example to take
|
Chris@423
|
60 * into account that a plugin's preferred step and block size may
|
Chris@423
|
61 * change when its parameters are changed, a batch host or a host
|
Chris@423
|
62 * supporting store and recall of configurations may wish to keep all
|
Chris@423
|
63 * configuration settings together.
|
Chris@423
|
64 *
|
Chris@423
|
65 * \note This class was introduced in version 2.7 of the Vamp plugin
|
Chris@423
|
66 * SDK.
|
Chris@423
|
67 */
|
Chris@423
|
68 struct PluginConfiguration
|
Chris@423
|
69 {
|
Chris@423
|
70 PluginConfiguration() : // invalid configuration by default
|
Chris@423
|
71 channelCount(0), stepSize(0), blockSize(0) { }
|
Chris@423
|
72
|
Chris@423
|
73 int channelCount;
|
Chris@423
|
74 int stepSize;
|
Chris@423
|
75 int blockSize;
|
Chris@423
|
76 typedef std::map<std::string, float> ParameterMap;
|
Chris@423
|
77 ParameterMap parameterValues;
|
Chris@423
|
78 std::string currentProgram;
|
Chris@423
|
79
|
Chris@423
|
80 static PluginConfiguration
|
Chris@423
|
81 fromPlugin(Plugin *p,
|
Chris@423
|
82 int channelCount,
|
Chris@423
|
83 int stepSize,
|
Chris@423
|
84 int blockSize) {
|
Chris@423
|
85
|
Chris@423
|
86 PluginConfiguration c;
|
Chris@423
|
87
|
Chris@423
|
88 c.channelCount = channelCount;
|
Chris@423
|
89 c.stepSize = stepSize;
|
Chris@423
|
90 c.blockSize = blockSize;
|
Chris@423
|
91
|
Chris@423
|
92 PluginBase::ParameterList params = p->getParameterDescriptors();
|
Chris@423
|
93 for (PluginBase::ParameterList::const_iterator i = params.begin();
|
Chris@423
|
94 i != params.end(); ++i) {
|
Chris@423
|
95 std::string pid = i->identifier;
|
Chris@423
|
96 c.parameterValues[pid] = p->getParameter(pid);
|
Chris@423
|
97 }
|
Chris@423
|
98
|
Chris@423
|
99 if (!p->getPrograms().empty()) {
|
Chris@423
|
100 c.currentProgram = p->getCurrentProgram();
|
Chris@423
|
101 }
|
Chris@423
|
102
|
Chris@423
|
103 return c;
|
Chris@423
|
104 }
|
Chris@423
|
105 };
|
Chris@423
|
106
|
Chris@423
|
107 }
|
Chris@423
|
108
|
Chris@423
|
109 }
|
Chris@423
|
110
|
Chris@423
|
111 _VAMP_SDK_HOSTSPACE_END(PluginConfiguration.h)
|
Chris@423
|
112
|
Chris@423
|
113 #endif
|