Mercurial > hg > svapp
comparison audioio/AudioGenerator.cpp @ 276:64724dbc5f05 tonioni
Some debug and warnings
author | Chris Cannam |
---|---|
date | Mon, 15 Apr 2013 17:38:17 +0100 |
parents | 8aace2d9f1c2 |
children | e647e880e711 |
comparison
equal
deleted
inserted
replaced
273:6bbf62a333c1 | 276:64724dbc5f05 |
---|---|
202 if (parameters) { | 202 if (parameters) { |
203 pluginId = parameters->getPlayPluginId(); | 203 pluginId = parameters->getPlayPluginId(); |
204 configurationXml = parameters->getPlayPluginConfiguration(); | 204 configurationXml = parameters->getPlayPluginConfiguration(); |
205 } | 205 } |
206 | 206 |
207 if (pluginId == "") return 0; | 207 std::cerr << "AudioGenerator::loadPluginFor(" << model << "): id = " << pluginId << std::endl; |
208 | |
209 if (pluginId == "") { | |
210 SVDEBUG << "AudioGenerator::loadPluginFor(" << model << "): parameters contain empty plugin ID, skipping" << endl; | |
211 return 0; | |
212 } | |
208 | 213 |
209 RealTimePluginInstance *plugin = loadPlugin(pluginId, ""); | 214 RealTimePluginInstance *plugin = loadPlugin(pluginId, ""); |
210 if (!plugin) return 0; | 215 if (!plugin) return 0; |
216 | |
217 std::cerr << "AudioGenerator::loadPluginFor(" << model << "): loaded plugin " | |
218 << plugin << std::endl; | |
211 | 219 |
212 if (configurationXml != "") { | 220 if (configurationXml != "") { |
213 PluginXml(plugin).setParametersFromXml(configurationXml); | 221 PluginXml(plugin).setParametersFromXml(configurationXml); |
214 setSampleDir(plugin); | 222 setSampleDir(plugin); |
215 } | 223 } |
230 RealTimePluginFactory *factory = | 238 RealTimePluginFactory *factory = |
231 RealTimePluginFactory::instanceFor(pluginId); | 239 RealTimePluginFactory::instanceFor(pluginId); |
232 | 240 |
233 if (!factory) { | 241 if (!factory) { |
234 std::cerr << "Failed to get plugin factory" << std::endl; | 242 std::cerr << "Failed to get plugin factory" << std::endl; |
235 return false; | 243 return 0; |
236 } | 244 } |
237 | 245 |
238 RealTimePluginInstance *instance = | 246 RealTimePluginInstance *instance = |
239 factory->instantiatePlugin | 247 factory->instantiatePlugin |
240 (pluginId, 0, 0, m_sourceSampleRate, m_pluginBlockSize, m_targetChannelCount); | 248 (pluginId, 0, 0, m_sourceSampleRate, m_pluginBlockSize, m_targetChannelCount); |
249 for (unsigned int i = 0; i < instance->getParameterCount(); ++i) { | 257 for (unsigned int i = 0; i < instance->getParameterCount(); ++i) { |
250 instance->setParameterValue(i, instance->getParameterDefault(i)); | 258 instance->setParameterValue(i, instance->getParameterDefault(i)); |
251 } | 259 } |
252 std::string defaultProgram = instance->getProgram(0, 0); | 260 std::string defaultProgram = instance->getProgram(0, 0); |
253 if (defaultProgram != "") { | 261 if (defaultProgram != "") { |
254 // std::cerr << "first selecting default program " << defaultProgram << std::endl; | 262 std::cerr << "first selecting default program " << defaultProgram << std::endl; |
255 instance->selectProgram(defaultProgram); | 263 instance->selectProgram(defaultProgram); |
256 } | 264 } |
257 if (program != "") { | 265 if (program != "") { |
258 // std::cerr << "now selecting desired program " << program << std::endl; | 266 std::cerr << "now selecting desired program " << program << std::endl; |
259 instance->selectProgram(program.toStdString()); | 267 instance->selectProgram(program.toStdString()); |
260 } | 268 } |
261 instance->setIdealChannelCount(m_targetChannelCount); // reset! | 269 instance->setIdealChannelCount(m_targetChannelCount); // reset! |
262 | 270 |
263 return instance; | 271 return instance; |
397 NoteModel *nm = dynamic_cast<NoteModel *>(model); | 405 NoteModel *nm = dynamic_cast<NoteModel *>(model); |
398 if (nm) { | 406 if (nm) { |
399 return mixNoteModel(nm, startFrame, frameCount, | 407 return mixNoteModel(nm, startFrame, frameCount, |
400 buffer, gain, pan, fadeIn, fadeOut); | 408 buffer, gain, pan, fadeIn, fadeOut); |
401 } | 409 } |
410 | |
411 std::cerr << "AudioGenerator::mixModel: WARNING: Model " << model << " of type " << model->getTypeName() << " is marked as playable, but I have no mechanism to play it" << std::endl; | |
402 | 412 |
403 return frameCount; | 413 return frameCount; |
404 } | 414 } |
405 | 415 |
406 size_t | 416 size_t |