changeset 117:c30728d5625c sv1-v0.9rc1

* Make vertical scale alignment modes work in note layer as well as time-value layer, and several significant fixes to it * Make it possible to draw notes properly on the note layer * Show units (and frequencies etc in note layer's case) in the time-value and note layer description boxes * Minor fix to item edit dialog layout * Some minor menu rearrangement * Comment out a lot of debug output * Add SV website and reference URLs to Help menu, and add code to (attempt to) open them in the user's preferred browser
author Chris Cannam
date Fri, 12 May 2006 14:40:43 +0000
parents a08718723b20
children 4170b21773cf
files base/CommandHistory.cpp base/Layer.cpp base/Layer.h base/Model.cpp base/PlayParameterRepository.cpp base/PlayParameters.cpp base/View.cpp base/View.h plugin/DSSIPluginInstance.cpp plugin/FeatureExtractionPluginFactory.cpp plugin/FeatureExtractionPluginFactory.h plugin/LADSPAPluginInstance.cpp plugin/PluginXml.cpp plugin/RealTimePluginFactory.cpp plugin/RealTimePluginInstance.cpp plugin/plugins/SamplePlayer.cpp transform/FeatureExtractionPluginTransform.cpp transform/TransformFactory.cpp
diffstat 18 files changed, 86 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/base/CommandHistory.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/base/CommandHistory.cpp	Fri May 12 14:40:43 2006 +0000
@@ -386,7 +386,7 @@
     while (!stack.empty()) {
 	Command *command = stack.top();
 	// Not safe to call getName() on a command about to be deleted
-	std::cerr << "CommandHistory::clearStack: About to delete command " << command << std::endl;
+//	std::cerr << "CommandHistory::clearStack: About to delete command " << command << std::endl;
 	delete command;
 	stack.pop();
     }
--- a/base/Layer.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/base/Layer.cpp	Fri May 12 14:40:43 2006 +0000
@@ -28,7 +28,7 @@
 
 Layer::~Layer()
 {
-    std::cerr << "Layer::~Layer(" << this << ")" << std::endl;
+//    std::cerr << "Layer::~Layer(" << this << ")" << std::endl;
 }
 
 QString
--- a/base/Layer.h	Thu May 11 15:02:14 2006 +0000
+++ b/base/Layer.h	Fri May 12 14:40:43 2006 +0000
@@ -232,7 +232,12 @@
 
     virtual bool needsTextLabelHeight() const { return false; }
 
-    virtual bool getValueExtents(float &min, float &max, QString &unit) const = 0;
+    virtual bool getValueExtents(float &min, float &max,
+                                 bool &logarithmic, QString &unit) const = 0;
+
+    virtual bool getDisplayExtents(float &min, float &max) const {
+        return false;
+    }
 
 public slots:
     void showLayer(View *, bool show);
--- a/base/Model.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/base/Model.cpp	Fri May 12 14:40:43 2006 +0000
@@ -22,7 +22,7 @@
 
 Model::~Model()
 {
-    std::cerr << "Model::~Model(" << this << ")" << std::endl;
+//    std::cerr << "Model::~Model(" << this << ")" << std::endl;
 
     // Subclasses have to handle adding themselves to the repository,
     // if they want to be played.  We can't do it from here because
--- a/base/PlayParameterRepository.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/base/PlayParameterRepository.cpp	Fri May 12 14:40:43 2006 +0000
@@ -39,7 +39,7 @@
 void
 PlayParameterRepository::addModel(const Model *model)
 {
-    std::cerr << "PlayParameterRepository:addModel " << model <<  std::endl;
+//    std::cerr << "PlayParameterRepository:addModel " << model <<  std::endl;
 
     if (!getPlayParameters(model)) {
 
@@ -48,7 +48,7 @@
 
 	if (AudioGenerator::canPlay(model)) {
 
-	    std::cerr << "PlayParameterRepository: Adding play parameters for " << model << std::endl;
+//	    std::cerr << "PlayParameterRepository: Adding play parameters for " << model << std::endl;
 
             PlayParameters *params = new PlayParameters;
 	    m_playParameters[model] = params;
@@ -68,12 +68,12 @@
 	    connect(params, SIGNAL(playPluginConfigurationChanged(QString)),
 		    this, SLOT(playPluginConfigurationChanged(QString)));
 
-            std::cerr << "Connected play parameters " << params << " for model "
-                      << model << " to this " << this << std::endl;
+//            std::cerr << "Connected play parameters " << params << " for model "
+//                      << model << " to this " << this << std::endl;
 
 	} else {
 
-	    std::cerr << "PlayParameterRepository: Model " << model << " not playable" <<  std::endl;
+//	    std::cerr << "PlayParameterRepository: Model " << model << " not playable" <<  std::endl;
 	}	    
     }
 }    
@@ -116,7 +116,7 @@
 PlayParameterRepository::playPluginConfigurationChanged(QString config)
 {
     PlayParameters *params = dynamic_cast<PlayParameters *>(sender());
-    std::cerr << "PlayParameterRepository::playPluginConfigurationChanged" << std::endl;
+//    std::cerr << "PlayParameterRepository::playPluginConfigurationChanged" << std::endl;
     for (ModelParameterMap::iterator i = m_playParameters.begin();
          i != m_playParameters.end(); ++i) {
         if (i->second == params) {
@@ -129,7 +129,7 @@
 void
 PlayParameterRepository::clear()
 {
-    std::cerr << "PlayParameterRepository: PlayParameterRepository::clear" << std::endl;
+//    std::cerr << "PlayParameterRepository: PlayParameterRepository::clear" << std::endl;
     while (!m_playParameters.empty()) {
 	delete m_playParameters.begin()->second;
 	m_playParameters.erase(m_playParameters.begin());
--- a/base/PlayParameters.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/base/PlayParameters.cpp	Fri May 12 14:40:43 2006 +0000
@@ -41,7 +41,7 @@
 void
 PlayParameters::setPlayMuted(bool muted)
 {
-    std::cerr << "PlayParameters: setPlayMuted(" << muted << ")" << std::endl;
+//    std::cerr << "PlayParameters: setPlayMuted(" << muted << ")" << std::endl;
     m_playMuted = muted;
     emit playMutedChanged(muted);
     emit playAudibleChanged(!muted);
@@ -51,7 +51,7 @@
 void
 PlayParameters::setPlayAudible(bool audible)
 {
-    std::cerr << "PlayParameters(" << this << "): setPlayAudible(" << audible << ")" << std::endl;
+//    std::cerr << "PlayParameters(" << this << "): setPlayAudible(" << audible << ")" << std::endl;
     setPlayMuted(!audible);
 }
 
@@ -90,7 +90,7 @@
 {
     if (m_playPluginConfiguration != configuration) {
         m_playPluginConfiguration = configuration;
-        std::cerr << "PlayParameters(" << this << "): setPlayPluginConfiguration to \"" << configuration.toStdString() << "\"" << std::endl;
+//        std::cerr << "PlayParameters(" << this << "): setPlayPluginConfiguration to \"" << configuration.toStdString() << "\"" << std::endl;
         emit playPluginConfigurationChanged(configuration);
         emit playParametersChanged();
     }
--- a/base/View.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/base/View.cpp	Fri May 12 14:40:43 2006 +0000
@@ -59,7 +59,7 @@
 
 View::~View()
 {
-    std::cerr << "View::~View(" << this << ")" << std::endl;
+//    std::cerr << "View::~View(" << this << ")" << std::endl;
 
     m_deleting = true;
     delete m_propertyContainer;
@@ -162,7 +162,7 @@
 }
 
 bool
-View::getValueExtents(QString unit, float &min, float &max) const
+View::getValueExtents(QString unit, float &min, float &max, bool &log) const
 {
     bool have = false;
 
@@ -170,14 +170,28 @@
          i != m_layers.end(); ++i) { 
 
         QString layerUnit;
-        float layerMin, layerMax;
+        float layerMin = 0.0, layerMax = 0.0;
+        float displayMin = 0.0, displayMax = 0.0;
+        bool layerLog = false;
 
-        if ((*i)->getValueExtents(layerMin, layerMax, layerUnit) &&
+        if ((*i)->getValueExtents(layerMin, layerMax, layerLog, layerUnit) &&
             layerUnit.toLower() == unit.toLower()) {
 
-            if (!have || layerMin < min) min = layerMin;
-            if (!have || layerMax > max) max = layerMax;
-            have = true;
+            if ((*i)->getDisplayExtents(displayMin, displayMax)) {
+
+                min = displayMin;
+                max = displayMax;
+                log = layerLog;
+                have = true;
+                break;
+
+            } else {
+
+                if (!have || layerMin < min) min = layerMin;
+                if (!have || layerMax > max) max = layerMax;
+                if (layerLog) log = true;
+                have = true;
+            }
         }
     }
 
@@ -245,7 +259,7 @@
 void
 View::toolModeChanged()
 {
-    std::cerr << "View::toolModeChanged(" << m_manager->getToolMode() << ")" << std::endl;
+//    std::cerr << "View::toolModeChanged(" << m_manager->getToolMode() << ")" << std::endl;
 }
 
 long
--- a/base/View.h	Thu May 11 15:02:14 2006 +0000
+++ b/base/View.h	Fri May 12 14:40:43 2006 +0000
@@ -223,7 +223,8 @@
 
     virtual int getTextLabelHeight(const Layer *layer, QPainter &) const;
 
-    virtual bool getValueExtents(QString unit, float &min, float &max) const;
+    virtual bool getValueExtents(QString unit, float &min, float &max,
+                                 bool &log) const;
 
     virtual QString toXmlString(QString indent = "",
 				QString extraAttributes = "") const;
--- a/plugin/DSSIPluginInstance.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/plugin/DSSIPluginInstance.cpp	Fri May 12 14:40:43 2006 +0000
@@ -25,7 +25,7 @@
 #include "PluginIdentifier.h"
 #include "LADSPAPluginFactory.h"
 
-#define DEBUG_DSSI 1
+//#define DEBUG_DSSI 1
 //#define DEBUG_DSSI_PROCESS 1
 
 #define EVENT_BUFFER_SIZE 1023
@@ -161,12 +161,18 @@
 float
 DSSIPluginInstance::getParameter(std::string name) const
 {
+#ifdef DEBUG_DSSI
     std::cerr << "DSSIPluginInstance::getParameter(" << name << ")" << std::endl;
+#endif
     for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) {
         if (name == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) {
+#ifdef DEBUG_DSSI
             std::cerr << "Matches port " << i << std::endl;
+#endif
             float v = getParameterValue(i);
+#ifdef DEBUG_DSSI
             std::cerr << "Returning " << v << std::endl;
+#endif
             return v;
         }
     }
@@ -177,7 +183,9 @@
 void
 DSSIPluginInstance::setParameter(std::string name, float value)
 {
+#ifdef DEBUG_DSSI
     std::cerr << "DSSIPluginInstance::setParameter(" << name << ", " << value << ")" << std::endl;
+#endif
 
     for (unsigned int i = 0; i < m_controlPortsIn.size(); ++i) {
         if (name == m_descriptor->LADSPA_Plugin->PortNames[m_controlPortsIn[i].first]) {
@@ -370,7 +378,9 @@
 
 DSSIPluginInstance::~DSSIPluginInstance()
 {
+#ifdef DEBUG_DSSI
     std::cerr << "DSSIPluginInstance::~DSSIPluginInstance" << std::endl;
+#endif
 
     if (m_threads.find(m_instanceHandle) != m_threads.end()) {
 
@@ -654,9 +664,11 @@
 DSSIPluginInstance::connectPorts()
 {
     if (!m_descriptor || !m_descriptor->LADSPA_Plugin->connect_port) return;
+#ifdef DEBUG_DSSI
     std::cerr << "DSSIPluginInstance::connectPorts: " << m_audioPortsIn.size() 
 	      << " audio ports in, " << m_audioPortsOut.size() << " out, "
 	      << m_outputBufferCount << " output buffers" << std::endl;
+#endif
 
     assert(sizeof(LADSPA_Data) == sizeof(float));
     assert(sizeof(sample_t) == sizeof(float));
@@ -691,7 +703,9 @@
                 (m_descriptor->LADSPA_Plugin, m_controlPortsIn[i].first);
             *m_controlPortsIn[i].second = defaultValue;
             m_backupControlPortsIn[i] = defaultValue;
+#ifdef DEBUG_DSSI
             std::cerr << "DSSIPluginInstance::connectPorts: set control port " << i << " to default value " << defaultValue << std::endl;
+#endif
         }
     }
 
--- a/plugin/FeatureExtractionPluginFactory.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/plugin/FeatureExtractionPluginFactory.cpp	Fri May 12 14:40:43 2006 +0000
@@ -55,6 +55,8 @@
 std::vector<QString>
 FeatureExtractionPluginFactory::getPluginPath()
 {
+    if (!m_pluginPath.empty()) return m_pluginPath;
+
     std::vector<QString> path;
     std::string envPath;
 
@@ -93,6 +95,7 @@
     
     path.push_back(envPath.substr(index).c_str());
 
+    m_pluginPath = path;
     return path;
 }
 
@@ -123,7 +126,7 @@
     
     for (std::vector<QString>::iterator i = path.begin(); i != path.end(); ++i) {
 
-        std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: scanning directory " << i->toStdString() << std::endl;
+//        std::cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: scanning directory " << i->toStdString() << std::endl;
 
 	QDir pluginDir(*i, PLUGIN_GLOB,
                        QDir::Name | QDir::IgnoreCase,
@@ -240,8 +243,10 @@
 
     if (found == "") {
         std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Failed to find library file " << soname.toStdString() << std::endl;
+        return 0;
     } else if (found != soname) {
-        std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: WARNING: Given library name was " << soname.toStdString() << ", found at " << found.toStdString() << std::endl;
+//        std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: WARNING: Given library name was " << soname.toStdString() << ", found at " << found.toStdString() << std::endl;
+//        std::cerr << soname.toStdString() << " -> " << found.toStdString() << std::endl;
     }
 
     soname = found;
@@ -273,7 +278,7 @@
 
     rv = new Vamp::PluginHostAdapter(descriptor, inputSampleRate);
 
-    std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Constructed Vamp plugin, rv is " << rv << std::endl;
+//    std::cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Constructed Vamp plugin, rv is " << rv << std::endl;
 
     //!!! need to dlclose() when plugins from a given library are unloaded
 
--- a/plugin/FeatureExtractionPluginFactory.h	Thu May 11 15:02:14 2006 +0000
+++ b/plugin/FeatureExtractionPluginFactory.h	Fri May 12 14:40:43 2006 +0000
@@ -40,6 +40,7 @@
                                             float inputSampleRate);
 
 protected:
+    std::vector<QString> m_pluginPath;
 };
 
 #endif
--- a/plugin/LADSPAPluginInstance.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/plugin/LADSPAPluginInstance.cpp	Fri May 12 14:40:43 2006 +0000
@@ -24,7 +24,7 @@
 #include "LADSPAPluginInstance.h"
 #include "LADSPAPluginFactory.h"
 
-#define DEBUG_LADSPA 1
+//#define DEBUG_LADSPA 1
 
 
 LADSPAPluginInstance::LADSPAPluginInstance(RealTimePluginFactory *factory,
--- a/plugin/PluginXml.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/plugin/PluginXml.cpp	Fri May 12 14:40:43 2006 +0000
@@ -166,7 +166,7 @@
                  (QString(i->name.c_str())));
 
         if (attrs.value(name) == "") {
-            std::cerr << "PluginXml::setParameters: no parameter \"" << i->name << "\" (attribute \"" << name.toStdString() << "\")" << std::endl;
+//            std::cerr << "PluginXml::setParameters: no parameter \"" << i->name << "\" (attribute \"" << name.toStdString() << "\")" << std::endl;
             continue;
         }
 
@@ -204,8 +204,8 @@
     for (unsigned int i = 0; i < attrNodes.length(); ++i) {
         QDomAttr attr = attrNodes.item(i).toAttr();
         if (attr.isNull()) continue;
-        std::cerr << "Adding attribute \"" << attr.name().toStdString()
-                  << "\" with value \"" << attr.value().toStdString() << "\"" << std::endl;
+//        std::cerr << "PluginXml::setParametersFromXml: Adding attribute \"" << attr.name().toStdString()
+//                  << "\" with value \"" << attr.value().toStdString() << "\"" << std::endl;
         attrs.append(attr.name(), "", "", attr.value());
     }
 
--- a/plugin/RealTimePluginFactory.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/plugin/RealTimePluginFactory.cpp	Fri May 12 14:40:43 2006 +0000
@@ -37,16 +37,16 @@
 {
     if (pluginType == "ladspa") {
 	if (!_ladspaInstance) {
-	    std::cerr << "RealTimePluginFactory::instance(" << pluginType.toStdString()
-		      << "): creating new LADSPAPluginFactory" << std::endl;
+//	    std::cerr << "RealTimePluginFactory::instance(" << pluginType.toStdString()
+//		      << "): creating new LADSPAPluginFactory" << std::endl;
 	    _ladspaInstance = new LADSPAPluginFactory();
 	    _ladspaInstance->discoverPlugins();
 	}
 	return _ladspaInstance;
     } else if (pluginType == "dssi") {
 	if (!_dssiInstance) {
-	    std::cerr << "RealTimePluginFactory::instance(" << pluginType.toStdString()
-		      << "): creating new DSSIPluginFactory" << std::endl;
+//	    std::cerr << "RealTimePluginFactory::instance(" << pluginType.toStdString()
+//		      << "): creating new DSSIPluginFactory" << std::endl;
 	    _dssiInstance = new DSSIPluginFactory();
 	    _dssiInstance->discoverPlugins();
 	}
--- a/plugin/RealTimePluginInstance.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/plugin/RealTimePluginInstance.cpp	Fri May 12 14:40:43 2006 +0000
@@ -26,10 +26,10 @@
 
 RealTimePluginInstance::~RealTimePluginInstance()
 {
-    std::cerr << "RealTimePluginInstance::~RealTimePluginInstance" << std::endl;
+//    std::cerr << "RealTimePluginInstance::~RealTimePluginInstance" << std::endl;
 
     if (m_factory) {
-	std::cerr << "Asking factory to release " << m_identifier.toStdString() << std::endl;
+//	std::cerr << "Asking factory to release " << m_identifier.toStdString() << std::endl;
 
 	m_factory->releasePlugin(this, m_identifier);
     }
--- a/plugin/plugins/SamplePlayer.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/plugin/plugins/SamplePlayer.cpp	Fri May 12 14:40:43 2006 +0000
@@ -308,7 +308,7 @@
 
     if (player->m_pendingProgramChange >= 0) {
 
-	std::cerr << "SamplePlayer::workThreadCallback: pending program change " << player->m_pendingProgramChange << std::endl;
+//	std::cerr << "SamplePlayer::workThreadCallback: pending program change " << player->m_pendingProgramChange << std::endl;
 
 	player->m_mutex.lock();
 
@@ -359,7 +359,7 @@
         if (file.isReadable()) {
             m_samples.push_back(std::pair<QString, QString>
                                 (file.baseName(), file.filePath()));
-            std::cerr << "Found: " << dir[i].toLocal8Bit().data() << std::endl;
+//            std::cerr << "Found: " << dir[i].toLocal8Bit().data() << std::endl;
         }
     }
     
--- a/transform/FeatureExtractionPluginTransform.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/transform/FeatureExtractionPluginTransform.cpp	Fri May 12 14:40:43 2006 +0000
@@ -45,7 +45,7 @@
     m_descriptor(0),
     m_outputFeatureNo(0)
 {
-    std::cerr << "FeatureExtractionPluginTransform::FeatureExtractionPluginTransform: plugin " << pluginId.toStdString() << ", outputName " << outputName.toStdString() << std::endl;
+//    std::cerr << "FeatureExtractionPluginTransform::FeatureExtractionPluginTransform: plugin " << pluginId.toStdString() << ", outputName " << outputName.toStdString() << std::endl;
 
     FeatureExtractionPluginFactory *factory =
 	FeatureExtractionPluginFactory::instanceFor(pluginId);
@@ -123,8 +123,8 @@
 	return;
     }
 
-    std::cerr << "FeatureExtractionPluginTransform: output sample type "
-	      << m_descriptor->sampleType << std::endl;
+//    std::cerr << "FeatureExtractionPluginTransform: output sample type "
+//	      << m_descriptor->sampleType << std::endl;
 
     int binCount = 1;
     float minValue = 0.0, maxValue = 0.0;
@@ -133,8 +133,8 @@
 	binCount = m_descriptor->binCount;
     }
 
-    std::cerr << "FeatureExtractionPluginTransform: output bin count "
-	      << binCount << std::endl;
+//    std::cerr << "FeatureExtractionPluginTransform: output bin count "
+//	      << binCount << std::endl;
 
     if (binCount > 0 && m_descriptor->hasKnownExtents) {
 	minValue = m_descriptor->minValue;
--- a/transform/TransformFactory.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/transform/TransformFactory.cpp	Fri May 12 14:40:43 2006 +0000
@@ -217,7 +217,7 @@
         if (descriptor->controlOutputPortCount == 0 ||
             descriptor->audioInputPortCount == 0) continue;
 
-        std::cout << "TransformFactory::populateRealTimePlugins: plugin " << pluginId.toStdString() << " has " << descriptor->controlOutputPortCount << " output ports" << std::endl;
+//        std::cout << "TransformFactory::populateRealTimePlugins: plugin " << pluginId.toStdString() << " has " << descriptor->controlOutputPortCount << " output ports" << std::endl;
 	
 	QString pluginDescription = descriptor->name.c_str();
 
@@ -359,7 +359,7 @@
     bool ok = false;
     configurationXml = m_lastConfigurations[name];
 
-    std::cerr << "last configuration: " << configurationXml.toStdString() << std::endl;
+//    std::cerr << "last configuration: " << configurationXml.toStdString() << std::endl;
 
     Vamp::PluginBase *plugin = 0;