Mercurial > hg > piper-cpp
comparison vamp-support/PluginConfiguration.h @ 185:3eb00e5c76c4
Pull step & block size out into framing struct, return in config
Update the C++ code to separate out the framing parameters (step and
block size) from the configuration structure into their own structure,
as in the latest schema, and to return the accepted framing params in
the configuration response.
This also implies that the plugin stub (which adapts Piper API
back to Vamp) makes a note of the returned values,
making them available via its own getPreferredStep/BlockSize
so that the host can retry the initialise call in the case where it
failed for having the wrong values first time.
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Fri, 03 Feb 2017 16:23:21 +0000 |
parents | 427c4c725085 |
children | ad6025dc0b04 |
comparison
equal
deleted
inserted
replaced
184:150cfa0c71e1 | 185:3eb00e5c76c4 |
---|---|
43 #include <string> | 43 #include <string> |
44 | 44 |
45 namespace piper_vamp { | 45 namespace piper_vamp { |
46 | 46 |
47 /** | 47 /** |
48 * \struct Framing | |
49 * | |
50 * A structure bundling the processing step and block size. | |
51 */ | |
52 struct Framing | |
53 { | |
54 Framing() : // invalid by default | |
55 stepSize(0), blockSize(0) { } | |
56 | |
57 int stepSize; | |
58 int blockSize; | |
59 }; | |
60 | |
61 /** | |
48 * \class PluginConfiguration | 62 * \class PluginConfiguration |
49 * | 63 * |
50 * PluginConfiguration is a structure bundling together data that | 64 * PluginConfiguration is a structure bundling together data that |
51 * affect the configuration of a plugin: parameter values, programs, | 65 * affect the configuration of a plugin: parameter values, programs, |
52 * and initialisation settings. Although an interactive Vamp plugin | 66 * and initialisation settings. Although an interactive Vamp plugin |
57 * configuration settings together. | 71 * configuration settings together. |
58 */ | 72 */ |
59 struct PluginConfiguration | 73 struct PluginConfiguration |
60 { | 74 { |
61 PluginConfiguration() : // invalid configuration by default | 75 PluginConfiguration() : // invalid configuration by default |
62 channelCount(0), stepSize(0), blockSize(0) { } | 76 channelCount(0) { } |
63 | 77 |
64 int channelCount; | 78 int channelCount; |
65 int stepSize; | 79 Framing framing; |
66 int blockSize; | |
67 typedef std::map<std::string, float> ParameterMap; | 80 typedef std::map<std::string, float> ParameterMap; |
68 ParameterMap parameterValues; | 81 ParameterMap parameterValues; |
69 std::string currentProgram; | 82 std::string currentProgram; |
70 | 83 |
71 static PluginConfiguration | 84 static PluginConfiguration |
75 int blockSize) { | 88 int blockSize) { |
76 | 89 |
77 PluginConfiguration c; | 90 PluginConfiguration c; |
78 | 91 |
79 c.channelCount = channelCount; | 92 c.channelCount = channelCount; |
80 c.stepSize = stepSize; | 93 c.framing.stepSize = stepSize; |
81 c.blockSize = blockSize; | 94 c.framing.blockSize = blockSize; |
82 | 95 |
83 Vamp::PluginBase::ParameterList params = p->getParameterDescriptors(); | 96 Vamp::PluginBase::ParameterList params = p->getParameterDescriptors(); |
84 for (Vamp::PluginBase::ParameterList::const_iterator i = params.begin(); | 97 for (Vamp::PluginBase::ParameterList::const_iterator i = params.begin(); |
85 i != params.end(); ++i) { | 98 i != params.end(); ++i) { |
86 std::string pid = i->identifier; | 99 std::string pid = i->identifier; |