diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-04-22 21:38:40 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-04-22 21:38:40 +0200 |
commit | 6dbcd24cee07b519981f128c1fae8870e839e79e (patch) | |
tree | b5c8960c9fc32a9be50f439ad79a8a8780e2e123 /dgedit/mainwindow.cc | |
parent | 71e034f21c66eb921bd18779ccb7f183955896d3 (diff) |
Make player play preview samples when 'generate' tab is active.
Diffstat (limited to 'dgedit/mainwindow.cc')
-rw-r--r-- | dgedit/mainwindow.cc | 15 |
1 files changed, 9 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))); |