summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dgedit/canvastoolselections.cc101
-rw-r--r--dgedit/canvastoolselections.h12
-rw-r--r--dgedit/mainwindow.cc289
-rw-r--r--dgedit/mainwindow.h15
4 files changed, 284 insertions, 133 deletions
diff --git a/dgedit/canvastoolselections.cc b/dgedit/canvastoolselections.cc
index 30f8970..d0aa481 100644
--- a/dgedit/canvastoolselections.cc
+++ b/dgedit/canvastoolselections.cc
@@ -34,8 +34,9 @@
#define unmapX(x) canvas->unmapX(x)
#define unmapY(x) canvas->unmapY(x)
-CanvasToolSelections::CanvasToolSelections(Canvas *c, Selections &s)
- : selections(s)
+CanvasToolSelections::CanvasToolSelections(Canvas *c, Selections &s,
+ Selections &p)
+ : selections(s), selections_preview(p)
{
threshold = 0.5; // Default from CanvasToolThreshold
@@ -48,7 +49,8 @@ CanvasToolSelections::CanvasToolSelections(Canvas *c, Selections &s)
colSel = QColor(255, 0, 0, 160);
colActiveSelBg = QColor(255, 255, 0, 60);
colActiveSel = QColor(255, 255, 0, 160);
-
+ colPreviewSelBg = QColor(0, 0, 255, 60);
+ colPreviewSel = QColor(0, 0, 255, 160);
}
bool CanvasToolSelections::mouseMoveEvent(QMouseEvent *event)
@@ -162,29 +164,54 @@ void CanvasToolSelections::paintEvent(QPaintEvent *event, QPainter &painter)
int pos = unmapX(event->rect().x());
int width = unmapX(event->rect().width());
- QVector<sel_id_t> ids = selections.ids();
- QVector<sel_id_t>::iterator i = ids.begin();
- while(i != ids.end()) {
- Selection sel = selections.get(*i);
- int from = sel.from;
- int to = sel.to;
- int fadein = sel.fadein;
- int fadeout = sel.fadeout;
- if(from > pos + width || to + width < pos) { i++; continue; }
- if(selections.active() == *i) {
- painter.setBrush(colActiveSelBg);
- painter.setPen(colActiveSel);
- } else {
- painter.setBrush(colSelBg);
- painter.setPen(colSel);
+ {
+ QVector<sel_id_t> ids = selections.ids();
+ QVector<sel_id_t>::iterator i = ids.begin();
+ while(i != ids.end()) {
+ Selection sel = selections.get(*i);
+ int from = sel.from;
+ int to = sel.to;
+ int fadein = sel.fadein;
+ int fadeout = sel.fadeout;
+ if(from > pos + width || to + width < pos) { i++; continue; }
+ if(selections.active() == *i) {
+ painter.setBrush(colActiveSelBg);
+ painter.setPen(colActiveSel);
+ } else {
+ painter.setBrush(colSelBg);
+ painter.setPen(colSel);
+ }
+ painter.drawRect(mapX(from), mapY(-1.0),
+ mapX(to) - mapX(from), mapY(1.0) - mapY(-1.0));
+ painter.drawLine(mapX(from), mapY(0.0), mapX(from + fadein), mapY(-1.0));
+ painter.drawLine(mapX(from), mapY(0.0), mapX(from + fadein), mapY(1.0));
+ painter.drawLine(mapX(to - fadeout), mapY(-1.0), mapX(to), mapY(0.0));
+ painter.drawLine(mapX(to - fadeout), mapY(1.0), mapX(to), mapY(0.0));
+ i++;
+ }
+ }
+
+ if(show_preview) {
+ QVector<sel_id_t> ids = selections_preview.ids();
+ QVector<sel_id_t>::iterator i = ids.begin();
+ while(i != ids.end()) {
+ Selection sel = selections_preview.get(*i);
+ int from = sel.from;
+ int to = sel.to;
+ int fadein = sel.fadein;
+ int fadeout = sel.fadeout;
+ if(from > pos + width || to + width < pos) { i++; continue; }
+ painter.setBrush(colPreviewSelBg);
+ painter.setPen(colPreviewSel);
+
+ painter.drawRect(mapX(from), mapY(-1.0),
+ mapX(to) - mapX(from), mapY(1.0) - mapY(-1.0));
+ painter.drawLine(mapX(from), mapY(0.0), mapX(from + fadein), mapY(-1.0));
+ painter.drawLine(mapX(from), mapY(0.0), mapX(from + fadein), mapY(1.0));
+ painter.drawLine(mapX(to - fadeout), mapY(-1.0), mapX(to), mapY(0.0));
+ painter.drawLine(mapX(to - fadeout), mapY(1.0), mapX(to), mapY(0.0));
+ i++;
}
- painter.drawRect(mapX(from), mapY(-1.0),
- mapX(to) - mapX(from), mapY(1.0) - mapY(-1.0));
- painter.drawLine(mapX(from), mapY(0.0), mapX(from + fadein), mapY(-1.0));
- painter.drawLine(mapX(from), mapY(0.0), mapX(from + fadein), mapY(1.0));
- painter.drawLine(mapX(to - fadeout), mapY(-1.0), mapX(to), mapY(0.0));
- painter.drawLine(mapX(to - fadeout), mapY(1.0), mapX(to), mapY(0.0));
- i++;
}
}
@@ -214,9 +241,21 @@ void CanvasToolSelections::fadeoutChanged(int t)
void CanvasToolSelections::autoCreateSelections()
{
+ doAutoCreateSelections(false);
+}
+
+void CanvasToolSelections::autoCreateSelectionsPreview()
+{
+ doAutoCreateSelections(true);
+}
+
+void CanvasToolSelections::doAutoCreateSelections(bool preview)
+{
float *data = canvas->data;
size_t size = canvas->size;
+ if(preview) selections_preview.clear();
+
for(size_t i = 0; i < size; i++) {
if(fabs(data[i]) > fabs(threshold)) {
int from = i;
@@ -247,7 +286,11 @@ void CanvasToolSelections::autoCreateSelections()
}
Selection s(from, to, 2, ((to - from) / 3) * fadeout);
- selections.add(s);
+ if(preview) {
+ selections_preview.add(s);
+ } else {
+ selections.add(s);
+ }
i = to+1;
}
@@ -263,3 +306,9 @@ void CanvasToolSelections::clearSelections()
canvas->setCursor(Qt::ArrowCursor);
canvas->update();
}
+
+void CanvasToolSelections::setShowPreview(bool s)
+{
+ show_preview = s;
+ canvas->update();
+}
diff --git a/dgedit/canvastoolselections.h b/dgedit/canvastoolselections.h
index 8b877de..59786a7 100644
--- a/dgedit/canvastoolselections.h
+++ b/dgedit/canvastoolselections.h
@@ -38,7 +38,8 @@
class CanvasToolSelections : public CanvasTool {
Q_OBJECT
public:
- CanvasToolSelections(Canvas *canvas, Selections &selections);
+ CanvasToolSelections(Canvas *canvas, Selections &selections,
+ Selections &selections_preview);
QString name() { return "Selections"; }
bool mouseMoveEvent(QMouseEvent *event);
@@ -55,12 +56,16 @@ signals:
public slots:
void autoCreateSelections();
+ void autoCreateSelectionsPreview();
void clearSelections();
void thresholdChanged(double threshold);
void noiseFloorChanged(int t);
void fadeoutChanged(int t);
+ void setShowPreview(bool show_preview);
private:
+ void doAutoCreateSelections(bool preview);
+
bool selection_is_moving_left;
bool selection_is_moving_right;
@@ -74,8 +79,13 @@ private:
QColor colSel;
QColor colActiveSelBg;
QColor colActiveSel;
+ QColor colPreviewSelBg;
+ QColor colPreviewSel;
Selections &selections;
+ Selections &selections_preview;
+
+ bool show_preview;
};
#endif/*__DRUMGIZMO_CANVASTOOLSELECTIONS_H__*/
diff --git a/dgedit/mainwindow.cc b/dgedit/mainwindow.cc
index 70b6f78..b64d710 100644
--- a/dgedit/mainwindow.cc
+++ b/dgedit/mainwindow.cc
@@ -40,6 +40,7 @@
#include <QMenuBar>
#include <QFileDialog>
#include <QIntValidator>
+#include <QTabWidget>
#include <unistd.h>
@@ -64,36 +65,41 @@ static void addTool(QToolBar *toolbar, Canvas *canvas, CanvasTool *tool)
static CanvasToolListen *g_listen;
MainWindow::MainWindow()
{
+ {
+ int start = 44100 * 60;
+ Selection p(start, start + 44100 * 60, 0, 0); // one minute selection
+ selections_preview.add(p);
+ }
+
QWidget *central = new QWidget();
QHBoxLayout *lh = new QHBoxLayout();
QVBoxLayout *lv = new QVBoxLayout();
central->setLayout(lv);
setCentralWidget(central);
- extractor = new AudioExtractor(session, this);
+ extractor = new AudioExtractor(selections, this);
canvas = new Canvas(this);
- player.start();
-
QToolBar *toolbar = addToolBar("Tools");
g_listen = new CanvasToolListen(canvas, player);
CanvasTool *listen = g_listen;
addTool(toolbar, canvas, listen);
- CanvasTool *threshold = new CanvasToolThreshold(canvas);
+ threshold = new CanvasToolThreshold(canvas);
addTool(toolbar, canvas, threshold);
- selections = new CanvasToolSelections(canvas, session);
+ tool_selections = new CanvasToolSelections(canvas, selections,
+ selections_preview);
connect(threshold, SIGNAL(thresholdChanged(double)),
- selections, SLOT(thresholdChanged(double)));
- connect(&session, SIGNAL(activeChanged(sel_id_t)),
+ tool_selections, SLOT(thresholdChanged(double)));
+ connect(&selections, SIGNAL(activeChanged(sel_id_t)),
canvas, SLOT(update()));
- addTool(toolbar, canvas, selections);
+ addTool(toolbar, canvas, tool_selections);
QMenu *fileMenu = menuBar()->addMenu("&File");
QAction *act_quit = new QAction("&Quit", this);
fileMenu->addAction(act_quit);
connect(act_quit, SIGNAL(triggered()), this, SLOT(close()));
- QWidget *dock = new QWidget();
+ // QWidget *dock = new QWidget();
yoffset = new QScrollBar(Qt::Vertical);
yoffset->setRange(0, MAXVAL);
yoffset->setPageStep(PAGESTEP);
@@ -118,12 +124,13 @@ MainWindow::MainWindow()
xoffset->setSingleStep(SINGLESTEP);
connect(xoffset, SIGNAL(valueChanged(int)), this, SLOT(setXOffset(int)));
- sorter = new SampleSorter(session);
- connect(&session, SIGNAL(added(sel_id_t)),
+ sorter = new SampleSorter(selections);
+ connect(&selections, SIGNAL(added(sel_id_t)),
sorter, SLOT(addSelection(sel_id_t)));
- connect(&session, SIGNAL(updated(sel_id_t)), sorter, SLOT(relayout()));
- connect(&session, SIGNAL(removed(sel_id_t)), sorter, SLOT(relayout()));
- connect(&session, SIGNAL(activeChanged(sel_id_t)), sorter, SLOT(relayout()));
+ connect(&selections, SIGNAL(updated(sel_id_t)), sorter, SLOT(relayout()));
+ connect(&selections, SIGNAL(removed(sel_id_t)), sorter, SLOT(relayout()));
+ connect(&selections, SIGNAL(activeChanged(sel_id_t)),
+ sorter, SLOT(relayout()));
QPushButton *btn_playsamples = new QPushButton("Play samples");
connect(btn_playsamples, SIGNAL(clicked()), this, SLOT(playSamples()));
@@ -142,33 +149,145 @@ MainWindow::MainWindow()
lv->addWidget(btn_playsamples);
lv->addWidget(sb_playsamples);
+
+
+
+ // under tab widget
+
+ /*
+ attribs_layout->addWidget(new QLabel("Player volume:"), 7, 1, 1, 2);
+ lineed_slider4 = new QLineEdit();
+ lineed_slider4->setReadOnly(true);
+ lineed_slider4->setValidator(new QIntValidator(0, 1000000, lineed_slider4));
+ attribs_layout->addWidget(lineed_slider4, 8, 1);
+ QSlider *slider4 = new QSlider(Qt::Horizontal);
+ slider4->setRange(0, 1000000);
+ connect(slider4, SIGNAL(sliderMoved(int)),
+ this, SLOT(setVolumeLineEd(int)));
+ connect(slider4, SIGNAL(sliderMoved(int)),
+ listen, SLOT(setVolume(int)));
+ slider4->setValue(100000);
+ lineed_slider4->setText("100000");
+ attribs_layout->addWidget(slider4, 8, 2);
+
+ configs->addLayout(attribs_layout);
+ */
+
+
+
+ QDockWidget *dockWidget = new QDockWidget(tr("Dock Widget"), this);
+ dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
+
+ QTabWidget *tabs = new QTabWidget(this);
+ tabs->addTab(createFilesTab(), "Files");
+ generateTabId = tabs->addTab(createGenerateTab(), "Generate");
+ tabs->addTab(createEditTab(), "Edit");
+ tabs->addTab(createExportTab(), "Export");
+ connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
+
+ dockWidget->setWidget(tabs);
+ addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
+ // dock->setLayout(configs);
+
+ yscale->setValue(MAXVAL);
+ yoffset->setValue(MAXVAL/2);
+ xscale->setValue(0);
+ xoffset->setValue(0);
+
+ loadSettings();
+
+ QSettings settings("presets.ini", QSettings::IniFormat);
+ QStringList list = settings.childGroups();
+ for(int i = 0; i != list.size(); i++) {
+ QString presetname = list.at(i);
+ Preset p;
+ settings.beginGroup(presetname);
+ p.prefix = settings.value("prefix", "unknown").toString();
+ p.attacklength = settings.value("attacklength", 0).toInt();
+ p.falloff = settings.value("falloff", 0).toInt();
+ p.fadelength = settings.value("fadelength", 0).toInt();
+ settings.endGroup();
+ QVariant v;
+ v.setValue(p);
+ presets->addItem(presetname, v);
+ }
+
+ statusBar()->showMessage("Ready");
+}
+
+MainWindow::~MainWindow()
+{
+}
+
+void MainWindow::tabChanged(int tabid)
+{
+ tool_selections->setShowPreview(tabid == generateTabId);
+}
+
+QWidget *MainWindow::createFilesTab()
+{
+ QWidget *w = new QWidget();
+ QVBoxLayout *l = new QVBoxLayout();
+ w->setLayout(l);
+
+ l->addWidget(new QLabel("Files: (double-click to set as master)"));
+ QPushButton *loadbtn = new QPushButton();
+ loadbtn->setText("Add files...");
+ l->addWidget(loadbtn);
+
+ filelist = new FileList();
+ connect(filelist, SIGNAL(masterFileChanged(QString)),
+ this, SLOT(loadFile(QString)));
+ connect(loadbtn, SIGNAL(clicked()), filelist, SLOT(addFiles()));
+ connect(filelist, SIGNAL(fileAdded(QString, QString)),
+ extractor, SLOT(addFile(QString, QString)));
+ connect(filelist, SIGNAL(fileRemoved(QString, QString)),
+ extractor, SLOT(removeFile(QString, QString)));
+ connect(filelist, SIGNAL(nameChanged(QString, QString)),
+ extractor, SLOT(changeName(QString, QString)));
+ l->addWidget(filelist);
+
+ return w;
+}
+
+QWidget *MainWindow::createEditTab()
+{
+ return new QWidget();
+}
+
+QWidget *MainWindow::createGenerateTab()
+{
+ QWidget *w = new QWidget();
+ QVBoxLayout *l = new QVBoxLayout();
+ w->setLayout(l);
+
QHBoxLayout *btns = new QHBoxLayout();
QPushButton *autosel = new QPushButton();
- autosel->setText("Auto");
- connect(autosel, SIGNAL(clicked()), selections, SLOT(clearSelections()));
- connect(autosel, SIGNAL(clicked()), selections, SLOT(autoCreateSelections()));
+ autosel->setText("Generate");
+ connect(autosel, SIGNAL(clicked()),
+ tool_selections, SLOT(clearSelections()));
+ connect(autosel, SIGNAL(clicked()),
+ tool_selections, SLOT(autoCreateSelections()));
+
+ connect(threshold, SIGNAL(thresholdChanged(double)),
+ tool_selections, SLOT(autoCreateSelectionsPreview()));
QPushButton *clearsel = new QPushButton();
clearsel->setText("Clear");
- connect(clearsel, SIGNAL(clicked()), selections, SLOT(clearSelections()));
-
- QPushButton *exportsel = new QPushButton();
- exportsel->setText("Export");
- connect(exportsel, SIGNAL(clicked()), this, SLOT(doExport()));
+ connect(clearsel, SIGNAL(clicked()),
+ tool_selections, SLOT(clearSelections()));
btns->addWidget(autosel);
btns->addWidget(clearsel);
- btns->addWidget(exportsel);
-
- QVBoxLayout *configs = new QVBoxLayout();
- configs->addLayout(btns);
+ l->addLayout(btns);
- configs->addWidget(new QLabel("Presets:"));
+ l->addWidget(new QLabel("Presets:"));
presets = new QComboBox();
- connect(presets, SIGNAL(currentIndexChanged(int)), this, SLOT(setPreset(int)));
- configs->addWidget(presets);
+ connect(presets, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(setPreset(int)));
+ l->addWidget(presets);
QGridLayout *attribs_layout = new QGridLayout();
@@ -184,6 +303,9 @@ MainWindow::MainWindow()
this, SLOT(setAttackLengthLineEd(int)));
connect(slider_attacklength, SIGNAL(sliderMoved(int)),
sorter, SLOT(setAttackLength(int)));
+ connect(slider_attacklength, SIGNAL(sliderMoved(int)),
+ tool_selections, SLOT(autoCreateSelectionsPreview()));
+
slider_attacklength->setValue(666);
attribs_layout->addWidget(slider_attacklength, 2, 2);
@@ -197,7 +319,10 @@ MainWindow::MainWindow()
connect(slider_falloff, SIGNAL(sliderMoved(int)),
this, SLOT(setFalloffLineEd(int)));
connect(slider_falloff, SIGNAL(sliderMoved(int)),
- selections, SLOT(noiseFloorChanged(int)));
+ tool_selections, SLOT(noiseFloorChanged(int)));
+ connect(slider_falloff, SIGNAL(sliderMoved(int)),
+ tool_selections, SLOT(autoCreateSelectionsPreview()));
+
slider_falloff->setValue(666);
attribs_layout->addWidget(slider_falloff, 4, 2);
@@ -212,34 +337,33 @@ MainWindow::MainWindow()
connect(slider_fadelength, SIGNAL(sliderMoved(int)),
this, SLOT(setFadeLengthLineEd(int)));
connect(slider_fadelength, SIGNAL(sliderMoved(int)),
- selections, SLOT(fadeoutChanged(int)));
+ tool_selections, SLOT(fadeoutChanged(int)));
+ connect(slider_fadelength, SIGNAL(sliderMoved(int)),
+ tool_selections, SLOT(autoCreateSelectionsPreview()));
+
slider_fadelength->setValue(666);
attribs_layout->addWidget(slider_fadelength, 6, 2);
- attribs_layout->addWidget(new QLabel("Player volume:"), 7, 1, 1, 2);
- lineed_slider4 = new QLineEdit();
- lineed_slider4->setReadOnly(true);
- lineed_slider4->setValidator(new QIntValidator(0, 1000000, lineed_slider4));
- attribs_layout->addWidget(lineed_slider4, 8, 1);
- QSlider *slider4 = new QSlider(Qt::Horizontal);
- slider4->setRange(0, 1000000);
- connect(slider4, SIGNAL(sliderMoved(int)),
- this, SLOT(setVolumeLineEd(int)));
- connect(slider4, SIGNAL(sliderMoved(int)),
- listen, SLOT(setVolume(int)));
- slider4->setValue(100000);
- lineed_slider4->setText("100000");
- attribs_layout->addWidget(slider4, 8, 2);
+ l->addLayout(attribs_layout);
- configs->addLayout(attribs_layout);
+ l->addStretch();
- configs->addWidget(new QLabel("Prefix:"));
+ return w;
+}
+
+QWidget *MainWindow::createExportTab()
+{
+ QWidget *w = new QWidget();
+ QVBoxLayout *l = new QVBoxLayout();
+ w->setLayout(l);
+
+ l->addWidget(new QLabel("Prefix:"));
prefix = new QLineEdit();
connect(prefix, SIGNAL(textChanged(const QString &)),
extractor, SLOT(setOutputPrefix(const QString &)));
- configs->addWidget(prefix);
+ l->addWidget(prefix);
- configs->addWidget(new QLabel("Export path:"));
+ l->addWidget(new QLabel("Export path:"));
QHBoxLayout *lo_exportp = new QHBoxLayout();
lineed_exportp = new QLineEdit();
connect(lineed_exportp, SIGNAL(textChanged(const QString &)),
@@ -249,59 +373,16 @@ MainWindow::MainWindow()
connect(btn_browse, SIGNAL(clicked()), this, SLOT(browse()));
lo_exportp->addWidget(btn_browse);
- configs->addLayout(lo_exportp);
-
- configs->addWidget(new QLabel("Files: (double-click to set as master)"));
- QPushButton *loadbtn = new QPushButton();
- loadbtn->setText("Add files...");
- configs->addWidget(loadbtn);
+ l->addLayout(lo_exportp);
- filelist = new FileList();
- connect(filelist, SIGNAL(masterFileChanged(QString)),
- this, SLOT(loadFile(QString)));
- connect(loadbtn, SIGNAL(clicked()), filelist, SLOT(addFiles()));
- connect(filelist, SIGNAL(fileAdded(QString, QString)),
- extractor, SLOT(addFile(QString, QString)));
- connect(filelist, SIGNAL(fileRemoved(QString, QString)),
- extractor, SLOT(removeFile(QString, QString)));
- connect(filelist, SIGNAL(nameChanged(QString, QString)),
- extractor, SLOT(changeName(QString, QString)));
- configs->addWidget(filelist);
-
- QDockWidget *dockWidget = new QDockWidget(tr("Dock Widget"), this);
- dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
- dockWidget->setWidget(dock);
- addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
- dock->setLayout(configs);
-
- yscale->setValue(MAXVAL);
- yoffset->setValue(MAXVAL/2);
- xscale->setValue(0);
- xoffset->setValue(0);
-
- loadSettings();
-
- QSettings settings("presets.ini", QSettings::IniFormat);
- QStringList list = settings.childGroups();
- for(int i = 0; i != list.size(); i++) {
- QString presetname = list.at(i);
- Preset p;
- settings.beginGroup(presetname);
- p.prefix = settings.value("prefix", "unknown").toString();
- p.attacklength = settings.value("attacklength", 0).toInt();
- p.falloff = settings.value("falloff", 0).toInt();
- p.fadelength = settings.value("fadelength", 0).toInt();
- settings.endGroup();
- QVariant v;
- v.setValue(p);
- presets->addItem(presetname, v);
- }
+ QPushButton *exportsel = new QPushButton();
+ exportsel->setText("Export");
+ connect(exportsel, SIGNAL(clicked()), this, SLOT(doExport()));
+ l->addWidget(exportsel);
- statusBar()->showMessage("Ready");
-}
+ l->addStretch();
-MainWindow::~MainWindow()
-{
+ return w;
}
void MainWindow::setAttackLengthLineEd(int value)
@@ -329,12 +410,12 @@ void MainWindow::playSamples()
{
//unsigned int length = 44100 / 4; // 0.25 seconds in 44k1Hz
- QVector<sel_id_t> ids = session.ids();
+ QVector<sel_id_t> ids = selections.ids();
for(int v1 = 0; v1 < ids.size(); v1++) {
for(int v2 = 0; v2 < ids.size(); v2++) {
- Selection sel1 = session.get(ids[v1]);
- Selection sel2 = session.get(ids[v2]);
+ Selection sel1 = selections.get(ids[v1]);
+ Selection sel2 = selections.get(ids[v2]);
if(sel1.energy < sel2.energy) {
sel_id_t vtmp = ids[v1];
@@ -346,7 +427,7 @@ void MainWindow::playSamples()
QVector<sel_id_t>::iterator i = ids.begin();
while(i != ids.end()) {
- Selection sel = session.get(*i);
+ Selection sel = selections.get(*i);
unsigned int length = sb_playsamples->value() * 44100 / 1000;
@@ -358,7 +439,7 @@ void MainWindow::playSamples()
if(sample_length > length) to = sel.from + length;
else sleep = length - sample_length;
- session.setActive(*i);
+ selections.setActive(*i);
g_listen->playRange(sel.from, to);
usleep(1000000 * sleep / 44100);
diff --git a/dgedit/mainwindow.h b/dgedit/mainwindow.h
index cd13132..620c116 100644
--- a/dgedit/mainwindow.h
+++ b/dgedit/mainwindow.h
@@ -39,6 +39,7 @@
#include "samplesorter.h"
#include "filelist.h"
#include "canvastoolselections.h"
+#include "canvastoolthreshold.h"
#include "selection.h"
#include "player.h"
@@ -67,6 +68,7 @@ public slots:
void playSamples();
void setPreset(int);
void browse();
+ void tabChanged(int tabid);
protected:
void closeEvent(QCloseEvent*);
@@ -75,9 +77,17 @@ private:
void loadSettings();
void saveSettings();
+ QWidget *createFilesTab();
+ QWidget *createEditTab();
+ QWidget *createGenerateTab();
+ QWidget *createExportTab();
+
+ int generateTabId;
+
SampleSorter *sorter;
Canvas *canvas;
- CanvasToolSelections *selections;
+ CanvasToolSelections *tool_selections;
+ CanvasToolThreshold *threshold;
AudioExtractor *extractor;
FileList *filelist;
QScrollBar *yoffset;
@@ -97,7 +107,8 @@ private:
QLineEdit *lineed_exportp;
// Session state information:
- Selections session;
+ Selections selections;
+ Selections selections_preview;
Player player;
private slots: