Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 1386:05d35ce6ea72 levelpanwidget
Start incorporating level-pan widgets
author | Chris Cannam |
---|---|
date | Mon, 05 Dec 2016 15:47:40 +0000 |
parents | bf4f7a12fee0 |
children | 4c5533df5d72 |
comparison
equal
deleted
inserted
replaced
1385:a01bca26ef52 | 1386:05d35ce6ea72 |
---|---|
45 #include "widgets/Fader.h" | 45 #include "widgets/Fader.h" |
46 #include "view/Overview.h" | 46 #include "view/Overview.h" |
47 #include "widgets/PropertyBox.h" | 47 #include "widgets/PropertyBox.h" |
48 #include "widgets/PropertyStack.h" | 48 #include "widgets/PropertyStack.h" |
49 #include "widgets/AudioDial.h" | 49 #include "widgets/AudioDial.h" |
50 #include "widgets/LevelPanWidget.h" | |
50 #include "widgets/IconLoader.h" | 51 #include "widgets/IconLoader.h" |
51 #include "widgets/LayerTreeDialog.h" | 52 #include "widgets/LayerTreeDialog.h" |
52 #include "widgets/ListInputDialog.h" | 53 #include "widgets/ListInputDialog.h" |
53 #include "widgets/SubdividingMenu.h" | 54 #include "widgets/SubdividingMenu.h" |
54 #include "widgets/NotifyingPushButton.h" | 55 #include "widgets/NotifyingPushButton.h" |
231 } else { | 232 } else { |
232 m_panLayer->setBaseColour | 233 m_panLayer->setBaseColour |
233 (ColourDatabase::getInstance()->getColourIndex(tr("Green"))); | 234 (ColourDatabase::getInstance()->getColourIndex(tr("Green"))); |
234 } | 235 } |
235 | 236 |
236 m_fader = new Fader(frame, false); | |
237 connect(m_fader, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); | |
238 connect(m_fader, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); | |
239 | |
240 m_playSpeed = new AudioDial(frame); | 237 m_playSpeed = new AudioDial(frame); |
241 m_playSpeed->setMinimum(0); | 238 m_playSpeed->setMinimum(0); |
242 m_playSpeed->setMaximum(120); | 239 m_playSpeed->setMaximum(120); |
243 m_playSpeed->setValue(60); | 240 m_playSpeed->setValue(60); |
244 m_playSpeed->setFixedWidth(m_viewManager->scalePixelSize(32)); | 241 m_playSpeed->setFixedWidth(m_viewManager->scalePixelSize(32)); |
252 connect(m_playSpeed, SIGNAL(valueChanged(int)), | 249 connect(m_playSpeed, SIGNAL(valueChanged(int)), |
253 this, SLOT(playSpeedChanged(int))); | 250 this, SLOT(playSpeedChanged(int))); |
254 connect(m_playSpeed, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); | 251 connect(m_playSpeed, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); |
255 connect(m_playSpeed, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); | 252 connect(m_playSpeed, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); |
256 | 253 |
257 IconLoader il; | 254 m_mainLevelPan = new LevelPanWidget(frame); |
255 connect(m_mainLevelPan, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); | |
256 connect(m_mainLevelPan, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); | |
257 | |
258 /*!!! | |
259 m_fader = new Fader(frame, false); | |
260 connect(m_fader, SIGNAL(mouseEntered()), this, SLOT(mouseEnteredWidget())); | |
261 connect(m_fader, SIGNAL(mouseLeft()), this, SLOT(mouseLeftWidget())); | |
262 */ | |
258 | 263 |
259 m_playControlsSpacer = new QFrame; | 264 m_playControlsSpacer = new QFrame; |
260 | 265 |
261 layout->setSpacing(m_viewManager->scalePixelSize(4)); | 266 layout->setSpacing(m_viewManager->scalePixelSize(4)); |
262 layout->addWidget(m_mainScroll, 0, 0, 1, 4); | 267 layout->addWidget(m_mainScroll, 0, 0, 1, 4); |
263 layout->addWidget(m_overview, 1, 0); | 268 layout->addWidget(m_overview, 1, 0); |
264 layout->addWidget(m_playControlsSpacer, 1, 1); | 269 layout->addWidget(m_playControlsSpacer, 1, 1); |
265 layout->addWidget(m_playSpeed, 1, 2); | 270 layout->addWidget(m_playSpeed, 1, 2); |
266 layout->addWidget(m_fader, 1, 3); | 271 // layout->addWidget(m_fader, 1, 3); |
272 layout->addWidget(m_mainLevelPan, 1, 3); | |
267 | 273 |
268 m_playControlsWidth = | 274 m_playControlsWidth = |
269 m_fader->width() + m_playSpeed->width() + layout->spacing() * 2; | 275 m_mainLevelPan->width() + m_playSpeed->width() + layout->spacing() * 2; |
270 | 276 |
271 m_paneStack->setPropertyStackMinWidth(m_playControlsWidth | 277 m_paneStack->setPropertyStackMinWidth(m_playControlsWidth |
272 + 2 + layout->spacing()); | 278 + 2 + layout->spacing()); |
273 m_playControlsSpacer->setFixedSize(QSize(2, 2)); | 279 m_playControlsSpacer->setFixedSize(QSize(2, 2)); |
274 | 280 |
4128 } | 4134 } |
4129 | 4135 |
4130 void | 4136 void |
4131 MainWindow::outputLevelsChanged(float left, float right) | 4137 MainWindow::outputLevelsChanged(float left, float right) |
4132 { | 4138 { |
4133 m_fader->setPeakLeft(left); | 4139 m_mainLevelPan->setMonitoringLevels(left, right); |
4134 m_fader->setPeakRight(right); | |
4135 } | 4140 } |
4136 | 4141 |
4137 void | 4142 void |
4138 MainWindow::sampleRateMismatch(sv_samplerate_t requested, | 4143 MainWindow::sampleRateMismatch(sv_samplerate_t requested, |
4139 sv_samplerate_t actual, | 4144 sv_samplerate_t actual, |
4325 m_panLayer->setModel(model); | 4330 m_panLayer->setModel(model); |
4326 | 4331 |
4327 MainWindowBase::mainModelChanged(model); | 4332 MainWindowBase::mainModelChanged(model); |
4328 | 4333 |
4329 if (m_playTarget || m_audioIO) { | 4334 if (m_playTarget || m_audioIO) { |
4330 connect(m_fader, SIGNAL(valueChanged(float)), | 4335 connect(m_mainLevelPan, SIGNAL(levelChanged(float)), |
4331 this, SLOT(mainModelGainChanged(float))); | 4336 this, SLOT(mainModelGainChanged(float))); |
4337 connect(m_mainLevelPan, SIGNAL(panChanged(float)), | |
4338 this, SLOT(mainModelPanChanged(float))); | |
4332 } | 4339 } |
4333 } | 4340 } |
4334 | 4341 |
4335 void | 4342 void |
4336 MainWindow::mainModelGainChanged(float gain) | 4343 MainWindow::mainModelGainChanged(float gain) |
4337 { | 4344 { |
4338 if (m_playTarget) { | 4345 if (m_playTarget) { |
4339 m_playTarget->setOutputGain(gain); | 4346 m_playTarget->setOutputGain(gain); |
4340 } else if (m_audioIO) { | 4347 } else if (m_audioIO) { |
4341 m_audioIO->setOutputGain(gain); | 4348 m_audioIO->setOutputGain(gain); |
4349 } | |
4350 } | |
4351 | |
4352 void | |
4353 MainWindow::mainModelPanChanged(float balance) | |
4354 { | |
4355 // this is indeed stereo balance rather than pan | |
4356 if (m_playTarget) { | |
4357 m_playTarget->setOutputBalance(balance); | |
4358 } else if (m_audioIO) { | |
4359 m_audioIO->setOutputBalance(balance); | |
4342 } | 4360 } |
4343 } | 4361 } |
4344 | 4362 |
4345 void | 4363 void |
4346 MainWindow::modelAboutToBeDeleted(Model *model) | 4364 MainWindow::modelAboutToBeDeleted(Model *model) |
4601 MainWindow::mouseEnteredWidget() | 4619 MainWindow::mouseEnteredWidget() |
4602 { | 4620 { |
4603 QWidget *w = dynamic_cast<QWidget *>(sender()); | 4621 QWidget *w = dynamic_cast<QWidget *>(sender()); |
4604 if (!w) return; | 4622 if (!w) return; |
4605 | 4623 |
4606 if (w == m_fader) { | 4624 if (w == m_mainLevelPan) { |
4607 contextHelpChanged(tr("Adjust the master playback level")); | 4625 contextHelpChanged(tr("Adjust the master playback level and pan")); |
4608 } else if (w == m_playSpeed) { | 4626 } else if (w == m_playSpeed) { |
4609 contextHelpChanged(tr("Adjust the master playback speed")); | 4627 contextHelpChanged(tr("Adjust the master playback speed")); |
4610 } | 4628 } |
4611 } | 4629 } |
4612 | 4630 |