Mercurial > hg > svgui
comparison 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 |
comparison
equal
deleted
inserted
replaced
62:50429a56680f | 63:fb02fe13ff47 |
---|---|
12 License, or (at your option) any later version. See the file | 12 License, or (at your option) any later version. See the file |
13 COPYING included with this distribution for more information. | 13 COPYING included with this distribution for more information. |
14 */ | 14 */ |
15 | 15 |
16 #include "PropertyBox.h" | 16 #include "PropertyBox.h" |
17 #include "PluginParameterDialog.h" | |
17 | 18 |
18 #include "base/PropertyContainer.h" | 19 #include "base/PropertyContainer.h" |
19 #include "base/PlayParameters.h" | 20 #include "base/PlayParameters.h" |
20 #include "base/Layer.h" | 21 #include "base/Layer.h" |
22 | |
23 #include "plugin/RealTimePluginFactory.h" | |
24 #include "plugin/RealTimePluginInstance.h" | |
21 | 25 |
22 #include "AudioDial.h" | 26 #include "AudioDial.h" |
23 #include "LEDButton.h" | 27 #include "LEDButton.h" |
24 | 28 |
25 #include <QGridLayout> | 29 #include <QGridLayout> |
26 #include <QHBoxLayout> | 30 #include <QHBoxLayout> |
27 #include <QVBoxLayout> | 31 #include <QVBoxLayout> |
28 #include <QCheckBox> | 32 #include <QCheckBox> |
29 #include <QComboBox> | 33 #include <QComboBox> |
34 #include <QPushButton> | |
30 #include <QLabel> | 35 #include <QLabel> |
31 #include <QFrame> | 36 #include <QFrame> |
32 | 37 |
33 #include <cassert> | 38 #include <cassert> |
34 #include <iostream> | 39 #include <iostream> |
44 container->getPropertyContainerName().toStdString() << "\")]::PropertyBox" << std::endl; | 49 container->getPropertyContainerName().toStdString() << "\")]::PropertyBox" << std::endl; |
45 #endif | 50 #endif |
46 | 51 |
47 m_mainBox = new QVBoxLayout; | 52 m_mainBox = new QVBoxLayout; |
48 setLayout(m_mainBox); | 53 setLayout(m_mainBox); |
49 | |
50 bool needViewPlayBox = false; | |
51 | 54 |
52 m_mainWidget = new QWidget; | 55 m_mainWidget = new QWidget; |
53 m_mainBox->addWidget(m_mainWidget); | 56 m_mainBox->addWidget(m_mainWidget); |
54 m_mainBox->insertStretch(1, 10); | 57 m_mainBox->insertStretch(1, 10); |
55 | 58 |
147 connect(params, SIGNAL(playAudibleChanged(bool)), | 150 connect(params, SIGNAL(playAudibleChanged(bool)), |
148 playButton, SLOT(setState(bool))); | 151 playButton, SLOT(setState(bool))); |
149 layout->setAlignment(playButton, Qt::AlignVCenter); | 152 layout->setAlignment(playButton, Qt::AlignVCenter); |
150 | 153 |
151 layout->insertStretch(-1, 10); | 154 layout->insertStretch(-1, 10); |
155 | |
156 if (params->getPlayPluginId() != "") { | |
157 QPushButton *pluginButton = new QPushButton("E"); | |
158 layout->addWidget(pluginButton); | |
159 connect(pluginButton, SIGNAL(clicked()), | |
160 this, SLOT(editPlugin())); | |
161 } | |
152 | 162 |
153 AudioDial *gainDial = new AudioDial; | 163 AudioDial *gainDial = new AudioDial; |
154 layout->addWidget(gainDial); | 164 layout->addWidget(gainDial); |
155 gainDial->setMeterColor(Qt::darkRed); | 165 gainDial->setMeterColor(Qt::darkRed); |
156 gainDial->setMinimum(-50); | 166 gainDial->setMinimum(-50); |
452 if (pan < -1.0) pan = -1.0; | 462 if (pan < -1.0) pan = -1.0; |
453 if (pan > 1.0) pan = 1.0; | 463 if (pan > 1.0) pan = 1.0; |
454 emit changePlayPan(pan); | 464 emit changePlayPan(pan); |
455 } | 465 } |
456 | 466 |
467 void | |
468 PropertyBox::editPlugin() | |
469 { | |
470 //!!! should probably just emit and let something else do this | |
471 | |
472 PlayParameters *params = m_container->getPlayParameters(); | |
473 if (!params) return; | |
474 | |
475 QString pluginId = params->getPlayPluginId(); | |
476 QString configurationXml = params->getPlayPluginConfiguration(); | |
477 | |
478 RealTimePluginFactory *factory = | |
479 RealTimePluginFactory::instanceFor(pluginId); | |
480 if (!factory) return; | |
481 | |
482 RealTimePluginInstance *instance = | |
483 factory->instantiatePlugin(pluginId, 0, 0, 48000, 1024, 1); | |
484 if (!instance) return; | |
485 | |
486 instance->setParametersFromXml(configurationXml); | |
487 | |
488 PluginParameterDialog *dialog = new PluginParameterDialog(instance); | |
489 if (dialog->exec() == QDialog::Accepted) { | |
490 params->setPlayPluginConfiguration(instance->toXmlString()); | |
491 } | |
492 | |
493 delete dialog; | |
494 delete instance; | |
495 } | |
496 | |
457 #ifdef INCLUDE_MOCFILES | 497 #ifdef INCLUDE_MOCFILES |
458 #include "PropertyBox.moc.cpp" | 498 #include "PropertyBox.moc.cpp" |
459 #endif | 499 #endif |
460 | 500 |