more sound slection stuff
This commit is contained in:
parent
732bfaa61b
commit
7883179a3c
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>910</width>
|
||||
<height>659</height>
|
||||
<height>669</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
@ -742,6 +742,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBoxBlockSizeTarget">
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>99999</number>
|
||||
</property>
|
||||
|
|
@ -771,13 +774,13 @@
|
|||
<item>
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxBlockOverlapTarget">
|
||||
<property name="maximum">
|
||||
<double>1.000000000000000</double>
|
||||
<double>0.990000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
<double>0.800000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -1066,19 +1069,37 @@
|
|||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Comic Sans MS</family>
|
||||
<pointsize>20</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>brain contents</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_18">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Comic Sans MS</family>
|
||||
<pointsize>20</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>brain contents</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonAll">
|
||||
<property name="text">
|
||||
<string>all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonNone">
|
||||
<property name="text">
|
||||
<string>none</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
|
|
@ -1088,6 +1109,12 @@
|
|||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
|
@ -1096,7 +1123,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>259</width>
|
||||
<width>284</width>
|
||||
<height>198</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -1124,6 +1151,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonLoadSounds">
|
||||
<property name="text">
|
||||
<string>directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonClearBrain">
|
||||
<property name="font">
|
||||
|
|
@ -1134,7 +1168,7 @@
|
|||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>clear brain</string>
|
||||
<string>clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -1158,6 +1192,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBoxBlockSize">
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>99999</number>
|
||||
</property>
|
||||
|
|
@ -1187,7 +1224,7 @@
|
|||
<item>
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBoxBlockOverlap">
|
||||
<property name="maximum">
|
||||
<double>1.000000000000000</double>
|
||||
<double>0.990000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.010000000000000</double>
|
||||
|
|
@ -2298,6 +2335,54 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pushButtonLoadSounds</sender>
|
||||
<signal>released()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>load_sounds()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>754</x>
|
||||
<y>321</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>454</x>
|
||||
<y>334</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>toolButtonAll</sender>
|
||||
<signal>released()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>select_all()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>813</x>
|
||||
<y>74</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>454</x>
|
||||
<y>334</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>toolButtonNone</sender>
|
||||
<signal>released()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>select_none()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>862</x>
|
||||
<y>74</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>454</x>
|
||||
<y>334</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>play_slot()</slot>
|
||||
|
|
@ -2351,10 +2436,8 @@
|
|||
<slot>target_shape(int)</slot>
|
||||
<slot>brain_shape(int)</slot>
|
||||
<slot>algo(int)</slot>
|
||||
<slot>load_sounds()</slot>
|
||||
<slot>select_all()</slot>
|
||||
<slot>select_none()</slot>
|
||||
</slots>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroup_2"/>
|
||||
<buttongroup name="buttonGroup_3"/>
|
||||
<buttongroup name="buttonGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <QtGui>
|
||||
#include <QDirIterator>
|
||||
#include "generated/ui_samplebrain.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
@ -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"<<endl;
|
||||
|
||||
for (auto &si:m_sound_items.m_sound_items) {
|
||||
send_process_osc("/delete_sample","s",si.m_filename.c_str());
|
||||
}
|
||||
|
|
@ -253,7 +291,7 @@ private slots:
|
|||
this,
|
||||
QString("Select a session file"),
|
||||
m_last_file,
|
||||
QString("Sessions (*.samplebrain)"));
|
||||
QString("Sessions *.samplebrain (*.samplebrain)"));
|
||||
|
||||
send_process_osc("/load_session","s",m_last_file.toStdString().c_str());
|
||||
init_from_session(m_last_file.toStdString());
|
||||
|
|
@ -264,7 +302,7 @@ private slots:
|
|||
this,
|
||||
QString("Select a session file"),
|
||||
m_last_file,
|
||||
QString("Sessions (*.samplebrain)"));
|
||||
QString("Sessions *.samplebrain (*.samplebrain)"));
|
||||
|
||||
send_process_osc("/save_session","s",m_last_file.toStdString().c_str());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
/********************************************************************************
|
||||
** Form generated from reading UI file 'samplebrainu19467.ui'
|
||||
** Form generated from reading UI file 'samplebrainE24659.ui'
|
||||
**
|
||||
** Created by: Qt User Interface Compiler version 4.8.6
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef SAMPLEBRAINU19467_H
|
||||
#define SAMPLEBRAINU19467_H
|
||||
#ifndef SAMPLEBRAINE24659_H
|
||||
#define SAMPLEBRAINE24659_H
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtGui/QAction>
|
||||
|
|
@ -28,6 +28,7 @@
|
|||
#include <QtGui/QSpinBox>
|
||||
#include <QtGui/QStatusBar>
|
||||
#include <QtGui/QTabWidget>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue