comparison vamp-support/LoaderRequests.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 bf8e3e7dd7de
children 52322dde68ea
comparison
equal deleted inserted replaced
184:150cfa0c71e1 185:3eb00e5c76c4
128 } 128 }
129 129
130 ConfigurationResponse response; 130 ConfigurationResponse response;
131 131
132 response.plugin = req.plugin; 132 response.plugin = req.plugin;
133 133
134 if (req.configuration.framing.stepSize == 0 ||
135 req.configuration.framing.blockSize == 0) {
136 return response;
137 }
138
134 if (req.plugin->initialise(req.configuration.channelCount, 139 if (req.plugin->initialise(req.configuration.channelCount,
135 req.configuration.stepSize, 140 req.configuration.framing.stepSize,
136 req.configuration.blockSize)) { 141 req.configuration.framing.blockSize)) {
142
137 response.outputs = req.plugin->getOutputDescriptors(); 143 response.outputs = req.plugin->getOutputDescriptors();
138 } 144
145 // If the Vamp plugin initialise() call succeeds, then by
146 // definition it is accepting the step and block size
147 // passed in
148 response.framing = req.configuration.framing;
149
150 } else {
151
152 // If initialise() fails, one reason could be that it
153 // didn't like the passed-in step and block size. If we
154 // return its current preferred values here, the
155 // host/client can retry with these (if they differ)
156 response.framing.stepSize = req.plugin->getPreferredStepSize();
157 response.framing.blockSize = req.plugin->getPreferredBlockSize();
158 }
139 159
140 return response; 160 return response;
141 } 161 }
142 }; 162 };
143 163