Mercurial > hg > svgui
diff widgets/PropertyBox.cpp @ 63:fb02fe13ff47
* Add editing for auralisation plugin parameters and programs
* Rename and reorganise the sample plugin sample set
author | Chris Cannam |
---|---|
date | Thu, 23 Mar 2006 15:49:41 +0000 |
parents | 705f05ab42e3 |
children | 10bcd53ddc71 |
line wrap: on
line diff
--- a/widgets/PropertyBox.cpp Wed Mar 22 17:38:29 2006 +0000 +++ b/widgets/PropertyBox.cpp Thu Mar 23 15:49:41 2006 +0000 @@ -14,11 +14,15 @@ */ #include "PropertyBox.h" +#include "PluginParameterDialog.h" #include "base/PropertyContainer.h" #include "base/PlayParameters.h" #include "base/Layer.h" +#include "plugin/RealTimePluginFactory.h" +#include "plugin/RealTimePluginInstance.h" + #include "AudioDial.h" #include "LEDButton.h" @@ -27,6 +31,7 @@ #include <QVBoxLayout> #include <QCheckBox> #include <QComboBox> +#include <QPushButton> #include <QLabel> #include <QFrame> @@ -47,8 +52,6 @@ m_mainBox = new QVBoxLayout; setLayout(m_mainBox); - bool needViewPlayBox = false; - m_mainWidget = new QWidget; m_mainBox->addWidget(m_mainWidget); m_mainBox->insertStretch(1, 10); @@ -150,6 +153,13 @@ layout->insertStretch(-1, 10); + if (params->getPlayPluginId() != "") { + QPushButton *pluginButton = new QPushButton("E"); + layout->addWidget(pluginButton); + connect(pluginButton, SIGNAL(clicked()), + this, SLOT(editPlugin())); + } + AudioDial *gainDial = new AudioDial; layout->addWidget(gainDial); gainDial->setMeterColor(Qt::darkRed); @@ -454,6 +464,36 @@ emit changePlayPan(pan); } +void +PropertyBox::editPlugin() +{ + //!!! should probably just emit and let something else do this + + PlayParameters *params = m_container->getPlayParameters(); + if (!params) return; + + QString pluginId = params->getPlayPluginId(); + QString configurationXml = params->getPlayPluginConfiguration(); + + RealTimePluginFactory *factory = + RealTimePluginFactory::instanceFor(pluginId); + if (!factory) return; + + RealTimePluginInstance *instance = + factory->instantiatePlugin(pluginId, 0, 0, 48000, 1024, 1); + if (!instance) return; + + instance->setParametersFromXml(configurationXml); + + PluginParameterDialog *dialog = new PluginParameterDialog(instance); + if (dialog->exec() == QDialog::Accepted) { + params->setPlayPluginConfiguration(instance->toXmlString()); + } + + delete dialog; + delete instance; +} + #ifdef INCLUDE_MOCFILES #include "PropertyBox.moc.cpp" #endif