summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-04-02 21:13:52 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2014-04-02 21:13:52 +0200
commit0aef6f2f81bdb6f78fc04e090aa60b5146326765 (patch)
tree4ccebf2382bd0a990c97da38b1bad2bb2a3cfd00
parent644c3996fe91f35bcdc84e0c3bb4f906be740bae (diff)
parentd8053dd8e6d38165d9ac6a689081bc4a753ff7ad (diff)
Merge with head
-rw-r--r--dgedit/mainwindow.cc74
-rw-r--r--dgedit/mainwindow.h20
-rw-r--r--dgedit/presets.ini15
-rw-r--r--drumgizmo/output/jackaudio/jackaudio.cc6
-rw-r--r--src/drumgizmo.cc2
5 files changed, 92 insertions, 25 deletions
diff --git a/dgedit/mainwindow.cc b/dgedit/mainwindow.cc
index 5a901c7..dfc150c 100644
--- a/dgedit/mainwindow.cc
+++ b/dgedit/mainwindow.cc
@@ -30,7 +30,6 @@
#include <QVBoxLayout>
#include <QPushButton>
-#include <QLineEdit>
#include <QLabel>
#include <QStatusBar>
#include <QApplication>
@@ -39,10 +38,8 @@
#include <QToolBar>
#include <QAction>
#include <QMenuBar>
-#include <QSlider>
#include "canvastool.h"
-#include "canvastoolselections.h"
#include "canvastoolthreshold.h"
#include "canvastoollisten.h"
@@ -78,7 +75,7 @@ MainWindow::MainWindow()
addTool(toolbar, canvas, listen);
CanvasTool *threshold = new CanvasToolThreshold(canvas);
addTool(toolbar, canvas, threshold);
- CanvasTool *selections = new CanvasToolSelections(canvas);
+ selections = new CanvasToolSelections(canvas);
connect(threshold, SIGNAL(thresholdChanged(double)),
selections, SLOT(thresholdChanged(double)));
addTool(toolbar, canvas, selections);
@@ -162,28 +159,33 @@ MainWindow::MainWindow()
configs->addLayout(btns);
+ configs->addWidget(new QLabel("Presets:"));
+ presets = new QComboBox();
+ connect(presets, SIGNAL(currentIndexChanged(int)), this, SLOT(setPreset(int)));
+ configs->addWidget(presets);
+
configs->addWidget(new QLabel("Attack length:"));
- QSlider *slider = new QSlider(Qt::Horizontal);
- slider->setRange(10, 1000);
- connect(slider, SIGNAL(sliderMoved(int)), sorter, SLOT(setAttackLength(int)));
- slider->setValue(666);
- configs->addWidget(slider);
+ slider_attacklength = new QSlider(Qt::Horizontal);
+ slider_attacklength->setRange(10, 1000);
+ connect(slider_attacklength, SIGNAL(sliderMoved(int)), sorter, SLOT(setAttackLength(int)));
+ slider_attacklength->setValue(666);
+ configs->addWidget(slider_attacklength);
configs->addWidget(new QLabel("Falloff:"));
- QSlider *slider2 = new QSlider(Qt::Horizontal);
- slider2->setRange(1, 10000);
- connect(slider2, SIGNAL(sliderMoved(int)),
+ slider_falloff = new QSlider(Qt::Horizontal);
+ slider_falloff->setRange(1, 10000);
+ connect(slider_falloff, SIGNAL(sliderMoved(int)),
selections, SLOT(noiseFloorChanged(int)));
- slider2->setValue(666);
- configs->addWidget(slider2);
+ slider_falloff->setValue(666);
+ configs->addWidget(slider_falloff);
configs->addWidget(new QLabel("Fadelength:"));
- QSlider *slider3 = new QSlider(Qt::Horizontal);
- slider3->setRange(1, 2000);
- connect(slider3, SIGNAL(sliderMoved(int)),
+ slider_fadelength = new QSlider(Qt::Horizontal);
+ slider_fadelength->setRange(1, 2000);
+ connect(slider_fadelength, SIGNAL(sliderMoved(int)),
selections, SLOT(fadeoutChanged(int)));
- slider3->setValue(666);
- configs->addWidget(slider3);
+ slider_fadelength->setValue(666);
+ configs->addWidget(slider_fadelength);
configs->addWidget(new QLabel("Player volume:"));
QSlider *slider4 = new QSlider(Qt::Horizontal);
@@ -194,7 +196,7 @@ MainWindow::MainWindow()
configs->addWidget(slider4);
configs->addWidget(new QLabel("Prefix:"));
- QLineEdit *prefix = new QLineEdit();
+ prefix = new QLineEdit();
connect(prefix, SIGNAL(textChanged(const QString &)),
extractor, SLOT(setOutputPrefix(const QString &)));
prefix->setText("kick-r");
@@ -234,8 +236,25 @@ MainWindow::MainWindow()
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");
}
@@ -334,3 +353,16 @@ void MainWindow::loadFile(QString filename)
statusBar()->showMessage("Ready");
setCursor(Qt::ArrowCursor);
}
+
+void MainWindow::setPreset(int index)
+{
+ QVariant v = presets->itemData(index);
+ Preset p = v.value<Preset>();
+ slider_attacklength->setValue(p.attacklength);
+ slider_falloff->setValue(p.falloff);
+ slider_fadelength->setValue(p.fadelength);
+ prefix->setText(p.prefix);
+// sorter->setAttackLength(p.attacklength);
+// selections->noiseFloorChanged(p.falloff);
+// selections->fadeoutChanged(p.fadeout);
+}
diff --git a/dgedit/mainwindow.h b/dgedit/mainwindow.h
index 886f9cb..c7ce3fb 100644
--- a/dgedit/mainwindow.h
+++ b/dgedit/mainwindow.h
@@ -29,11 +29,24 @@
#include <QMainWindow>
#include <QScrollBar>
+#include <QComboBox>
+#include <QSlider>
+#include <QLineEdit>
#include "canvas.h"
#include "audioextractor.h"
#include "samplesorter.h"
#include "filelist.h"
+#include "canvastoolselections.h"
+
+class Preset {
+public:
+ QString prefix;
+ int attacklength;
+ int falloff;
+ int fadelength;
+};
+Q_DECLARE_METATYPE(Preset)
class MainWindow : public QMainWindow {
Q_OBJECT
@@ -48,6 +61,7 @@ public slots:
void doExport();
void loadFile(QString filename);
void playSamples();
+ void setPreset(int);
protected:
void closeEvent(QCloseEvent*);
@@ -58,6 +72,7 @@ private:
SampleSorter *sorter;
Canvas *canvas;
+ CanvasToolSelections *selections;
AudioExtractor *extractor;
FileList *filelist;
QScrollBar *yoffset;
@@ -65,6 +80,11 @@ private:
QScrollBar *xscale;
QScrollBar *xoffset;
QScrollBar *sb_playsamples;
+ QComboBox *presets;
+ QSlider *slider_attacklength;
+ QSlider *slider_falloff;
+ QSlider *slider_fadelength;
+ QLineEdit *prefix;
};
#endif/*__DRUMGIZMO_MAINWINDOW_H__*/
diff --git a/dgedit/presets.ini b/dgedit/presets.ini
new file mode 100644
index 0000000..6434f05
--- /dev/null
+++ b/dgedit/presets.ini
@@ -0,0 +1,15 @@
+[Bright snare]
+ prefix = "Snare"
+ attacklength = 1
+ falloff = 2
+ fadelength = 3
+[Tommy gun]
+ prefix = "Tom"
+ attacklength = 10
+ falloff = 20
+ fadelength = 30
+[Kickdrum]
+ prefix = "Kickass"
+ attacklength = 100
+ falloff = 200
+ fadelength = 300
diff --git a/drumgizmo/output/jackaudio/jackaudio.cc b/drumgizmo/output/jackaudio/jackaudio.cc
index 385eb48..0fd985e 100644
--- a/drumgizmo/output/jackaudio/jackaudio.cc
+++ b/drumgizmo/output/jackaudio/jackaudio.cc
@@ -85,7 +85,7 @@ bool JackAudio::init(int nchannels, char *cnames[])
name.c_str(),
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput, 0);
- channels[i] = (sample_t*)malloc(1024 * sizeof(sample_t));
+ channels[i] = (sample_t*)malloc(16 * sizeof(sample_t));
}
return true;
}
@@ -127,9 +127,9 @@ void JackAudio::post(size_t size)
void JackAudio::jack_process(jack_nframes_t nframes)
{
- if(nframes != 1024) {
+ if(nframes != 128) {
fprintf(stderr, "jackaudio output module currently only works with a"
- " bufferszie of 1024 samples!\n");
+ " buffersize of 64 samples!\n");
exit(1);
}
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc
index fa26640..4bd6a77 100644
--- a/src/drumgizmo.cc
+++ b/src/drumgizmo.cc
@@ -288,7 +288,7 @@ void DrumGizmo::run(int endpos)
oe->start();
size_t pos = 0;
- size_t nsamples = 1024;
+ size_t nsamples = 128;//1024;
sample_t samples[nsamples];
while(run(pos, samples, nsamples) == true) {