diff --git a/samplebrain/interface/samplebrain.ui b/samplebrain/interface/samplebrain.ui
index 6a493a4..52ca655 100644
--- a/samplebrain/interface/samplebrain.ui
+++ b/samplebrain/interface/samplebrain.ui
@@ -836,6 +836,13 @@
+ -
+
+
+ 99
+
+
+
-
@@ -850,9 +857,12 @@
-
-
-
- 99
+
+
+
+
+
+ :/images/images/at.png
@@ -1427,13 +1437,13 @@
- pushButtonStop
+ pushButtonStopRecord
released()
MainWindow
stop_record()
- 144
+ 328
543
diff --git a/samplebrain/qt/MainWindow.cpp b/samplebrain/qt/MainWindow.cpp
index 9857ca1..de745d9 100644
--- a/samplebrain/qt/MainWindow.cpp
+++ b/samplebrain/qt/MainWindow.cpp
@@ -1,3 +1,19 @@
+// Copyright (C) 2015 Dave Griffiths
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
#include
#include
@@ -5,7 +21,8 @@
using namespace std;
-MainWindow::MainWindow()
+MainWindow::MainWindow() :
+ m_last_file(".")
{
m_Ui.setupUi(this);
setUnifiedTitleAndToolBarOnMac(true);
diff --git a/samplebrain/qt/MainWindow.h b/samplebrain/qt/MainWindow.h
index 9ce2185..bc59aab 100644
--- a/samplebrain/qt/MainWindow.h
+++ b/samplebrain/qt/MainWindow.h
@@ -1,3 +1,19 @@
+// Copyright (C) 2015 Foam Kernow
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
#include
#include "generated/ui_samplebrain.h"
@@ -33,13 +49,13 @@ private slots:
void volume_slot(int s) { lo_send(m_audio_address,"/volume","f",s/100.0f); }
void run_slot() {}
void load_target() {
- QString s=QFileDialog::getOpenFileName(
+ m_last_file=QFileDialog::getOpenFileName(
this,
QString("Select an wav file"),
- ".",
+ m_last_file,
QString("Sounds (*.wav)"));
- lo_send(m_process_address,"/load_target","s",s.toStdString().c_str());
+ lo_send(m_process_address,"/load_target","s",m_last_file.toStdString().c_str());
}
void target_block_size(int s) { lo_send(m_process_address,"/target_block_size","i",s); }
void target_block_overlap(double s) { lo_send(m_process_address,"/target_overlap","f",s); }
@@ -49,15 +65,15 @@ private slots:
void fft_spectrum_size(int) {}
void generate() { lo_send(m_process_address,"/generate_brain",""); }
void load_sound() {
- QString s=QFileDialog::getOpenFileName(
+ m_last_file=QFileDialog::getOpenFileName(
this,
QString("Select an wav file"),
- ".",
+ m_last_file,
QString("Sounds (*.wav)"));
- lo_send(m_process_address,"/load_sample","s",s.toStdString().c_str());
+ lo_send(m_process_address,"/load_sample","s",m_last_file.toStdString().c_str());
- m_Ui.listWidgetSounds->addItem(s);
+ m_Ui.listWidgetSounds->addItem(m_last_file);
}
void delete_sound() {
QList itemList = m_Ui.listWidgetSounds->selectedItems();
@@ -94,12 +110,12 @@ private slots:
void record() {
if (m_save_wav=="") {
- QString s=QFileDialog::getSaveFileName(
+ m_last_file=QFileDialog::getSaveFileName(
this,
QString("Select an wav file"),
- ".",
+ m_last_file,
QString("Sounds (*.wav)"));
- m_save_wav = s.toStdString();
+ m_save_wav = m_last_file.toStdString();
// chop off .wav
size_t pos = m_save_wav.find_last_of(".");
if (pos!=string::npos) {
@@ -109,18 +125,19 @@ private slots:
}
char fn[1024];
- snprintf(fn,1024,"%s-%i.wav",m_save_wav.c_str(),m_record_id);
- lo_send(m_process_address,"/record","s",fn);
+ snprintf(fn,1024,"%s-%i",m_save_wav.c_str(),m_record_id);
+ lo_send(m_audio_address,"/record","s",fn);
cerr<
@@ -32,7 +48,8 @@ void audio_thread::run_audio(void* c, unsigned int frames) {
audio_thread *at = (audio_thread*)c;
at->m_audio_device->left_out.zero();
at->process(at->m_audio_device->left_out,
- at->m_audio_device->right_out);
+ at->m_audio_device->right_out);
+ at->m_audio_device->maybe_record();
}
void audio_thread::process(sample &s, sample &s2) {
@@ -68,6 +85,14 @@ void audio_thread::process(sample &s, sample &s2) {
if (name=="/volume") {
m_renderer->set_volume(cmd.get_float(0)*10);
}
+ if (name=="/record") {
+ m_renderer->set_playing(true);
+ m_audio_device->start_recording(cmd.get_string(0));
+ }
+ if (name=="/stop") {
+ m_audio_device->stop_recording();
+ m_renderer->set_playing(false);
+ }
}
s.zero();
diff --git a/samplebrain/qt/audio_thread.h b/samplebrain/qt/audio_thread.h
index 59b3b74..42367b9 100644
--- a/samplebrain/qt/audio_thread.h
+++ b/samplebrain/qt/audio_thread.h
@@ -1,3 +1,19 @@
+// Copyright (C) 2015 Dave Griffiths
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
#include "jellyfish/fluxa/OSC_server.h"
#include "process_thread.h"
#include "renderer.h"
diff --git a/samplebrain/qt/generated/ui_samplebrain.h b/samplebrain/qt/generated/ui_samplebrain.h
index 665edfb..3344aba 100644
--- a/samplebrain/qt/generated/ui_samplebrain.h
+++ b/samplebrain/qt/generated/ui_samplebrain.h
@@ -1,14 +1,14 @@
/********************************************************************************
-** Form generated from reading UI file 'samplebrainMg4993.ui'
+** Form generated from reading UI file 'samplebrainB32443.ui'
**
-** Created: Sun Jul 19 11:35:24 2015
+** Created: Tue Jul 21 14:56:57 2015
** by: Qt User Interface Compiler version 4.8.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
-#ifndef SAMPLEBRAINMG4993_H
-#define SAMPLEBRAINMG4993_H
+#ifndef SAMPLEBRAINB32443_H
+#define SAMPLEBRAINB32443_H
#include
#include
@@ -128,8 +128,9 @@ public:
QPushButton *pushButtonStop;
QPushButton *pushButtonRecord;
QPushButton *pushButtonStopRecord;
- QSpacerItem *horizontalSpacer;
QDial *dialVolume;
+ QSpacerItem *horizontalSpacer;
+ QLabel *label_13;
QStatusBar *statusbar;
void setupUi(QMainWindow *MainWindow)
@@ -645,16 +646,22 @@ public:
horizontalLayout_12->addWidget(pushButtonStopRecord);
- horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
-
- horizontalLayout_12->addItem(horizontalSpacer);
-
dialVolume = new QDial(centralwidget);
dialVolume->setObjectName(QString::fromUtf8("dialVolume"));
dialVolume->setValue(99);
horizontalLayout_12->addWidget(dialVolume);
+ horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+
+ horizontalLayout_12->addItem(horizontalSpacer);
+
+ label_13 = new QLabel(centralwidget);
+ label_13->setObjectName(QString::fromUtf8("label_13"));
+ label_13->setPixmap(QPixmap(QString::fromUtf8(":/images/images/at.png")));
+
+ horizontalLayout_12->addWidget(label_13);
+
verticalLayout_7->addLayout(horizontalLayout_12);
@@ -699,7 +706,7 @@ public:
QObject::connect(radioButton_hannTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_hann(bool)));
QObject::connect(radioButton_rectangleTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_rectangle(bool)));
QObject::connect(sliderRatio, SIGNAL(valueChanged(int)), MainWindow, SLOT(ratio_slot(int)));
- QObject::connect(pushButtonStop, SIGNAL(released()), MainWindow, SLOT(stop_record()));
+ QObject::connect(pushButtonStopRecord, SIGNAL(released()), MainWindow, SLOT(stop_record()));
QObject::connect(pushButtonRecord, SIGNAL(released()), MainWindow, SLOT(record()));
tabWidget->setCurrentIndex(0);
@@ -760,6 +767,7 @@ public:
pushButtonStop->setText(QString());
pushButtonRecord->setText(QString());
pushButtonStopRecord->setText(QString());
+ label_13->setText(QString());
} // retranslateUi
};
@@ -770,4 +778,4 @@ namespace Ui {
QT_END_NAMESPACE
-#endif // SAMPLEBRAINMG4993_H
+#endif // SAMPLEBRAINB32443_H
diff --git a/samplebrain/qt/process_thread.cpp b/samplebrain/qt/process_thread.cpp
index ae3b3fc..15db114 100644
--- a/samplebrain/qt/process_thread.cpp
+++ b/samplebrain/qt/process_thread.cpp
@@ -1,3 +1,19 @@
+// Copyright (C) 2015 Dave Griffiths
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
#include "process_thread.h"
#include
#include
diff --git a/samplebrain/qt/process_thread.h b/samplebrain/qt/process_thread.h
index ae479a8..9df8a0f 100644
--- a/samplebrain/qt/process_thread.h
+++ b/samplebrain/qt/process_thread.h
@@ -1,3 +1,19 @@
+// Copyright (C) 2015 Dave Griffiths
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
#include "jellyfish/fluxa/OSC_server.h"
#include "brain.h"
#include
diff --git a/samplebrain/qt/qtmain.cpp b/samplebrain/qt/qtmain.cpp
index a2b0da7..abffd6b 100644
--- a/samplebrain/qt/qtmain.cpp
+++ b/samplebrain/qt/qtmain.cpp
@@ -1,3 +1,19 @@
+// Copyright (C) 2015 Dave Griffiths
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
#include
#include
#include
diff --git a/samplebrain/src/block.cpp b/samplebrain/src/block.cpp
index 88a97dc..005a990 100644
--- a/samplebrain/src/block.cpp
+++ b/samplebrain/src/block.cpp
@@ -1,3 +1,19 @@
+// Copyright (C) 2015 Foam Kernow
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
#include
#include
diff --git a/samplebrain/src/block.h b/samplebrain/src/block.h
index 05b0f5b..b74d58f 100644
--- a/samplebrain/src/block.h
+++ b/samplebrain/src/block.h
@@ -1,3 +1,19 @@
+// Copyright (C) 2015 Foam Kernow
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
#include
#include "jellyfish/fluxa/sample.h"
#include "jellyfish/core/types.h"
diff --git a/samplebrain/src/brain.cpp b/samplebrain/src/brain.cpp
index 1e503b0..b4c04d1 100644
--- a/samplebrain/src/brain.cpp
+++ b/samplebrain/src/brain.cpp
@@ -1,3 +1,19 @@
+// Copyright (C) 2015 Foam Kernow
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
#include
#include
#include
diff --git a/samplebrain/src/brain.h b/samplebrain/src/brain.h
index 0b3527e..c183f12 100644
--- a/samplebrain/src/brain.h
+++ b/samplebrain/src/brain.h
@@ -1,3 +1,19 @@
+// Copyright (C) 2015 Foam Kernow
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
#include
#include
#include
diff --git a/samplebrain/src/renderer.cpp b/samplebrain/src/renderer.cpp
index 3fb57ce..4a75bfb 100644
--- a/samplebrain/src/renderer.cpp
+++ b/samplebrain/src/renderer.cpp
@@ -1,3 +1,19 @@
+// Copyright (C) 2015 Foam Kernow
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
#include "renderer.h"
#include
diff --git a/samplebrain/src/renderer.h b/samplebrain/src/renderer.h
index 15a0a68..8b003df 100644
--- a/samplebrain/src/renderer.h
+++ b/samplebrain/src/renderer.h
@@ -1,3 +1,19 @@
+// Copyright (C) 2015 Foam Kernow
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
#include
#include
#include "brain.h"
diff --git a/samplebrain/src/window.cpp b/samplebrain/src/window.cpp
index 45c86ef..6243c38 100644
--- a/samplebrain/src/window.cpp
+++ b/samplebrain/src/window.cpp
@@ -1,3 +1,19 @@
+// Copyright (C) 2015 Foam Kernow
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
#include "window.h"
#include
#include
diff --git a/samplebrain/src/window.h b/samplebrain/src/window.h
index 6c25e76..e60d3ab 100644
--- a/samplebrain/src/window.h
+++ b/samplebrain/src/window.h
@@ -1,3 +1,19 @@
+// Copyright (C) 2015 Foam Kernow
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
#include
#include
#include "jellyfish/fluxa/sample.h"