Mercurial > hg > svapp
comparison audioio/AudioGenerator.cpp @ 32:42989c2e621b
* Fix crash in spectrogram layer when replacing model
* Change sample player's sample path to a single sample directory.
This makes it immune to OS path separator differences, and ensures
it can reject configure calls that try to set a nonexistent directory.
Reloading play parameters (e.g. sample program) should now work.
* some win32 fixes.
author | Chris Cannam |
---|---|
date | Wed, 26 Apr 2006 16:00:13 +0000 |
parents | b1112948724f |
children | f6b15e0b6fde |
comparison
equal
deleted
inserted
replaced
31:b1112948724f | 32:42989c2e621b |
---|---|
170 if (program == "") return ""; | 170 if (program == "") return ""; |
171 | 171 |
172 return | 172 return |
173 QString("<plugin configuration=\"%1\" program=\"%2\"/>") | 173 QString("<plugin configuration=\"%1\" program=\"%2\"/>") |
174 .arg(XmlExportable::encodeEntities | 174 .arg(XmlExportable::encodeEntities |
175 (QString("samplepath=%1") | 175 (QString("sampledir=%1") |
176 .arg(PluginXml::encodeConfigurationChars(getSamplePath())))) | 176 .arg(PluginXml::encodeConfigurationChars(getSampleDir())))) |
177 .arg(XmlExportable::encodeEntities(program)); | 177 .arg(XmlExportable::encodeEntities(program)); |
178 } | 178 } |
179 | 179 |
180 QString | 180 QString |
181 AudioGenerator::getSampleDir() | 181 AudioGenerator::getSampleDir() |
207 } | 207 } |
208 | 208 |
209 return m_sampleDir; | 209 return m_sampleDir; |
210 } | 210 } |
211 | 211 |
212 QString | |
213 AudioGenerator::getSamplePath() | |
214 { | |
215 QString samplePath = QString("%1:%2%3%4%5%6") | |
216 .arg(getSampleDir()) | |
217 .arg(QDir::homePath()) | |
218 .arg(QDir::separator()) | |
219 .arg(".sv") | |
220 .arg(QDir::separator()) | |
221 .arg("samples"); | |
222 return samplePath; | |
223 } | |
224 | |
225 void | 212 void |
226 AudioGenerator::setSamplePath(RealTimePluginInstance *plugin) | 213 AudioGenerator::setSampleDir(RealTimePluginInstance *plugin) |
227 { | 214 { |
228 plugin->configure("samplepath", getSamplePath().toStdString()); | 215 plugin->configure("sampledir", getSampleDir().toStdString()); |
229 } | 216 } |
230 | 217 |
231 RealTimePluginInstance * | 218 RealTimePluginInstance * |
232 AudioGenerator::loadPluginFor(const Model *model) | 219 AudioGenerator::loadPluginFor(const Model *model) |
233 { | 220 { |
279 | 266 |
280 if (!instance) { | 267 if (!instance) { |
281 std::cerr << "Failed to instantiate plugin " << pluginId.toStdString() << std::endl; | 268 std::cerr << "Failed to instantiate plugin " << pluginId.toStdString() << std::endl; |
282 } | 269 } |
283 | 270 |
284 setSamplePath(instance); | 271 setSampleDir(instance); |
285 | 272 |
286 for (unsigned int i = 0; i < instance->getParameterCount(); ++i) { | 273 for (unsigned int i = 0; i < instance->getParameterCount(); ++i) { |
287 instance->setParameterValue(i, instance->getParameterDefault(i)); | 274 instance->setParameterValue(i, instance->getParameterDefault(i)); |
288 } | 275 } |
289 std::string defaultProgram = instance->getProgram(0, 0); | 276 std::string defaultProgram = instance->getProgram(0, 0); |