diff --git a/samplebrain/interface/samplebrain.ui b/samplebrain/interface/samplebrain.ui
index 110b8e9..80a23da 100644
--- a/samplebrain/interface/samplebrain.ui
+++ b/samplebrain/interface/samplebrain.ui
@@ -7,7 +7,7 @@
0
0
910
- 659
+ 669
@@ -742,6 +742,9 @@
-
+
+ 10
+
99999
@@ -771,13 +774,13 @@
-
- 1.000000000000000
+ 0.990000000000000
0.010000000000000
- 0.000000000000000
+ 0.800000000000000
@@ -1066,19 +1069,37 @@
-
-
-
-
-
- Comic Sans MS
- 20
- 75
- true
-
-
-
- brain contents
-
-
+
+
-
+
+
+
+ Comic Sans MS
+ 20
+ 75
+ true
+
+
+
+ brain contents
+
+
+
+ -
+
+
+ all
+
+
+
+ -
+
+
+ none
+
+
+
+
-
@@ -1088,6 +1109,12 @@
200
+
+ QFrame::StyledPanel
+
+
+ QFrame::Sunken
+
true
@@ -1096,7 +1123,7 @@
0
0
- 259
+ 284
198
@@ -1124,6 +1151,13 @@
+ -
+
+
+ directory
+
+
+
-
@@ -1134,7 +1168,7 @@
- clear brain
+ clear
@@ -1158,6 +1192,9 @@
-
+
+ 10
+
99999
@@ -1187,7 +1224,7 @@
-
- 1.000000000000000
+ 0.990000000000000
0.010000000000000
@@ -2298,6 +2335,54 @@
+
+ pushButtonLoadSounds
+ released()
+ MainWindow
+ load_sounds()
+
+
+ 754
+ 321
+
+
+ 454
+ 334
+
+
+
+
+ toolButtonAll
+ released()
+ MainWindow
+ select_all()
+
+
+ 813
+ 74
+
+
+ 454
+ 334
+
+
+
+
+ toolButtonNone
+ released()
+ MainWindow
+ select_none()
+
+
+ 862
+ 74
+
+
+ 454
+ 334
+
+
+
play_slot()
@@ -2351,10 +2436,8 @@
target_shape(int)
brain_shape(int)
algo(int)
+ load_sounds()
+ select_all()
+ select_none()
-
-
-
-
-
diff --git a/samplebrain/qt/MainWindow.h b/samplebrain/qt/MainWindow.h
index 95cc557..16b1aa3 100644
--- a/samplebrain/qt/MainWindow.h
+++ b/samplebrain/qt/MainWindow.h
@@ -15,6 +15,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include
+#include
#include "generated/ui_samplebrain.h"
#include
@@ -151,7 +152,7 @@ private slots:
void load_sound() {
m_last_file=QFileDialog::getOpenFileName(
this,
- QString("Select an wav file"),
+ QString("Select a wav file"),
m_last_file,
QString("Sounds (*.wav)"));
@@ -165,9 +166,48 @@ private slots:
m_sound_item_delete_mapper->setMapping(si.m_del, si.m_id);
}
+
+ void load_sounds() {
+ m_last_file=QFileDialog::getExistingDirectory(this,
+ QString("Select a directory"),
+ m_last_file);
+
+
+ QDirIterator dirIt(m_last_file,QDirIterator::Subdirectories);
+ while (dirIt.hasNext()) {
+ dirIt.next();
+ if (QFileInfo(dirIt.filePath()).isFile() &&
+ QFileInfo(dirIt.filePath()).suffix() == "wav") {
+ send_process_osc("/load_sample","s",dirIt.filePath().toStdString().c_str());
+
+ sound_items::sound_item &si = m_sound_items.add(m_Ui.brain_contents, dirIt.filePath().toStdString(),true);
+
+ QObject::connect(si.m_enable, SIGNAL(clicked()), m_sound_item_enable_mapper, SLOT(map()));
+ m_sound_item_enable_mapper->setMapping(si.m_enable, si.m_id);
+ QObject::connect(si.m_del, SIGNAL(clicked()), m_sound_item_delete_mapper, SLOT(map()));
+ m_sound_item_delete_mapper->setMapping(si.m_del, si.m_id);
+
+ }
+ }
+ }
+
+ void select_all() {
+ for (auto &si:m_sound_items.m_sound_items) {
+ si.m_enable->setChecked(true);
+ send_process_osc("/activate_sound","s",si.m_filename.c_str());
+ }
+ }
+
+ void select_none() {
+ for (auto &si:m_sound_items.m_sound_items) {
+ si.m_enable->setChecked(false);
+ send_process_osc("/deactivate_sound","s",si.m_filename.c_str());
+ }
+ }
+
void sound_enable(int id) {
// search for this id...
- for (auto si:m_sound_items.m_sound_items) {
+ for (auto &si:m_sound_items.m_sound_items) {
if (si.m_id==id) {
if (si.m_enable->isChecked()) {
send_process_osc("/activate_sound","s",si.m_filename.c_str());
@@ -190,8 +230,6 @@ private slots:
}
}
void clear_brain() {
- cerr<<"clear brain"<
#include
@@ -28,6 +28,7 @@
#include
#include
#include
+#include
#include
#include
@@ -114,13 +115,17 @@ public:
QCheckBox *checkBoxStereo;
QSpacerItem *verticalSpacer;
QVBoxLayout *verticalLayout_2;
+ QHBoxLayout *horizontalLayout_18;
QLabel *label_3;
+ QToolButton *toolButtonAll;
+ QToolButton *toolButtonNone;
QScrollArea *scrollArea;
QWidget *scrollAreaWidgetContents;
QVBoxLayout *verticalLayout_5;
QVBoxLayout *brain_contents;
QHBoxLayout *horizontalLayout_2;
QPushButton *pushButtonLoadSound;
+ QPushButton *pushButtonLoadSounds;
QPushButton *pushButtonClearBrain;
QHBoxLayout *horizontalLayout_4;
QLabel *label;
@@ -151,15 +156,12 @@ public:
QSpacerItem *horizontalSpacer;
QLabel *label_13;
QStatusBar *statusbar;
- QButtonGroup *buttonGroup_2;
- QButtonGroup *buttonGroup_3;
- QButtonGroup *buttonGroup;
void setupUi(QMainWindow *MainWindow)
{
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
- MainWindow->resize(910, 659);
+ MainWindow->resize(910, 669);
centralwidget = new QWidget(MainWindow);
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
verticalLayout_4 = new QVBoxLayout(centralwidget);
@@ -538,6 +540,7 @@ public:
spinBoxBlockSizeTarget = new QSpinBox(controlTab);
spinBoxBlockSizeTarget->setObjectName(QString::fromUtf8("spinBoxBlockSizeTarget"));
+ spinBoxBlockSizeTarget->setMinimum(10);
spinBoxBlockSizeTarget->setMaximum(99999);
spinBoxBlockSizeTarget->setValue(3000);
@@ -556,9 +559,9 @@ public:
doubleSpinBoxBlockOverlapTarget = new QDoubleSpinBox(controlTab);
doubleSpinBoxBlockOverlapTarget->setObjectName(QString::fromUtf8("doubleSpinBoxBlockOverlapTarget"));
- doubleSpinBoxBlockOverlapTarget->setMaximum(1);
+ doubleSpinBoxBlockOverlapTarget->setMaximum(0.99);
doubleSpinBoxBlockOverlapTarget->setSingleStep(0.01);
- doubleSpinBoxBlockOverlapTarget->setValue(0);
+ doubleSpinBoxBlockOverlapTarget->setValue(0.8);
horizontalLayout_14->addWidget(doubleSpinBoxBlockOverlapTarget);
@@ -697,19 +700,36 @@ public:
verticalLayout_2 = new QVBoxLayout();
verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2"));
+ horizontalLayout_18 = new QHBoxLayout();
+ horizontalLayout_18->setObjectName(QString::fromUtf8("horizontalLayout_18"));
label_3 = new QLabel(controlTab);
label_3->setObjectName(QString::fromUtf8("label_3"));
label_3->setFont(font1);
- verticalLayout_2->addWidget(label_3);
+ horizontalLayout_18->addWidget(label_3);
+
+ toolButtonAll = new QToolButton(controlTab);
+ toolButtonAll->setObjectName(QString::fromUtf8("toolButtonAll"));
+
+ horizontalLayout_18->addWidget(toolButtonAll);
+
+ toolButtonNone = new QToolButton(controlTab);
+ toolButtonNone->setObjectName(QString::fromUtf8("toolButtonNone"));
+
+ horizontalLayout_18->addWidget(toolButtonNone);
+
+
+ verticalLayout_2->addLayout(horizontalLayout_18);
scrollArea = new QScrollArea(controlTab);
scrollArea->setObjectName(QString::fromUtf8("scrollArea"));
scrollArea->setMinimumSize(QSize(0, 200));
+ scrollArea->setFrameShape(QFrame::StyledPanel);
+ scrollArea->setFrameShadow(QFrame::Sunken);
scrollArea->setWidgetResizable(true);
scrollAreaWidgetContents = new QWidget();
scrollAreaWidgetContents->setObjectName(QString::fromUtf8("scrollAreaWidgetContents"));
- scrollAreaWidgetContents->setGeometry(QRect(0, 0, 259, 198));
+ scrollAreaWidgetContents->setGeometry(QRect(0, 0, 284, 198));
verticalLayout_5 = new QVBoxLayout(scrollAreaWidgetContents);
verticalLayout_5->setObjectName(QString::fromUtf8("verticalLayout_5"));
brain_contents = new QVBoxLayout();
@@ -729,6 +749,11 @@ public:
horizontalLayout_2->addWidget(pushButtonLoadSound);
+ pushButtonLoadSounds = new QPushButton(controlTab);
+ pushButtonLoadSounds->setObjectName(QString::fromUtf8("pushButtonLoadSounds"));
+
+ horizontalLayout_2->addWidget(pushButtonLoadSounds);
+
pushButtonClearBrain = new QPushButton(controlTab);
pushButtonClearBrain->setObjectName(QString::fromUtf8("pushButtonClearBrain"));
pushButtonClearBrain->setFont(font);
@@ -748,6 +773,7 @@ public:
spinBoxBlockSize = new QSpinBox(controlTab);
spinBoxBlockSize->setObjectName(QString::fromUtf8("spinBoxBlockSize"));
+ spinBoxBlockSize->setMinimum(10);
spinBoxBlockSize->setMaximum(99999);
spinBoxBlockSize->setValue(3000);
@@ -766,7 +792,7 @@ public:
doubleSpinBoxBlockOverlap = new QDoubleSpinBox(controlTab);
doubleSpinBoxBlockOverlap->setObjectName(QString::fromUtf8("doubleSpinBoxBlockOverlap"));
- doubleSpinBoxBlockOverlap->setMaximum(1);
+ doubleSpinBoxBlockOverlap->setMaximum(0.99);
doubleSpinBoxBlockOverlap->setSingleStep(0.01);
doubleSpinBoxBlockOverlap->setValue(0);
@@ -970,6 +996,9 @@ public:
QObject::connect(comboBoxAlgorithm, SIGNAL(currentIndexChanged(int)), MainWindow, SLOT(algo(int)));
QObject::connect(comboBoxTargetShape, SIGNAL(currentIndexChanged(int)), MainWindow, SLOT(target_shape(int)));
QObject::connect(comboBoxBrainShape, SIGNAL(currentIndexChanged(int)), MainWindow, SLOT(brain_shape(int)));
+ QObject::connect(pushButtonLoadSounds, SIGNAL(released()), MainWindow, SLOT(load_sounds()));
+ QObject::connect(toolButtonAll, SIGNAL(released()), MainWindow, SLOT(select_all()));
+ QObject::connect(toolButtonNone, SIGNAL(released()), MainWindow, SLOT(select_none()));
tabWidget->setCurrentIndex(0);
@@ -1092,8 +1121,11 @@ public:
#endif // QT_NO_TOOLTIP
checkBoxStereo->setText(QApplication::translate("MainWindow", "stereo mode", 0, QApplication::UnicodeUTF8));
label_3->setText(QApplication::translate("MainWindow", "brain contents", 0, QApplication::UnicodeUTF8));
+ toolButtonAll->setText(QApplication::translate("MainWindow", "all", 0, QApplication::UnicodeUTF8));
+ toolButtonNone->setText(QApplication::translate("MainWindow", "none", 0, QApplication::UnicodeUTF8));
pushButtonLoadSound->setText(QApplication::translate("MainWindow", "load sound", 0, QApplication::UnicodeUTF8));
- pushButtonClearBrain->setText(QApplication::translate("MainWindow", "clear brain", 0, QApplication::UnicodeUTF8));
+ pushButtonLoadSounds->setText(QApplication::translate("MainWindow", "directory", 0, QApplication::UnicodeUTF8));
+ pushButtonClearBrain->setText(QApplication::translate("MainWindow", "clear", 0, QApplication::UnicodeUTF8));
label->setText(QApplication::translate("MainWindow", "block size", 0, QApplication::UnicodeUTF8));
label_2->setText(QApplication::translate("MainWindow", "block overlap", 0, QApplication::UnicodeUTF8));
label_15->setText(QApplication::translate("MainWindow", "window shape", 0, QApplication::UnicodeUTF8));
@@ -1130,4 +1162,4 @@ namespace Ui {
QT_END_NAMESPACE
-#endif // SAMPLEBRAINU19467_H
+#endif // SAMPLEBRAINE24659_H