comparison vamp-client/PluginStub.h @ 188:90c962b68d7f

Merge pull request #2 from piper-audio/dev/step-and-block-size Pull step & block size out into framing struct, return in config
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 06 Feb 2017 12:04:25 +0000
parents 3eb00e5c76c4
children 52322dde68ea
comparison
equal deleted inserted replaced
184:150cfa0c71e1 188:90c962b68d7f
161 m_state = Failed; 161 m_state = Failed;
162 throw std::logic_error("Plugin has already been initialised"); 162 throw std::logic_error("Plugin has already been initialised");
163 } 163 }
164 164
165 m_config.channelCount = int(inputChannels); 165 m_config.channelCount = int(inputChannels);
166 m_config.stepSize = int(stepSize); 166 m_config.framing.stepSize = int(stepSize);
167 m_config.blockSize = int(blockSize); 167 m_config.framing.blockSize = int(blockSize);
168 168
169 try { 169 try {
170 m_outputs = m_client->configure(this, m_config); 170 auto response = m_client->configure(this, m_config);
171 m_outputs = response.outputs;
172
173 // Update with the new preferred step and block size now
174 // that the plugin has taken into account its parameter
175 // settings. If the values passed in to initialise()
176 // weren't suitable, then this ensures that a subsequent
177 // call to getPreferredStepSize/BlockSize on this plugin
178 // object will at least get acceptable values from now on
179 m_config.framing = response.framing;
180
171 } catch (const std::exception &e) { 181 } catch (const std::exception &e) {
172 m_state = Failed; 182 m_state = Failed;
173 throw; 183 throw;
174 } 184 }
175 185
204 virtual InputDomain getInputDomain() const { 214 virtual InputDomain getInputDomain() const {
205 return m_psd.inputDomain; 215 return m_psd.inputDomain;
206 } 216 }
207 217
208 virtual size_t getPreferredBlockSize() const { 218 virtual size_t getPreferredBlockSize() const {
209 return m_defaultConfig.blockSize; 219 // Return this from m_config instead of m_defaultConfig, so
220 // that it gets updated in the event of an initialise() call
221 // that fails for the wrong value
222 return m_config.framing.blockSize;
210 } 223 }
211 224
212 virtual size_t getPreferredStepSize() const { 225 virtual size_t getPreferredStepSize() const {
213 return m_defaultConfig.stepSize; 226 // Return this from m_config instead of m_defaultConfig, so
227 // that it gets updated in the event of an initialise() call
228 // that fails for the wrong value
229 return m_config.framing.stepSize;
214 } 230 }
215 231
216 virtual size_t getMinChannelCount() const { 232 virtual size_t getMinChannelCount() const {
217 return m_psd.minChannelCount; 233 return m_psd.minChannelCount;
218 } 234 }
263 279
264 std::vector<std::vector<float> > vecbuf; 280 std::vector<std::vector<float> > vecbuf;
265 for (int c = 0; c < m_config.channelCount; ++c) { 281 for (int c = 0; c < m_config.channelCount; ++c) {
266 vecbuf.push_back(std::vector<float> 282 vecbuf.push_back(std::vector<float>
267 (inputBuffers[c], 283 (inputBuffers[c],
268 inputBuffers[c] + m_config.blockSize)); 284 inputBuffers[c] + m_config.framing.blockSize));
269 } 285 }
270 286
271 try { 287 try {
272 return m_client->process(this, vecbuf, timestamp); 288 return m_client->process(this, vecbuf, timestamp);
273 } catch (const std::exception &e) { 289 } catch (const std::exception &e) {