changeset 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 3e0794460c4e
files audioio/AudioGenerator.cpp audioio/AudioGenerator.h
diffstat 2 files changed, 7 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/audioio/AudioGenerator.cpp	Wed Apr 26 14:09:55 2006 +0000
+++ b/audioio/AudioGenerator.cpp	Wed Apr 26 16:00:13 2006 +0000
@@ -172,8 +172,8 @@
     return
         QString("<plugin configuration=\"%1\" program=\"%2\"/>")
         .arg(XmlExportable::encodeEntities
-             (QString("samplepath=%1")
-              .arg(PluginXml::encodeConfigurationChars(getSamplePath()))))
+             (QString("sampledir=%1")
+              .arg(PluginXml::encodeConfigurationChars(getSampleDir()))))
         .arg(XmlExportable::encodeEntities(program));
 }    
 
@@ -209,23 +209,10 @@
     return m_sampleDir;
 }
 
-QString
-AudioGenerator::getSamplePath()
+void
+AudioGenerator::setSampleDir(RealTimePluginInstance *plugin)
 {
-    QString samplePath = QString("%1:%2%3%4%5%6")
-        .arg(getSampleDir())
-        .arg(QDir::homePath())
-        .arg(QDir::separator())
-        .arg(".sv")
-        .arg(QDir::separator())
-        .arg("samples");
-    return samplePath;
-}
-
-void
-AudioGenerator::setSamplePath(RealTimePluginInstance *plugin)
-{
-    plugin->configure("samplepath", getSamplePath().toStdString());
+    plugin->configure("sampledir", getSampleDir().toStdString());
 } 
 
 RealTimePluginInstance *
@@ -281,7 +268,7 @@
 	std::cerr << "Failed to instantiate plugin " << pluginId.toStdString() << std::endl;
     }
 
-    setSamplePath(instance);
+    setSampleDir(instance);
 
     for (unsigned int i = 0; i < instance->getParameterCount(); ++i) {
         instance->setParameterValue(i, instance->getParameterDefault(i));
--- a/audioio/AudioGenerator.h	Wed Apr 26 14:09:55 2006 +0000
+++ b/audioio/AudioGenerator.h	Wed Apr 26 16:00:13 2006 +0000
@@ -123,8 +123,7 @@
     virtual RealTimePluginInstance *loadPluginFor(const Model *model);
     virtual RealTimePluginInstance *loadPlugin(QString id, QString program);
     static QString getSampleDir();
-    static QString getSamplePath();
-    static void setSamplePath(RealTimePluginInstance *plugin);
+    static void setSampleDir(RealTimePluginInstance *plugin);
 
     virtual size_t mixDenseTimeValueModel
     (DenseTimeValueModel *model, size_t startFrame, size_t frameCount,