summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-04-22 21:38:40 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2014-04-22 21:38:40 +0200
commit6dbcd24cee07b519981f128c1fae8870e839e79e (patch)
treeb5c8960c9fc32a9be50f439ad79a8a8780e2e123
parent71e034f21c66eb921bd18779ccb7f183955896d3 (diff)
Make player play preview samples when 'generate' tab is active.
-rw-r--r--dgedit/mainwindow.cc15
-rw-r--r--dgedit/mainwindow.h3
2 files changed, 12 insertions, 6 deletions
diff --git a/dgedit/mainwindow.cc b/dgedit/mainwindow.cc
index 58e048f..d815d5c 100644
--- a/dgedit/mainwindow.cc
+++ b/dgedit/mainwindow.cc
@@ -174,7 +174,7 @@ MainWindow::MainWindow()
this, SLOT(setPreset(int)));
dockWidget->widget()->layout()->addWidget(presets);
- QTabWidget *tabs = new QTabWidget(this);
+ tabs = new QTabWidget(this);
tabs->addTab(createFilesTab(), "Files");
generateTabId = tabs->addTab(createGenerateTab(), "Generate");
tabs->addTab(createEditTab(), "Edit");
@@ -402,12 +402,15 @@ QWidget *MainWindow::createExportTab()
void MainWindow::playSamples()
{
- QVector<sel_id_t> ids = selections.ids();
+ Selections *sels = &selections;
+ if(tabs->currentIndex() == generateTabId) sels = &selections_preview;
+
+ QVector<sel_id_t> ids = sels->ids();
for(int v1 = 0; v1 < ids.size(); v1++) {
for(int v2 = 0; v2 < ids.size(); v2++) {
- Selection sel1 = selections.get(ids[v1]);
- Selection sel2 = selections.get(ids[v2]);
+ Selection sel1 = sels->get(ids[v1]);
+ Selection sel2 = sels->get(ids[v2]);
if(sel1.energy < sel2.energy) {
sel_id_t vtmp = ids[v1];
@@ -419,7 +422,7 @@ void MainWindow::playSamples()
QVector<sel_id_t>::iterator i = ids.begin();
while(i != ids.end()) {
- Selection sel = selections.get(*i);
+ Selection sel = sels->get(*i);
unsigned int length = sb_playsamples->value() * 44100 / 1000;
@@ -429,7 +432,7 @@ void MainWindow::playSamples()
if(sample_length > length) to = sel.from + length;
- selections.setActive(*i);
+ sels->setActive(*i);
connect(&player, SIGNAL(positionUpdate(size_t)),
listen, SLOT(update(size_t)));
diff --git a/dgedit/mainwindow.h b/dgedit/mainwindow.h
index a47e729..ee25982 100644
--- a/dgedit/mainwindow.h
+++ b/dgedit/mainwindow.h
@@ -33,6 +33,7 @@
#include <QSlider>
#include <QLineEdit>
#include <QCloseEvent>
+#include <QTabWidget>
#include "canvas.h"
#include "audioextractor.h"
@@ -105,6 +106,8 @@ private:
QLineEdit *prefix;
QLineEdit *lineed_exportp;
+ QTabWidget *tabs;
+
// Session state information:
Selections selections;
Selections selections_preview;