Mercurial > hg > svgui
changeset 71:72fa239a4880
* Modify to use Vamp SDK for proper feature extraction plugins.
Requires that the vamp-plugin-sdk directory tree be present below
plugin/ (it's separate in Subversion).
author | Chris Cannam |
---|---|
date | Fri, 31 Mar 2006 15:56:35 +0000 |
parents | bf306158803d |
children | 1d176af87056 |
files | layer/SpectrogramLayer.cpp layer/SpectrogramLayer.h layer/WaveformLayer.cpp widgets/PluginParameterBox.cpp widgets/PluginParameterBox.h widgets/PluginParameterDialog.cpp widgets/PluginParameterDialog.h widgets/PropertyBox.cpp |
diffstat | 8 files changed, 47 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp Thu Mar 30 15:00:22 2006 +0000 +++ b/layer/SpectrogramLayer.cpp Fri Mar 31 15:56:35 2006 +0000 @@ -223,7 +223,7 @@ } else if (name == tr("Colour")) { *min = 0; - *max = 5; + *max = 6; deft = (int)m_colourScheme; @@ -322,7 +322,8 @@ case 2: return tr("Black on White"); case 3: return tr("Red on Blue"); case 4: return tr("Yellow on Black"); - case 5: return tr("Fruit Salad"); + case 5: return tr("Blue on Black"); + case 6: return tr("Fruit Salad"); } } if (name == tr("Colour Scale")) { @@ -425,7 +426,8 @@ case 2: setColourScheme(BlackOnWhite); break; case 3: setColourScheme(RedOnBlue); break; case 4: setColourScheme(YellowOnBlack); break; - case 5: setColourScheme(Rainbow); break; + case 5: setColourScheme(BlueOnBlack); break; + case 6: setColourScheme(Rainbow); break; } } else if (name == tr("Window Type")) { setWindowType(WindowType(value)); @@ -961,6 +963,12 @@ pixel / 4); break; + case BlueOnBlack: + colour = QColor::fromHsv + (240, pixel > 226 ? 256 - (pixel - 226) * 8 : 255, + (pixel * pixel) / 255); + break; + case Rainbow: hue = 250 - pixel; if (hue < 0) hue += 256; @@ -1201,6 +1209,8 @@ SpectrogramLayer::Cache::~Cache() { + std::cerr << "SpectrogramLayer::Cache[" << this << "]::~Cache" << std::endl; + for (size_t i = 0; i < m_width; ++i) { if (m_magnitude && m_magnitude[i]) free(m_magnitude[i]); if (m_phase && m_phase[i]) free(m_phase[i]);
--- a/layer/SpectrogramLayer.h Thu Mar 30 15:00:22 2006 +0000 +++ b/layer/SpectrogramLayer.h Fri Mar 31 15:56:35 2006 +0000 @@ -18,6 +18,7 @@ #include "base/Layer.h" #include "base/Window.h" +#include "base/RealTime.h" #include "model/PowerOfSqrtTwoZoomConstraint.h" #include "model/DenseTimeValueModel.h" @@ -34,7 +35,6 @@ class QImage; class QPixmap; class QTimer; -class RealTime; /** * SpectrogramLayer represents waveform data (obtained from a @@ -158,7 +158,7 @@ bool getNormalizeColumns() const; enum ColourScheme { DefaultColours, WhiteOnBlack, BlackOnWhite, - RedOnBlue, YellowOnBlack, Rainbow }; + RedOnBlue, YellowOnBlack, BlueOnBlack, Rainbow }; void setColourScheme(ColourScheme scheme); ColourScheme getColourScheme() const;
--- a/layer/WaveformLayer.cpp Thu Mar 30 15:00:22 2006 +0000 +++ b/layer/WaveformLayer.cpp Fri Mar 31 15:56:35 2006 +0000 @@ -600,8 +600,12 @@ (ch, frame0 < 0 ? 0 : frame0, frame1, modelZoomLevel); if (mergingChannels || mixingChannels) { - otherChannelRanges = m_model->getRanges - (1, frame0 < 0 ? 0 : frame0, frame1, modelZoomLevel); + if (m_model->getChannelCount() > 1) { + otherChannelRanges = m_model->getRanges + (1, frame0 < 0 ? 0 : frame0, frame1, modelZoomLevel); + } else { + otherChannelRanges = ranges; + } } for (int x = x0; x <= x1; ++x) {
--- a/widgets/PluginParameterBox.cpp Thu Mar 30 15:00:22 2006 +0000 +++ b/widgets/PluginParameterBox.cpp Fri Mar 31 15:56:35 2006 +0000 @@ -17,6 +17,8 @@ #include "AudioDial.h" +#include "plugin/PluginXml.h" + #include <QDoubleSpinBox> #include <QGridLayout> #include <QComboBox> @@ -27,7 +29,7 @@ #include <iostream> #include <string> -PluginParameterBox::PluginParameterBox(PluginInstance *plugin, QWidget *parent) : +PluginParameterBox::PluginParameterBox(Vamp::PluginBase *plugin, QWidget *parent) : QFrame(parent), m_plugin(plugin) { @@ -43,8 +45,8 @@ void PluginParameterBox::populate() { - PluginInstance::ParameterList params = m_plugin->getParameterDescriptors(); - PluginInstance::ProgramList programs = m_plugin->getPrograms(); + Vamp::PluginBase::ParameterList params = m_plugin->getParameterDescriptors(); + Vamp::PluginBase::ProgramList programs = m_plugin->getPrograms(); m_params.clear(); @@ -170,7 +172,7 @@ return; } - PluginInstance::ParameterDescriptor params = m_params[name].param; + Vamp::PluginBase::ParameterDescriptor params = m_params[name].param; float min = params.minValue; float max = params.maxValue; @@ -193,7 +195,7 @@ m_plugin->setParameter(name.toStdString(), newValue); - emit pluginConfigurationChanged(m_plugin->toXmlString()); + emit pluginConfigurationChanged(PluginXml(m_plugin).toXmlString()); } void @@ -207,12 +209,12 @@ return; } - PluginInstance::ParameterDescriptor params = m_params[name].param; + Vamp::PluginBase::ParameterDescriptor params = m_params[name].param; if (state) m_plugin->setParameter(name.toStdString(), 1.0); else m_plugin->setParameter(name.toStdString(), 0.0); - emit pluginConfigurationChanged(m_plugin->toXmlString()); + emit pluginConfigurationChanged(PluginXml(m_plugin).toXmlString()); } void @@ -226,7 +228,7 @@ return; } - PluginInstance::ParameterDescriptor params = m_params[name].param; + Vamp::PluginBase::ParameterDescriptor params = m_params[name].param; float min = params.minValue; float max = params.maxValue; @@ -258,7 +260,7 @@ m_plugin->setParameter(name.toStdString(), value); - emit pluginConfigurationChanged(m_plugin->toXmlString()); + emit pluginConfigurationChanged(PluginXml(m_plugin).toXmlString()); } void @@ -269,7 +271,7 @@ for (std::map<QString, ParamRec>::iterator i = m_params.begin(); i != m_params.end(); ++i) { - PluginInstance::ParameterDescriptor ¶m = i->second.param; + Vamp::PluginBase::ParameterDescriptor ¶m = i->second.param; float value = m_plugin->getParameter(param.name); if (i->second.spin) { @@ -296,6 +298,6 @@ } } - emit pluginConfigurationChanged(m_plugin->toXmlString()); + emit pluginConfigurationChanged(PluginXml(m_plugin).toXmlString()); }
--- a/widgets/PluginParameterBox.h Thu Mar 30 15:00:22 2006 +0000 +++ b/widgets/PluginParameterBox.h Fri Mar 31 15:56:35 2006 +0000 @@ -16,7 +16,7 @@ #ifndef _PLUGIN_PARAMETER_BOX_H_ #define _PLUGIN_PARAMETER_BOX_H_ -#include "plugin/PluginInstance.h" +#include "vamp-sdk/PluginBase.h" #include <QFrame> #include <map> @@ -31,10 +31,10 @@ Q_OBJECT public: - PluginParameterBox(PluginInstance *, QWidget *parent = 0); + PluginParameterBox(Vamp::PluginBase *, QWidget *parent = 0); ~PluginParameterBox(); - PluginInstance *getPlugin() { return m_plugin; } + Vamp::PluginBase *getPlugin() { return m_plugin; } signals: void pluginConfigurationChanged(QString); @@ -49,13 +49,13 @@ void populate(); QGridLayout *m_layout; - PluginInstance *m_plugin; + Vamp::PluginBase *m_plugin; struct ParamRec { AudioDial *dial; QDoubleSpinBox *spin; QCheckBox *check; - PluginInstance::ParameterDescriptor param; + Vamp::PluginBase::ParameterDescriptor param; }; std::map<QString, ParamRec> m_params;
--- a/widgets/PluginParameterDialog.cpp Thu Mar 30 15:00:22 2006 +0000 +++ b/widgets/PluginParameterDialog.cpp Fri Mar 31 15:56:35 2006 +0000 @@ -25,7 +25,7 @@ #include <QMessageBox> #include <QComboBox> -PluginParameterDialog::PluginParameterDialog(PluginInstance *plugin, +PluginParameterDialog::PluginParameterDialog(Vamp::PluginBase *plugin, int sourceChannels, int targetChannels, int defaultChannel,
--- a/widgets/PluginParameterDialog.h Thu Mar 30 15:00:22 2006 +0000 +++ b/widgets/PluginParameterDialog.h Fri Mar 31 15:56:35 2006 +0000 @@ -18,7 +18,7 @@ #include <QDialog> -class PluginInstance; +namespace Vamp { class PluginBase; } class PluginParameterBox; /** @@ -34,14 +34,14 @@ Q_OBJECT public: - PluginParameterDialog(PluginInstance *, + PluginParameterDialog(Vamp::PluginBase *, int sourceChannels, int targetChannels, int defaultChannel, QWidget *parent = 0); ~PluginParameterDialog(); - PluginInstance *getPlugin() { return m_plugin; } + Vamp::PluginBase *getPlugin() { return m_plugin; } int getChannel() const { return m_channel; } @@ -52,7 +52,7 @@ void channelComboChanged(int); protected: - PluginInstance *m_plugin; + Vamp::PluginBase *m_plugin; int m_channel; PluginParameterBox *m_parameterBox; };
--- a/widgets/PropertyBox.cpp Thu Mar 30 15:00:22 2006 +0000 +++ b/widgets/PropertyBox.cpp Fri Mar 31 15:56:35 2006 +0000 @@ -22,6 +22,7 @@ #include "plugin/RealTimePluginFactory.h" #include "plugin/RealTimePluginInstance.h" +#include "plugin/PluginXml.h" #include "AudioDial.h" #include "LEDButton.h" @@ -485,14 +486,14 @@ factory->instantiatePlugin(pluginId, 0, 0, 48000, 1024, 1); if (!instance) return; - instance->setParametersFromXml(configurationXml); + PluginXml(instance).setParametersFromXml(configurationXml); PluginParameterDialog *dialog = new PluginParameterDialog(instance, -1, -1, -1); connect(dialog, SIGNAL(pluginConfigurationChanged(QString)), this, SLOT(pluginConfigurationChanged(QString))); if (dialog->exec() == QDialog::Accepted) { - params->setPlayPluginConfiguration(instance->toXmlString()); + params->setPlayPluginConfiguration(PluginXml(instance).toXmlString()); } else { // restore in case we mucked about with the configuration // as a consequence of signals from the dialog