Compare commits
No commits in common. "main" and "0.18_release" have entirely different histories.
main
...
0.18_relea
|
|
@ -1,7 +0,0 @@
|
||||||
*.rej
|
|
||||||
*.orig
|
|
||||||
.DS_Store
|
|
||||||
*.ini
|
|
||||||
build
|
|
||||||
*.*~
|
|
||||||
*.o
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
build-ubuntu:
|
|
||||||
stage: build
|
|
||||||
image: ubuntu:22.04
|
|
||||||
script:
|
|
||||||
- apt-get update
|
|
||||||
- apt-get install -y git cmake g++ freeglut3-dev qtbase5-dev qt5-qmake qtbase5-dev-tools
|
|
||||||
- mkdir -p build
|
|
||||||
- cd build
|
|
||||||
- cmake ..
|
|
||||||
- cmake --build . --target samplebrain
|
|
||||||
|
|
||||||
build-win64:
|
|
||||||
tags:
|
|
||||||
- "windows"
|
|
||||||
before_script:
|
|
||||||
- choco install -y cmake python qt5-default
|
|
||||||
- $env:Path += ';C:\Program Files\CMake\bin'
|
|
||||||
stage: build
|
|
||||||
script:
|
|
||||||
- set CMAKE_PREFIX_PATH=C:\Qt\5.15.2\mingw81_64
|
|
||||||
- mkdir build
|
|
||||||
- cd build
|
|
||||||
- cmake ..
|
|
||||||
- cmake --build . --target samplebrain
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 3.16)
|
|
||||||
project(samplebrain VERSION 1.0 LANGUAGES C CXX)
|
|
||||||
|
|
||||||
include(Dependencies.cmake)
|
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
||||||
|
|
||||||
# Set up AUTOMOC and some sensible defaults for runtime execution
|
|
||||||
# When using Qt 6.3, you can replace the code block below with
|
|
||||||
# qt_standard_project_setup()
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
set(CMAKE_AUTOUIC ON)
|
|
||||||
set(CMAKE_AUTORCC ON)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core)
|
|
||||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui Widgets)
|
|
||||||
find_package(OpenMP)
|
|
||||||
|
|
||||||
add_executable(samplebrain WIN32 MACOSX_BUNDLE
|
|
||||||
app/MainWindow.cpp app/MainWindow.h
|
|
||||||
app/SettingsDialog.cpp app/SettingsDialog.h
|
|
||||||
app/audio_thread.cpp
|
|
||||||
app/feedback.cpp
|
|
||||||
app/process_thread.cpp
|
|
||||||
app/qtmain.cpp
|
|
||||||
app/samplebrain.qrc
|
|
||||||
app/sound_items.cpp
|
|
||||||
brain/src/aquila/filter/MelFilter.cpp
|
|
||||||
brain/src/aquila/filter/MelFilterBank.cpp
|
|
||||||
brain/src/aquila/transform/Dct.cpp
|
|
||||||
brain/src/block.cpp
|
|
||||||
brain/src/block_stream.cpp
|
|
||||||
brain/src/brain.cpp
|
|
||||||
brain/src/fft.cpp
|
|
||||||
brain/src/mfcc.cpp
|
|
||||||
brain/src/renderer.cpp
|
|
||||||
brain/src/search_params.cpp
|
|
||||||
brain/src/spiralcore/OSC_server.cpp
|
|
||||||
brain/src/spiralcore/allocator.cpp
|
|
||||||
brain/src/spiralcore/audio.cpp
|
|
||||||
brain/src/spiralcore/command_ring_buffer.cpp
|
|
||||||
brain/src/spiralcore/portaudio_client.cpp
|
|
||||||
brain/src/spiralcore/ring_buffer.cpp
|
|
||||||
brain/src/spiralcore/sample.cpp
|
|
||||||
brain/src/spiralcore/stream.cpp
|
|
||||||
brain/src/status.cpp
|
|
||||||
brain/src/window.cpp
|
|
||||||
app/gui/samplebrain.ui
|
|
||||||
app/gui/settings.ui
|
|
||||||
)
|
|
||||||
target_include_directories(samplebrain PRIVATE
|
|
||||||
.
|
|
||||||
brain/src
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(samplebrain PRIVATE
|
|
||||||
Qt5::Core
|
|
||||||
Qt5::Gui
|
|
||||||
Qt5::Widgets
|
|
||||||
fftw3
|
|
||||||
lo_shared
|
|
||||||
portaudio
|
|
||||||
sndfile
|
|
||||||
)
|
|
||||||
|
|
||||||
if(OpenMP_CXX_FOUND)
|
|
||||||
target_link_libraries(samplebrain PUBLIC OpenMP::OpenMP_CXX)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
install(TARGETS samplebrain
|
|
||||||
BUNDLE DESTINATION .
|
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Consider using qt_generate_deploy_app_script() for app deployment if
|
|
||||||
# the project can use Qt 6.3. In that case rerun qmake2cmake with
|
|
||||||
# --min-qt-version=6.3.
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
################################################################################
|
|
||||||
# FetchContent
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
include(FetchContent)
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# fftw3
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
|
||||||
fftw3
|
|
||||||
URL http://fftw.org/fftw-3.3.10.tar.gz
|
|
||||||
URL_HASH MD5=8ccbf6a5ea78a16dbc3e1306e234cc5c)
|
|
||||||
FetchContent_MakeAvailable(fftw3)
|
|
||||||
|
|
||||||
include_directories(${fftw3_SOURCE_DIR}/api)
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# liblo
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
|
||||||
liblo
|
|
||||||
URL http://downloads.sourceforge.net/liblo/liblo-0.31.tar.gz
|
|
||||||
URL_HASH MD5=14378c1e74c58e777fbb4fcf33ac5315)
|
|
||||||
FetchContent_MakeAvailable(liblo)
|
|
||||||
|
|
||||||
add_subdirectory(${liblo_SOURCE_DIR}/cmake)
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# PortAudio
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
|
||||||
portaudio
|
|
||||||
URL http://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz
|
|
||||||
URL_HASH MD5=ad319249932c6794b551d954b8844402)
|
|
||||||
FetchContent_MakeAvailable(portaudio)
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# libsndfile
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
|
||||||
libsndfile
|
|
||||||
GIT_REPOSITORY https://github.com/libsndfile/libsndfile
|
|
||||||
GIT_TAG 1.1.0)
|
|
||||||
FetchContent_MakeAvailable(libsndfile)
|
|
||||||
108
README.md
108
README.md
|
|
@ -5,7 +5,7 @@ A custom sample mashing app designed by Aphex Twin.
|
||||||
Samplebrain chops samples up into a 'brain' of interconnected small
|
Samplebrain chops samples up into a 'brain' of interconnected small
|
||||||
sections called blocks which are connected into a network by
|
sections called blocks which are connected into a network by
|
||||||
similarity. It processes a target sample, chopping it up into blocks
|
similarity. It processes a target sample, chopping it up into blocks
|
||||||
in the same way, and tries to match each block with one in its brain
|
in the same way, and tries to match each block with one in it's brain
|
||||||
to play in realtime.
|
to play in realtime.
|
||||||
|
|
||||||
This allows you to interpret a sound with a different one. As we
|
This allows you to interpret a sound with a different one. As we
|
||||||
|
|
@ -14,62 +14,41 @@ tweakable parameters until it became slightly out of control.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
# How do I use this thing?
|
Quick start:
|
||||||
|
|
||||||
1. Load a bunch of short wav files into the brain
|
1. Load a bunch of samples into the brain
|
||||||
2. Click (re)generate brain
|
2. Click (re)generate brain
|
||||||
3. Load a short loop sample into the target
|
3. Load a loop sample into the target
|
||||||
4. Click (re)generate blocks
|
4. Click (re)generate target
|
||||||
5. Press play
|
5. Press play
|
||||||
6. Tweak brain
|
6. Tweak brain
|
||||||
|
|
||||||
Larger wav files like whole tracks can be used, but take a long time
|
The default block size (3000) is really high to prevent CPU glitches -
|
||||||
to process, after which they can be saved as "brain" files and
|
500 to 1000 is a better range.
|
||||||
instantly reloaded.
|
|
||||||
|
|
||||||
Check the [Manual](docs/manual.md) here for the details on all the
|
# [Demo brain session](https://static.thentrythis.org/samplebrain/demo.samplebrain)
|
||||||
parameters and try out the [demo brain session](https://static.thentrythis.org/samplebrain/demo.samplebrain).
|
|
||||||
Load the demo using "load session" not "load brain" (sessions contain
|
|
||||||
both the target and brain samples). The original samples used to
|
|
||||||
create the demo session [can be found here for
|
|
||||||
testing](https://static.thentrythis.org/samplebrain/samples/).
|
|
||||||
|
|
||||||
# Community
|
Load this file using "load session" not "load brain" (sessions contain
|
||||||
|
both the target and brain samples).
|
||||||
|
|
||||||
* https://www.reddit.com/r/samplebrain/
|
# [Manual](docs/manual.md)
|
||||||
|
|
||||||
# Download
|
Full description of all the parameters and a bit of the thinking
|
||||||
|
behind it.
|
||||||
|
|
||||||
As this is experimental non-commercial software (only originally
|
# Binaries
|
||||||
written to run on a couple of computers!) you will have to bear with
|
|
||||||
us as we gradually stabilise things based on your feedback. There
|
|
||||||
might currently be problems running it on 64bit Windows.
|
|
||||||
|
|
||||||
* **Windows**: [samplebrain_0.18.5_win.zip](https://static.thentrythis.org/samplebrain/samplebrain_0.18.5_win.zip)
|
* **Windows**: [samplebrain_0.18_win.zip](https://static.thentrythis.org/samplebrain/samplebrain_0.18_win.zip)
|
||||||
* **Mac (intel/m1)**: [samplebrain_0.18.5_macintel.zip](https://static.thentrythis.org/samplebrain/samplebrain_0.18.5_macintel.app.zip)
|
* **Mac (intel)**: [samplebrain_0.18_macintel.zip](https://static.thentrythis.org/samplebrain/samplebrain_0.18_macintel.zip)
|
||||||
|
* **Mac (m1)**: [samplebrain_0.18_m1.dmg](https://static.thentrythis.org/samplebrain/samplebrain_0.18_m1.dmg) (thank you to [Nik Gaffney](http://fo.am) for building)
|
||||||
Changes in 0.18.5 (relased 28/10/22):
|
|
||||||
|
|
||||||
* Target sound filename shown (and tells you if you don't have one)
|
|
||||||
* More soundfile formats supported (aiff,aifc,au,snd,fasttracker xi,flac)
|
|
||||||
* New configurable OSC ports in settings
|
|
||||||
* Warning boxes if the OSC network connection fails
|
|
||||||
* File path memory per-dialog rather than global
|
|
||||||
|
|
||||||
For old versions see the [changelog](changelog.md)
|
|
||||||
|
|
||||||
Mac note: As this software is not on the apple store, to run the
|
Mac note: As this software is not on the apple store, to run the
|
||||||
binary you need to tell your mac it's ok: Go to System Preferences >
|
binary you need to tell your mac it's ok: Go to System Preferences >
|
||||||
Security & Privacy > General. At the bottom of the window, select
|
Security & Privacy > General. At the bottom of the window, select
|
||||||
"Allow apps to be downloaded from Anywhere".
|
"Allow apps to be downloaded from Anywhere".
|
||||||
|
|
||||||
Thank you to [Nik Gaffney](http://fo.am) for help with the Apple
|
**Linux install (Ubuntu)**
|
||||||
builds.
|
|
||||||
|
|
||||||
# Linux install
|
|
||||||
<a href='https://flathub.org/apps/details/org.thentrythis.Samplebrain'><img width='200' alt='Download on Flathub' src='https://flathub.org/assets/badges/flathub-badge-en.png'/></a>
|
|
||||||
|
|
||||||
#### Ubuntu
|
|
||||||
$ sudo add-apt-repository ppa:thentrythis/samplebrain
|
$ sudo add-apt-repository ppa:thentrythis/samplebrain
|
||||||
$ sudo apt update
|
$ sudo apt update
|
||||||
$ sudo apt install samplebrain
|
$ sudo apt install samplebrain
|
||||||
|
|
@ -78,13 +57,52 @@ If you'd like the right font, optionally:
|
||||||
|
|
||||||
$ sudo apt install ttf-mscorefonts-installer
|
$ sudo apt install ttf-mscorefonts-installer
|
||||||
|
|
||||||
# [Building from source](building.md)
|
# Building from source
|
||||||
|
|
||||||
|
Install libraries for the sample engine (use brew on mac, MinGW on win):
|
||||||
|
|
||||||
|
$ sudo apt install libsndfile1-dev portaudio19-dev liblo-dev libfftw3-dev
|
||||||
|
|
||||||
|
Install dependancies for the interface:
|
||||||
|
|
||||||
|
$ sudo apt install build-essential qtcreator qt5-default
|
||||||
|
|
||||||
|
Build & run it:
|
||||||
|
|
||||||
|
$ cd app
|
||||||
|
$ qmake
|
||||||
|
$ make
|
||||||
|
$ sudo make install
|
||||||
|
$ samplebrain
|
||||||
|
|
||||||
|
# Mac build additions
|
||||||
|
|
||||||
|
To make a mac app bundle:
|
||||||
|
|
||||||
|
* Run `macdeployqt` to copy all dependancies inside the app.
|
||||||
|
* Copy desktop/samplebrain.icns (the icon) to the Resources directory in the bundle.
|
||||||
|
* Edit Info.plist to add samplebrain.icns to CFBundleIconFile.
|
||||||
|
|
||||||
|
## What's here
|
||||||
|
|
||||||
|
1. brain:
|
||||||
|
* samplebrain engine code
|
||||||
|
2. app:
|
||||||
|
* code to build the Qt GUI app
|
||||||
|
3. gui:
|
||||||
|
* qt designer project files
|
||||||
|
4. desktop:
|
||||||
|
* various icon files etc
|
||||||
|
4. cooking:
|
||||||
|
* some sketches and ideas
|
||||||
|
* proof of concept written in python
|
||||||
|
* brief initial (abandoned) attempt at clojure version
|
||||||
|
|
||||||
MFCC algo courtesy of the Aquila library by Zbigniew Siciarz MIT/X11
|
MFCC algo courtesy of the Aquila library by Zbigniew Siciarz MIT/X11
|
||||||
licence 2007-2014 (see brain/src/aquila/LICENCE). This program is free
|
licence 2007-2014 (see brain/src/aquila/LICENCE)
|
||||||
software licenced under GNU General Public License version 2 (see
|
|
||||||
LICENCE). Written by [Dave Griffiths at Then Try This](http://thentrythis.org).
|
|
||||||
|
|
||||||
## Links
|
This program is free software licenced under GNU General Public
|
||||||
|
License version 2 (see LICENCE).
|
||||||
|
|
||||||
|
Written by [Dave Griffiths at Then Try This](http://thentrythis.org).
|
||||||
|
|
||||||
To find related tech like [CataRT](https://ircam-ismm.github.io/max-msp/catart.html), [bbcut2](https://composerprogrammer.com/bbcut2.html), [eargram](https://sites.google.com/site/eargram/) and [sCrAmBlEd?HaCkZ!](https://www.youtube.com/watch?v=eRlhKaxcKpA) search up [granular synthesis](http://granularsynthesis.com/guide.php), [concatenative synthesis](https://hal.archives-ouvertes.fr/hal-01161337), [neural audio synthesis](https://github.com/acids-ircam/RAVE), [sinewave speech](http://www.lifesci.sussex.ac.uk/home/Chris_Darwin/SWS/), automated breakbeat cutting, audio mosaicing and plunderphonics/plundermatics.
|
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,6 @@
|
||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef MAIN_WINDOW
|
|
||||||
#define MAIN_WINDOW
|
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
@ -27,16 +24,9 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
MainWindow::MainWindow(const string &port, const string &audio_port, const string &process_port, QSettings *settings) :
|
MainWindow::MainWindow() :
|
||||||
m_last_sound_file("."),
|
m_last_file("."),
|
||||||
m_last_target_file("."),
|
m_feedback("8890")
|
||||||
m_last_brain_file("."),
|
|
||||||
m_last_session_file("."),
|
|
||||||
m_last_recording_file("."),
|
|
||||||
m_feedback(port),
|
|
||||||
m_audio_port(audio_port),
|
|
||||||
m_process_port(process_port),
|
|
||||||
m_format_string("Microsoft WAV (*.wav);;SGI/Apple AIFF (*.aiff);;SGI/Apple AIFC (*.aifc);;Sun/DEC/NeXT AU (*.au);;Sun/DEC/NeXT SND (*.snd);;Fasttracker 2 XI (*.xi);;Free Lossless Audio Codec FLAC (*.flac);;All files (*.*)")
|
|
||||||
{
|
{
|
||||||
m_sound_item_enable_mapper = new QSignalMapper(this);
|
m_sound_item_enable_mapper = new QSignalMapper(this);
|
||||||
m_sound_item_delete_mapper = new QSignalMapper(this);
|
m_sound_item_delete_mapper = new QSignalMapper(this);
|
||||||
|
|
@ -50,14 +40,14 @@ MainWindow::MainWindow(const string &port, const string &audio_port, const strin
|
||||||
setUnifiedTitleAndToolBarOnMac(true);
|
setUnifiedTitleAndToolBarOnMac(true);
|
||||||
|
|
||||||
m_Ui.verticalLayout_5->setSpacing(0);
|
m_Ui.verticalLayout_5->setSpacing(0);
|
||||||
|
m_Ui.verticalLayout_5->setMargin(0);
|
||||||
m_Ui.verticalLayout_5->setContentsMargins(0,0,0,0);
|
m_Ui.verticalLayout_5->setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
m_Ui.brain_contents->setAlignment(Qt::AlignTop);
|
m_Ui.brain_contents->setAlignment(Qt::AlignTop);
|
||||||
m_Ui.brain_contents->setSpacing(0);
|
m_Ui.brain_contents->setSpacing(0);
|
||||||
|
m_Ui.brain_contents->setMargin(0);
|
||||||
m_Ui.brain_contents->setContentsMargins(0,0,0,0);
|
m_Ui.brain_contents->setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
m_settings_dialog = new SettingsDialog(this,settings);
|
|
||||||
|
|
||||||
// add default local dest
|
// add default local dest
|
||||||
// turn on first one
|
// turn on first one
|
||||||
|
|
||||||
|
|
@ -66,8 +56,8 @@ MainWindow::MainWindow(const string &port, const string &audio_port, const strin
|
||||||
for (int i=0; i<10; i++) {
|
for (int i=0; i<10; i++) {
|
||||||
osc_destination d;
|
osc_destination d;
|
||||||
d.m_id=i;
|
d.m_id=i;
|
||||||
d.m_audio_address = lo_address_new_from_url(string("osc.udp://localhost:"+m_audio_port).c_str());
|
d.m_audio_address = lo_address_new_from_url("osc.udp://localhost:8888");
|
||||||
d.m_process_address = lo_address_new_from_url(string("osc.udp://localhost:"+m_process_port).c_str());
|
d.m_process_address = lo_address_new_from_url("osc.udp://localhost:8889");
|
||||||
if (i==0) d.m_enabled=true;
|
if (i==0) d.m_enabled=true;
|
||||||
else d.m_enabled=false;
|
else d.m_enabled=false;
|
||||||
add_gui_address(d,enable_mapper);
|
add_gui_address(d,enable_mapper);
|
||||||
|
|
@ -161,12 +151,6 @@ void MainWindow::init_from_session(const string &filename) {
|
||||||
m_Ui.spinBoxSlideError->setValue(r.get_slide_error());
|
m_Ui.spinBoxSlideError->setValue(r.get_slide_error());
|
||||||
|
|
||||||
// target
|
// target
|
||||||
if (t.get_samples().size()>0) {
|
|
||||||
// extract target filename from brain sample
|
|
||||||
string fn = t.get_samples().begin()->m_filename;
|
|
||||||
m_Ui.labelTargetSound->setText("loaded: "+QFileInfo(QString::fromStdString(fn)).fileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Ui.spinBoxBlockSizeTarget->setValue(t.get_block_size());
|
m_Ui.spinBoxBlockSizeTarget->setValue(t.get_block_size());
|
||||||
m_Ui.doubleSpinBoxBlockOverlapTarget->setValue(t.get_overlap()/(float)t.get_block_size());
|
m_Ui.doubleSpinBoxBlockOverlapTarget->setValue(t.get_overlap()/(float)t.get_block_size());
|
||||||
|
|
||||||
|
|
@ -201,5 +185,3 @@ void MainWindow::init_from_session(const string &filename) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
235
app/MainWindow.h
235
app/MainWindow.h
|
|
@ -18,9 +18,7 @@
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMessageBox>
|
#include "generated/ui_samplebrain.h"
|
||||||
#include "gui/ui_samplebrain.h"
|
|
||||||
#include "SettingsDialog.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <lo/lo.h>
|
#include <lo/lo.h>
|
||||||
|
|
@ -28,86 +26,17 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include "feedback.h"
|
#include "feedback.h"
|
||||||
#include "sound_items.h"
|
#include "sound_items.h"
|
||||||
#include "audio_thread.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace spiralcore;
|
using namespace spiralcore;
|
||||||
|
|
||||||
class QSettings;
|
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(const string &port, const string &audio_port, const string &process_port, QSettings *settings);
|
MainWindow();
|
||||||
|
|
||||||
void message(const string &msg) {
|
|
||||||
QMessageBox::information(this,"problem",msg.c_str(), QMessageBox::Ok);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ok() {
|
|
||||||
return m_feedback.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
// all this to work around liblo's use of varargs...
|
|
||||||
void send_audio_osc(const char *name, const char *types) {
|
|
||||||
for (auto dest:m_destinations) {
|
|
||||||
if (dest.m_enabled) {
|
|
||||||
lo_send(dest.m_audio_address,name,types);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void send_audio_osc(const char *name, const char *types, T val) {
|
|
||||||
for (auto dest:m_destinations) {
|
|
||||||
if (dest.m_enabled) {
|
|
||||||
lo_send(dest.m_audio_address,name,types,val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void send_process_osc(const char *name, const char *types) {
|
|
||||||
for (auto dest:m_destinations) {
|
|
||||||
if (dest.m_enabled) {
|
|
||||||
lo_send(dest.m_process_address,name,types);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
void send_process_osc(const char *name, const char *types, T val) {
|
|
||||||
for (auto dest:m_destinations) {
|
|
||||||
if (dest.m_enabled) {
|
|
||||||
lo_send(dest.m_process_address,name,types,val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_audio_thread(audio_thread *at) {
|
|
||||||
m_audio_thread=at;
|
|
||||||
m_audio_thread->start_audio();
|
|
||||||
|
|
||||||
for (auto &d:m_audio_thread->m_audio_device->m_client.m_devices) {
|
|
||||||
if (d.id==0) {
|
|
||||||
m_settings_dialog->m_Ui.deviceComboBox->clear();
|
|
||||||
}
|
|
||||||
m_settings_dialog->m_Ui.deviceComboBox->addItem(d.name.c_str());
|
|
||||||
|
|
||||||
if (d.default_output==1) {
|
|
||||||
m_settings_dialog->m_device=d.name;
|
|
||||||
m_settings_dialog->m_Ui.deviceComboBox->setCurrentText(d.name.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
m_settings_dialog->m_Ui.messagesLabel->setText(m_audio_thread->m_audio_device->m_client.m_status.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
audio_thread *get_audio_thread() {
|
|
||||||
return m_audio_thread;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
@ -206,15 +135,13 @@ private slots:
|
||||||
|
|
||||||
void run_slot() {}
|
void run_slot() {}
|
||||||
void load_target() {
|
void load_target() {
|
||||||
QString path=QFileDialog::getOpenFileName(this,
|
m_last_file=QFileDialog::getOpenFileName(
|
||||||
QString("Select an audio file"),
|
this,
|
||||||
m_last_target_file,
|
QString("Select an wav file"),
|
||||||
m_format_string);
|
m_last_file,
|
||||||
if (m_last_target_file!="") {
|
QString("Sounds (*.wav)"));
|
||||||
m_last_target_file=path;
|
|
||||||
m_Ui.labelTargetSound->setText("loaded: "+QFileInfo(path).fileName());
|
send_process_osc("/load_target","s",m_last_file.toStdString().c_str());
|
||||||
send_process_osc("/load_target","s",m_last_target_file.toStdString().c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void target_block_size(int s) { send_process_osc("/target_block_size","i",s); }
|
void target_block_size(int s) { send_process_osc("/target_block_size","i",s); }
|
||||||
void target_block_overlap(double s) { send_process_osc("/target_overlap","f",s); }
|
void target_block_overlap(double s) { send_process_osc("/target_overlap","f",s); }
|
||||||
|
|
@ -224,31 +151,30 @@ private slots:
|
||||||
void fft_spectrum_size(int) {}
|
void fft_spectrum_size(int) {}
|
||||||
void generate() { send_process_osc("/generate_brain",""); }
|
void generate() { send_process_osc("/generate_brain",""); }
|
||||||
void load_sound() {
|
void load_sound() {
|
||||||
QString path=QFileDialog::getOpenFileName(this,
|
m_last_file=QFileDialog::getOpenFileName(
|
||||||
|
this,
|
||||||
QString("Select a wav file"),
|
QString("Select a wav file"),
|
||||||
m_last_sound_file,
|
m_last_file,
|
||||||
m_format_string);
|
QString("Sounds (*.wav)"));
|
||||||
|
|
||||||
|
send_process_osc("/load_sample","s",m_last_file.toStdString().c_str());
|
||||||
|
|
||||||
|
sound_items::sound_item &si = m_sound_items.add(m_Ui.brain_contents, m_last_file.toStdString(),true);
|
||||||
|
|
||||||
if (path!="") {
|
|
||||||
m_last_sound_file=path;
|
|
||||||
send_process_osc("/load_sample","s",m_last_sound_file.toStdString().c_str());
|
|
||||||
sound_items::sound_item &si = m_sound_items.add(m_Ui.brain_contents, m_last_sound_file.toStdString(),true);
|
|
||||||
QObject::connect(si.m_enable, SIGNAL(clicked()), m_sound_item_enable_mapper, SLOT(map()));
|
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);
|
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()));
|
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);
|
m_sound_item_delete_mapper->setMapping(si.m_del, si.m_id);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void load_sounds() {
|
void load_sounds() {
|
||||||
QString path=QFileDialog::getExistingDirectory(this,
|
m_last_file=QFileDialog::getExistingDirectory(this,
|
||||||
QString("Select a directory of wav files"),
|
QString("Select a directory"),
|
||||||
m_last_directory_file);
|
m_last_file);
|
||||||
|
|
||||||
if (path!="") {
|
|
||||||
m_last_directory_file=path;
|
QDirIterator dirIt(m_last_file,QDirIterator::Subdirectories);
|
||||||
QDirIterator dirIt(m_last_directory_file,QDirIterator::Subdirectories);
|
|
||||||
while (dirIt.hasNext()) {
|
while (dirIt.hasNext()) {
|
||||||
dirIt.next();
|
dirIt.next();
|
||||||
if (QFileInfo(dirIt.filePath()).isFile() &&
|
if (QFileInfo(dirIt.filePath()).isFile() &&
|
||||||
|
|
@ -265,7 +191,6 @@ private slots:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void select_all() {
|
void select_all() {
|
||||||
for (auto &si:m_sound_items.m_sound_items) {
|
for (auto &si:m_sound_items.m_sound_items) {
|
||||||
|
|
@ -319,11 +244,12 @@ private slots:
|
||||||
|
|
||||||
void record() {
|
void record() {
|
||||||
if (m_save_wav=="") {
|
if (m_save_wav=="") {
|
||||||
m_last_recording_file=QFileDialog::getSaveFileName(this,
|
m_last_file=QFileDialog::getSaveFileName(
|
||||||
|
this,
|
||||||
QString("Select a wav file"),
|
QString("Select a wav file"),
|
||||||
m_last_recording_file,
|
m_last_file,
|
||||||
QString("Sounds (*.wav);;All files (*.*)"));
|
QString("Sounds (*.wav)"));
|
||||||
m_save_wav = m_last_recording_file.toStdString();
|
m_save_wav = m_last_file.toStdString();
|
||||||
// chop off .wav
|
// chop off .wav
|
||||||
size_t pos = m_save_wav.find_last_of(".");
|
size_t pos = m_save_wav.find_last_of(".");
|
||||||
if (pos!=string::npos) {
|
if (pos!=string::npos) {
|
||||||
|
|
@ -344,52 +270,47 @@ private slots:
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_brain() {
|
void load_brain() {
|
||||||
QString path=QFileDialog::getOpenFileName(this,
|
m_last_file=QFileDialog::getOpenFileName(
|
||||||
|
this,
|
||||||
QString("Select a brain file"),
|
QString("Select a brain file"),
|
||||||
m_last_brain_file,
|
m_last_file,
|
||||||
QString("Brains (*.brain);;All files (*.*)"));
|
QString("Brains (*.brain)"));
|
||||||
|
|
||||||
if (path!="") {
|
send_process_osc("/load_brain","s",m_last_file.toStdString().c_str());
|
||||||
m_last_brain_file=path;
|
|
||||||
send_process_osc("/load_brain","s",m_last_brain_file.toStdString().c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void save_brain() {
|
void save_brain() {
|
||||||
QString path=QFileDialog::getSaveFileName(this,
|
m_last_file=QFileDialog::getSaveFileName(
|
||||||
|
this,
|
||||||
QString("Select a brain file"),
|
QString("Select a brain file"),
|
||||||
m_last_brain_file,
|
m_last_file,
|
||||||
QString("Brains (*.brain);;All files (*.*)"));
|
QString("Brains (*.brain)"));
|
||||||
if (path!="") {
|
|
||||||
m_last_brain_file=path;
|
send_process_osc("/save_brain","s",m_last_file.toStdString().c_str());
|
||||||
send_process_osc("/save_brain","s",m_last_brain_file.toStdString().c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_session() {
|
void load_session() {
|
||||||
QString path=QFileDialog::getOpenFileName(this,
|
m_last_file=QFileDialog::getOpenFileName(
|
||||||
|
this,
|
||||||
QString("Select a session file"),
|
QString("Select a session file"),
|
||||||
m_last_session_file,
|
m_last_file,
|
||||||
QString("Sessions *.samplebrain (*.samplebrain);;All files (*.*)"));
|
QString("Sessions *.samplebrain (*.samplebrain)"));
|
||||||
if (path!="") {
|
|
||||||
m_last_session_file=path;
|
send_process_osc("/load_session","s",m_last_file.toStdString().c_str());
|
||||||
send_process_osc("/load_session","s",m_last_session_file.toStdString().c_str());
|
init_from_session(m_last_file.toStdString());
|
||||||
init_from_session(m_last_session_file.toStdString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void save_session() {
|
void save_session() {
|
||||||
QString path=QFileDialog::getSaveFileName(this,
|
m_last_file=QFileDialog::getSaveFileName(
|
||||||
|
this,
|
||||||
QString("Select a session file"),
|
QString("Select a session file"),
|
||||||
m_last_session_file,
|
m_last_file,
|
||||||
QString("Sessions *.samplebrain (*.samplebrain)"));
|
QString("Sessions *.samplebrain (*.samplebrain)"));
|
||||||
if (path!="") {
|
|
||||||
m_last_session_file=path;
|
send_process_osc("/save_session","s",m_last_file.toStdString().c_str());
|
||||||
send_process_osc("/save_session","s",m_last_session_file.toStdString().c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_status() {
|
void update_status() {
|
||||||
m_feedback.poll(m_Ui.statusbar,&m_sound_items,m_settings_dialog);
|
m_feedback.poll(m_Ui.statusbar,&m_sound_items);
|
||||||
}
|
}
|
||||||
|
|
||||||
void stereo_mode(bool s) {
|
void stereo_mode(bool s) {
|
||||||
|
|
@ -404,8 +325,8 @@ private slots:
|
||||||
string url = d.m_address->text().toUtf8().constData();
|
string url = d.m_address->text().toUtf8().constData();
|
||||||
lo_address_free(d.m_audio_address);
|
lo_address_free(d.m_audio_address);
|
||||||
lo_address_free(d.m_process_address);
|
lo_address_free(d.m_process_address);
|
||||||
d.m_audio_address = lo_address_new_from_url(string(url+":"+m_audio_port).c_str());
|
d.m_audio_address = lo_address_new_from_url(string(url+":8888").c_str());
|
||||||
d.m_process_address = lo_address_new_from_url(string(url+":"+m_process_port).c_str());
|
d.m_process_address = lo_address_new_from_url(string(url+":8889").c_str());
|
||||||
// start sending messages here
|
// start sending messages here
|
||||||
d.m_enabled=true;
|
d.m_enabled=true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -415,9 +336,6 @@ private slots:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void settings() {
|
|
||||||
m_settings_dialog->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
@ -444,18 +362,48 @@ private:
|
||||||
|
|
||||||
vector<osc_destination> m_destinations;
|
vector<osc_destination> m_destinations;
|
||||||
|
|
||||||
|
// all this to work around liblo's use of varargs...
|
||||||
|
void send_audio_osc(const char *name, const char *types) {
|
||||||
|
for (auto dest:m_destinations) {
|
||||||
|
if (dest.m_enabled) {
|
||||||
|
lo_send(dest.m_audio_address,name,types);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void send_audio_osc(const char *name, const char *types, T val) {
|
||||||
|
for (auto dest:m_destinations) {
|
||||||
|
if (dest.m_enabled) {
|
||||||
|
lo_send(dest.m_audio_address,name,types,val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void send_process_osc(const char *name, const char *types) {
|
||||||
|
for (auto dest:m_destinations) {
|
||||||
|
if (dest.m_enabled) {
|
||||||
|
lo_send(dest.m_process_address,name,types);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void send_process_osc(const char *name, const char *types, T val) {
|
||||||
|
for (auto dest:m_destinations) {
|
||||||
|
if (dest.m_enabled) {
|
||||||
|
lo_send(dest.m_process_address,name,types,val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void init_from_session(const string &filename);
|
void init_from_session(const string &filename);
|
||||||
void add_gui_address(osc_destination &dest,
|
void add_gui_address(osc_destination &dest,
|
||||||
QSignalMapper* enable_mapper);
|
QSignalMapper* enable_mapper);
|
||||||
|
|
||||||
string m_save_wav;
|
string m_save_wav;
|
||||||
QString m_last_sound_file;
|
QString m_last_file;
|
||||||
QString m_last_target_file;
|
|
||||||
QString m_last_directory_file;
|
|
||||||
QString m_last_brain_file;
|
|
||||||
QString m_last_session_file;
|
|
||||||
QString m_last_recording_file;
|
|
||||||
unsigned int m_record_id;
|
unsigned int m_record_id;
|
||||||
Ui_MainWindow m_Ui;
|
Ui_MainWindow m_Ui;
|
||||||
feedback m_feedback;
|
feedback m_feedback;
|
||||||
|
|
@ -463,10 +411,5 @@ private:
|
||||||
QSignalMapper* m_sound_item_delete_mapper;
|
QSignalMapper* m_sound_item_delete_mapper;
|
||||||
sound_items m_sound_items;
|
sound_items m_sound_items;
|
||||||
|
|
||||||
SettingsDialog *m_settings_dialog;
|
|
||||||
audio_thread *m_audio_thread;
|
|
||||||
|
|
||||||
string m_audio_port;
|
|
||||||
string m_process_port;
|
|
||||||
QString m_format_string;
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
// Copyright (C) 2022 Then Try This
|
|
||||||
//
|
|
||||||
// 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 <QtGui>
|
|
||||||
#include <iostream>
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
#include "MainWindow.h"
|
|
||||||
#include "SettingsDialog.h"
|
|
||||||
#include "feedback.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
SettingsDialog::SettingsDialog(MainWindow *parent, QSettings *settings):
|
|
||||||
m_device(""),
|
|
||||||
m_parent(parent),
|
|
||||||
m_buffersize(2048),
|
|
||||||
m_samplerate(44100),
|
|
||||||
m_settings(settings) {
|
|
||||||
m_Ui.setupUi(this);
|
|
||||||
m_Ui.guiOSCLineEdit->setText(settings->value("gui_port").toByteArray().constData());
|
|
||||||
m_Ui.processOSCLineEdit->setText(settings->value("process_port").toByteArray().constData());
|
|
||||||
m_Ui.audioOSCLineEdit->setText(settings->value("audio_port").toByteArray().constData());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsDialog::connect() {
|
|
||||||
audio_thread *at = m_parent->get_audio_thread();
|
|
||||||
at->restart_audio(m_device,m_samplerate,m_buffersize);
|
|
||||||
m_Ui.messagesLabel->setText(at->m_audio_device->m_client.m_status.c_str());
|
|
||||||
}
|
|
||||||
|
|
@ -1,89 +0,0 @@
|
||||||
// Copyright (C) 2022 Then Try This
|
|
||||||
//
|
|
||||||
// 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.
|
|
||||||
|
|
||||||
#ifndef SETTINGS_DIALOG
|
|
||||||
#define SETTINGS_DIALOG
|
|
||||||
|
|
||||||
#include <QtGui>
|
|
||||||
#include <QDialog>
|
|
||||||
#include <QLineEdit>
|
|
||||||
#include <QSettings>
|
|
||||||
#include "gui/ui_settings.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <lo/lo.h>
|
|
||||||
#include <string>
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
class MainWindow;
|
|
||||||
|
|
||||||
class SettingsDialog : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
SettingsDialog(MainWindow *parent, QSettings *settings);
|
|
||||||
|
|
||||||
Ui_SettingsDialog m_Ui;
|
|
||||||
string m_device;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
|
|
||||||
void samplerate(QString str) {
|
|
||||||
try { m_samplerate=stoi(str.toStdString()); }
|
|
||||||
catch(std::exception const & e) {
|
|
||||||
m_samplerate=44100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void output_device(QString v) { m_device=v.toStdString(); }
|
|
||||||
void buffersize(QString str) {
|
|
||||||
try { m_buffersize=stoi(str.toStdString()); }
|
|
||||||
catch(std::exception const & e) {
|
|
||||||
m_buffersize=44100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void accept() { connect(); hide(); }
|
|
||||||
void reject() { hide(); }
|
|
||||||
void apply() { connect(); }
|
|
||||||
|
|
||||||
void gui_port(QString str) {
|
|
||||||
m_settings->setValue("gui_port",str);
|
|
||||||
}
|
|
||||||
|
|
||||||
void process_port(QString str) {
|
|
||||||
m_settings->setValue("process_port",str);
|
|
||||||
}
|
|
||||||
|
|
||||||
void audio_port(QString str) {
|
|
||||||
m_settings->setValue("audio_port",str);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void connect();
|
|
||||||
MainWindow *m_parent;
|
|
||||||
|
|
||||||
unsigned int m_buffersize;
|
|
||||||
unsigned int m_samplerate;
|
|
||||||
|
|
||||||
QSettings *m_settings;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -20,17 +20,15 @@
|
||||||
using namespace spiralcore;
|
using namespace spiralcore;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
audio_thread::audio_thread(const string &port, process_thread &p) :
|
audio_thread::audio_thread(process_thread &p) :
|
||||||
m_audio_device(NULL),
|
m_audio_device(NULL),
|
||||||
m_osc(port),
|
m_osc("8888"),
|
||||||
m_process_thread(p),
|
m_process_thread(p),
|
||||||
m_brain_mutex(p.m_brain_mutex),
|
m_brain_mutex(p.m_brain_mutex),
|
||||||
m_stereo_mode(false),
|
m_stereo_mode(false),
|
||||||
m_mic_mode(false),
|
m_mic_mode(false)
|
||||||
m_bufsize(2048),
|
{
|
||||||
m_samplerate(44100),
|
start_audio();
|
||||||
m_device("") {
|
|
||||||
|
|
||||||
pthread_mutex_lock(m_brain_mutex);
|
pthread_mutex_lock(m_brain_mutex);
|
||||||
m_left_renderer = new renderer(p.m_source,p.m_left_target);
|
m_left_renderer = new renderer(p.m_source,p.m_left_target);
|
||||||
m_right_renderer = new renderer(p.m_source,p.m_right_target);
|
m_right_renderer = new renderer(p.m_source,p.m_right_target);
|
||||||
|
|
@ -50,21 +48,11 @@ audio_thread::~audio_thread() {
|
||||||
|
|
||||||
void audio_thread::start_audio() {
|
void audio_thread::start_audio() {
|
||||||
if (m_audio_device!=NULL) delete m_audio_device;
|
if (m_audio_device!=NULL) delete m_audio_device;
|
||||||
m_audio_device = new audio_device("samplebrain",m_samplerate,m_bufsize);
|
m_audio_device = new audio_device("samplebrain",48000,2048);
|
||||||
|
//m_audio_device = new audio_device("samplebrain",48000,2048*4);
|
||||||
m_audio_device->m_client.set_callback(run_audio, this);
|
m_audio_device->m_client.set_callback(run_audio, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio_thread::restart_audio(const string device, unsigned int samplerate, unsigned int bufsize) {
|
|
||||||
m_samplerate = samplerate;
|
|
||||||
m_bufsize = bufsize;
|
|
||||||
m_device = device;
|
|
||||||
m_audio_device->connect(m_device,
|
|
||||||
"samplebrain",
|
|
||||||
m_samplerate,
|
|
||||||
m_bufsize);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void audio_thread::run_audio(void* c, unsigned int frames) {
|
void audio_thread::run_audio(void* c, unsigned int frames) {
|
||||||
if (state) {
|
if (state) {
|
||||||
audio_thread *at = (audio_thread*)c;
|
audio_thread *at = (audio_thread*)c;
|
||||||
|
|
@ -180,9 +168,7 @@ void audio_thread::process(sample &left_in, sample &right_in, sample &left_out,
|
||||||
m_right_renderer->reset();
|
m_right_renderer->reset();
|
||||||
}
|
}
|
||||||
if (name=="/mic") {
|
if (name=="/mic") {
|
||||||
//m_mic_mode = cmd.get_int(0);
|
m_mic_mode = cmd.get_int(0);
|
||||||
//if (m_mic_mode==1) m_block_stream->start();
|
|
||||||
//else m_block_stream->stop();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,11 @@
|
||||||
|
|
||||||
namespace spiralcore {
|
namespace spiralcore {
|
||||||
|
|
||||||
class audio_thread {
|
class audio_thread {
|
||||||
public:
|
public:
|
||||||
audio_thread(const string &port, process_thread &p);
|
audio_thread(process_thread &p);
|
||||||
~audio_thread();
|
~audio_thread();
|
||||||
|
|
||||||
void start_audio();
|
|
||||||
void restart_audio(const string device, unsigned int samplerate, unsigned int bufsize);
|
|
||||||
bool ok() { return m_osc.ok(); }
|
|
||||||
void process(sample &left_in, sample &right_in, sample &left_out, sample &right_out);
|
void process(sample &left_in, sample &right_in, sample &left_out, sample &right_out);
|
||||||
|
|
||||||
static void run_audio(void* c, unsigned int frames);
|
static void run_audio(void* c, unsigned int frames);
|
||||||
|
|
@ -41,16 +38,14 @@ namespace spiralcore {
|
||||||
renderer *m_right_renderer;
|
renderer *m_right_renderer;
|
||||||
block_stream *m_block_stream;
|
block_stream *m_block_stream;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void start_audio();
|
||||||
|
|
||||||
OSC_server m_osc;
|
OSC_server m_osc;
|
||||||
process_thread &m_process_thread;
|
process_thread &m_process_thread;
|
||||||
pthread_mutex_t* m_brain_mutex;
|
pthread_mutex_t* m_brain_mutex;
|
||||||
bool m_stereo_mode;
|
bool m_stereo_mode;
|
||||||
bool m_mic_mode;
|
bool m_mic_mode;
|
||||||
u32 m_bufsize;
|
};
|
||||||
u32 m_samplerate;
|
|
||||||
string m_device;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
#include "feedback.h"
|
#include "feedback.h"
|
||||||
#include "sound_items.h"
|
#include "sound_items.h"
|
||||||
#include "SettingsDialog.h"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace spiralcore;
|
using namespace spiralcore;
|
||||||
|
|
@ -29,7 +28,7 @@ feedback::feedback(string address) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void feedback::poll(QStatusBar *s, sound_items *sound_items, SettingsDialog *settings) {
|
void feedback::poll(QStatusBar *s, sound_items *sound_items) {
|
||||||
command_ring_buffer::command cmd;
|
command_ring_buffer::command cmd;
|
||||||
|
|
||||||
while (m_osc.get(cmd)) {
|
while (m_osc.get(cmd)) {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
#include "SettingsDialog.h"
|
|
||||||
#include "spiralcore/OSC_server.h"
|
#include "spiralcore/OSC_server.h"
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
@ -28,8 +27,7 @@ class sound_items;
|
||||||
class feedback {
|
class feedback {
|
||||||
public:
|
public:
|
||||||
feedback(std::string address);
|
feedback(std::string address);
|
||||||
void poll(QStatusBar *s, sound_items *sound_items, SettingsDialog *settings);
|
void poll(QStatusBar *s, sound_items *sound_items);
|
||||||
bool ok() { return m_osc.ok(); }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
/********************************************************************************
|
||||||
|
** Form generated from reading UI file 'sampleSy5241.ui'
|
||||||
|
**
|
||||||
|
** Created: Sat Jul 11 10:24:07 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 SAMPLESY5241_H
|
||||||
|
#define SAMPLESY5241_H
|
||||||
|
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
#include <QtGui/QAction>
|
||||||
|
#include <QtGui/QApplication>
|
||||||
|
#include <QtGui/QButtonGroup>
|
||||||
|
#include <QtGui/QCheckBox>
|
||||||
|
#include <QtGui/QHBoxLayout>
|
||||||
|
#include <QtGui/QHeaderView>
|
||||||
|
#include <QtGui/QLabel>
|
||||||
|
#include <QtGui/QPushButton>
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class Ui_FormSample
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QHBoxLayout *horizontalLayout;
|
||||||
|
QCheckBox *checkBox;
|
||||||
|
QLabel *labelSampleName;
|
||||||
|
QLabel *labelSampleInfo;
|
||||||
|
QPushButton *pushButton;
|
||||||
|
|
||||||
|
void setupUi(QWidget *FormSample)
|
||||||
|
{
|
||||||
|
if (FormSample->objectName().isEmpty())
|
||||||
|
FormSample->setObjectName(QString::fromUtf8("FormSample"));
|
||||||
|
FormSample->resize(400, 46);
|
||||||
|
horizontalLayout = new QHBoxLayout(FormSample);
|
||||||
|
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
|
||||||
|
checkBox = new QCheckBox(FormSample);
|
||||||
|
checkBox->setObjectName(QString::fromUtf8("checkBox"));
|
||||||
|
QFont font;
|
||||||
|
font.setFamily(QString::fromUtf8("Comic Sans MS"));
|
||||||
|
font.setBold(true);
|
||||||
|
font.setWeight(75);
|
||||||
|
checkBox->setFont(font);
|
||||||
|
|
||||||
|
horizontalLayout->addWidget(checkBox);
|
||||||
|
|
||||||
|
labelSampleName = new QLabel(FormSample);
|
||||||
|
labelSampleName->setObjectName(QString::fromUtf8("labelSampleName"));
|
||||||
|
labelSampleName->setFont(font);
|
||||||
|
|
||||||
|
horizontalLayout->addWidget(labelSampleName);
|
||||||
|
|
||||||
|
labelSampleInfo = new QLabel(FormSample);
|
||||||
|
labelSampleInfo->setObjectName(QString::fromUtf8("labelSampleInfo"));
|
||||||
|
labelSampleInfo->setFont(font);
|
||||||
|
|
||||||
|
horizontalLayout->addWidget(labelSampleInfo);
|
||||||
|
|
||||||
|
pushButton = new QPushButton(FormSample);
|
||||||
|
pushButton->setObjectName(QString::fromUtf8("pushButton"));
|
||||||
|
pushButton->setFont(font);
|
||||||
|
|
||||||
|
horizontalLayout->addWidget(pushButton);
|
||||||
|
|
||||||
|
|
||||||
|
retranslateUi(FormSample);
|
||||||
|
|
||||||
|
QMetaObject::connectSlotsByName(FormSample);
|
||||||
|
} // setupUi
|
||||||
|
|
||||||
|
void retranslateUi(QWidget *FormSample)
|
||||||
|
{
|
||||||
|
FormSample->setWindowTitle(QApplication::translate("FormSample", "Form", 0, QApplication::UnicodeUTF8));
|
||||||
|
checkBox->setText(QApplication::translate("FormSample", "active", 0, QApplication::UnicodeUTF8));
|
||||||
|
labelSampleName->setText(QApplication::translate("FormSample", "TextLabel", 0, QApplication::UnicodeUTF8));
|
||||||
|
labelSampleInfo->setText(QApplication::translate("FormSample", "TextLabel", 0, QApplication::UnicodeUTF8));
|
||||||
|
pushButton->setText(QApplication::translate("FormSample", "delete", 0, QApplication::UnicodeUTF8));
|
||||||
|
} // retranslateUi
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class FormSample: public Ui_FormSample {};
|
||||||
|
} // namespace Ui
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // SAMPLESY5241_H
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,490 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>SettingsDialog</class>
|
|
||||||
<widget class="QDialog" name="SettingsDialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>438</width>
|
|
||||||
<height>656</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>settings</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>device</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="deviceComboBox">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>sample rate</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="samplerateLineEdit">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>44100</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
<pointsize>8</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>note: this currently should probably match your sample file's input rate as no conversion is run on them - yet</string>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>buffer size</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="buffersizeComboBox">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>64</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>128</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>256</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>512</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>1024</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>2048</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>4096</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>messages</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="messagesLabel">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
<pointsize>8</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="autoFillBackground">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">border: 1px solid;</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_9">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
<pointsize>8</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>restart needed for the ports below to update</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>gui osc port</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="guiOSCLineEdit">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_7">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>process osc port</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="processOSCLineEdit">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_8">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>audio osc port</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="audioOSCLineEdit">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="applyPushButton">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>apply settings</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>SettingsDialog</receiver>
|
|
||||||
<slot>accept()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>244</x>
|
|
||||||
<y>642</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>157</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>SettingsDialog</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>312</x>
|
|
||||||
<y>642</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>286</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>samplerateLineEdit</sender>
|
|
||||||
<signal>textEdited(QString)</signal>
|
|
||||||
<receiver>SettingsDialog</receiver>
|
|
||||||
<slot>samplerate(QString)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>270</x>
|
|
||||||
<y>71</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>394</x>
|
|
||||||
<y>156</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>applyPushButton</sender>
|
|
||||||
<signal>clicked()</signal>
|
|
||||||
<receiver>SettingsDialog</receiver>
|
|
||||||
<slot>apply()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>125</x>
|
|
||||||
<y>592</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>4</x>
|
|
||||||
<y>315</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>deviceComboBox</sender>
|
|
||||||
<signal>currentTextChanged(QString)</signal>
|
|
||||||
<receiver>SettingsDialog</receiver>
|
|
||||||
<slot>output_device(QString)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>323</x>
|
|
||||||
<y>45</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>393</x>
|
|
||||||
<y>64</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>buffersizeComboBox</sender>
|
|
||||||
<signal>currentTextChanged(QString)</signal>
|
|
||||||
<receiver>SettingsDialog</receiver>
|
|
||||||
<slot>buffersize(QString)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>390</x>
|
|
||||||
<y>215</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>395</x>
|
|
||||||
<y>208</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>guiOSCLineEdit</sender>
|
|
||||||
<signal>textChanged(QString)</signal>
|
|
||||||
<receiver>SettingsDialog</receiver>
|
|
||||||
<slot>gui_port(QString)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>346</x>
|
|
||||||
<y>432</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>401</x>
|
|
||||||
<y>419</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>processOSCLineEdit</sender>
|
|
||||||
<signal>textChanged(QString)</signal>
|
|
||||||
<receiver>SettingsDialog</receiver>
|
|
||||||
<slot>process_port(QString)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>356</x>
|
|
||||||
<y>482</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>398</x>
|
|
||||||
<y>479</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>audioOSCLineEdit</sender>
|
|
||||||
<signal>textChanged(QString)</signal>
|
|
||||||
<receiver>SettingsDialog</receiver>
|
|
||||||
<slot>audio_port(QString)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>374</x>
|
|
||||||
<y>511</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>398</x>
|
|
||||||
<y>517</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
<slots>
|
|
||||||
<slot>output_device(QString)</slot>
|
|
||||||
<slot>samplerate(QString)</slot>
|
|
||||||
<slot>buffersize(QString)</slot>
|
|
||||||
<slot>apply()</slot>
|
|
||||||
<slot>gui_port(QString)</slot>
|
|
||||||
<slot>audio_port(QString)</slot>
|
|
||||||
<slot>process_port(QString)</slot>
|
|
||||||
</slots>
|
|
||||||
</ui>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.3 KiB |
|
|
@ -32,11 +32,11 @@ static void* _process(void *c) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
process_thread::process_thread(const string &port) :
|
process_thread::process_thread() :
|
||||||
m_osc(port),
|
m_osc("8889"),
|
||||||
m_source_block_size(1000),
|
m_source_block_size(3000),
|
||||||
m_source_overlap(0.75),
|
m_source_overlap(0.75),
|
||||||
m_target_block_size(1000),
|
m_target_block_size(3000),
|
||||||
m_target_overlap(0.75),
|
m_target_overlap(0.75),
|
||||||
m_window_type(window::DODGY),
|
m_window_type(window::DODGY),
|
||||||
m_target_window_type(window::DODGY)
|
m_target_window_type(window::DODGY)
|
||||||
|
|
@ -181,6 +181,9 @@ void process_thread::load_session(const std::string &filename) {
|
||||||
ifs||m_source_block_size||m_source_overlap;
|
ifs||m_source_block_size||m_source_overlap;
|
||||||
ifs||m_target_block_size||m_target_overlap;
|
ifs||m_target_block_size||m_target_overlap;
|
||||||
ifs||m_window_type||m_target_window_type;
|
ifs||m_window_type||m_target_window_type;
|
||||||
|
|
||||||
|
cerr<<"loading window type session "<<m_target_window_type<<endl;
|
||||||
|
|
||||||
ifs||m_source;
|
ifs||m_source;
|
||||||
ifs||m_left_target;
|
ifs||m_left_target;
|
||||||
ifs||m_right_target;
|
ifs||m_right_target;
|
||||||
|
|
@ -197,6 +200,9 @@ void process_thread::save_session(const std::string &filename) {
|
||||||
ofs||(*m_right_renderer);
|
ofs||(*m_right_renderer);
|
||||||
ofs||m_source_block_size||m_source_overlap;
|
ofs||m_source_block_size||m_source_overlap;
|
||||||
ofs||m_target_block_size||m_target_overlap;
|
ofs||m_target_block_size||m_target_overlap;
|
||||||
|
|
||||||
|
cerr<<"saving window type session "<<m_target_window_type<<endl;
|
||||||
|
|
||||||
ofs||m_window_type||m_target_window_type;
|
ofs||m_window_type||m_target_window_type;
|
||||||
ofs||m_source;
|
ofs||m_source;
|
||||||
ofs||m_left_target;
|
ofs||m_left_target;
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@
|
||||||
|
|
||||||
namespace spiralcore {
|
namespace spiralcore {
|
||||||
|
|
||||||
class process_thread {
|
class process_thread {
|
||||||
public:
|
public:
|
||||||
process_thread(const string &port);
|
process_thread();
|
||||||
~process_thread();
|
~process_thread();
|
||||||
|
|
||||||
pthread_mutex_t* m_brain_mutex;
|
pthread_mutex_t* m_brain_mutex;
|
||||||
|
|
@ -47,13 +47,10 @@ namespace spiralcore {
|
||||||
void load_session(const std::string &filename);
|
void load_session(const std::string &filename);
|
||||||
void save_session(const std::string &filename);
|
void save_session(const std::string &filename);
|
||||||
|
|
||||||
|
|
||||||
bool ok() { return m_osc.ok(); }
|
|
||||||
|
|
||||||
// only for use in mutex
|
// only for use in mutex
|
||||||
brain m_source, m_left_target, m_right_target;
|
brain m_source, m_left_target, m_right_target;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OSC_server m_osc;
|
OSC_server m_osc;
|
||||||
u32 m_source_block_size;
|
u32 m_source_block_size;
|
||||||
float m_source_overlap;
|
float m_source_overlap;
|
||||||
|
|
@ -67,6 +64,6 @@ namespace spiralcore {
|
||||||
renderer *m_left_renderer;
|
renderer *m_left_renderer;
|
||||||
renderer *m_right_renderer;
|
renderer *m_right_renderer;
|
||||||
block_stream *m_block_stream;
|
block_stream *m_block_stream;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,54 +19,23 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QSettings>
|
|
||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
|
||||||
#include "process_thread.h"
|
#include "process_thread.h"
|
||||||
#include "audio_thread.h"
|
#include "audio_thread.h"
|
||||||
#include "status.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main( int argc , char *argv[] ){
|
int main( int argc , char *argv[] ){
|
||||||
|
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
cerr<<"Qt version: "<<qVersion()<<endl;
|
MainWindow mainWin;
|
||||||
QSettings settings("thentrythis", "samplebrain");
|
|
||||||
|
|
||||||
// slight over-use of OSC servers here, but the are packaged nicely for
|
|
||||||
// threadsafe (nonblocking) communication, and it's useful to expose all
|
|
||||||
// moving parts for external control (i.e. the processing and the audio)
|
|
||||||
|
|
||||||
if (!settings.contains("gui_port")) settings.setValue("gui_port", "62345");
|
|
||||||
if (!settings.contains("audio_port")) settings.setValue("audio_port", "62346");
|
|
||||||
if (!settings.contains("process_port")) settings.setValue("process_port", "62347");
|
|
||||||
|
|
||||||
string gui_port = settings.value("gui_port").toByteArray().constData();
|
|
||||||
string audio_port = settings.value("audio_port").toByteArray().constData();
|
|
||||||
string process_port = settings.value("process_port").toByteArray().constData();
|
|
||||||
|
|
||||||
status::set_port(gui_port);
|
|
||||||
|
|
||||||
MainWindow mainWin(gui_port,audio_port,process_port,&settings);
|
|
||||||
mainWin.show();
|
mainWin.show();
|
||||||
process_thread pt(process_port);
|
|
||||||
audio_thread at(audio_port,pt);
|
|
||||||
|
|
||||||
|
cerr<<"Qt version: "<<qVersion()<<endl;
|
||||||
|
|
||||||
|
process_thread pt;
|
||||||
|
audio_thread at(pt);
|
||||||
pt.register_renderer(at.m_left_renderer, at.m_right_renderer, at.m_block_stream);
|
pt.register_renderer(at.m_left_renderer, at.m_right_renderer, at.m_block_stream);
|
||||||
mainWin.set_audio_thread(&at);
|
|
||||||
|
|
||||||
if (!at.ok()) {
|
|
||||||
mainWin.message("problem starting audio thread on port "+audio_port);
|
|
||||||
}
|
|
||||||
if (!pt.ok()) {
|
|
||||||
mainWin.message("problem starting process thread on port "+process_port);
|
|
||||||
}
|
|
||||||
if (!mainWin.ok()) {
|
|
||||||
mainWin.message("problem starting gui thread on port "+gui_port);
|
|
||||||
}
|
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="images">
|
<qresource prefix="images">
|
||||||
<file>images/settings.png</file>
|
|
||||||
<file>images/at.png</file>
|
<file>images/at.png</file>
|
||||||
<file>images/pause.png</file>
|
<file>images/pause.png</file>
|
||||||
<file>images/play.png</file>
|
<file>images/play.png</file>
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,11 @@ sound_items::sound_item &sound_items::add(QVBoxLayout *container, const string &
|
||||||
sound_item si;
|
sound_item si;
|
||||||
si.m_filename = name;
|
si.m_filename = name;
|
||||||
si.m_id = m_current_sound_id++;
|
si.m_id = m_current_sound_id++;
|
||||||
QString style("color:black;background-color:lightgrey;");
|
QString style("background-color:lightgrey;");
|
||||||
|
|
||||||
si.m_container = new QHBoxLayout();
|
si.m_container = new QHBoxLayout();
|
||||||
si.m_container->setSpacing(10);
|
si.m_container->setSpacing(10);
|
||||||
|
si.m_container->setMargin(0);
|
||||||
si.m_container->setContentsMargins(0,0,0,0);
|
si.m_container->setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
si.m_enable = new QCheckBox();
|
si.m_enable = new QCheckBox();
|
||||||
|
|
@ -55,7 +56,7 @@ sound_items::sound_item &sound_items::add(QVBoxLayout *container, const string &
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setFamily(QString::fromUtf8("Comic Sans MS"));
|
font.setFamily(QString::fromUtf8("Comic Sans MS"));
|
||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
font.setWeight(QFont::Bold);
|
font.setWeight(75);
|
||||||
si.m_label->setFont(font);
|
si.m_label->setFont(font);
|
||||||
si.m_label->setContentsMargins(0,0,0,0);
|
si.m_label->setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
|
|
@ -89,8 +90,8 @@ void sound_items::clear() {
|
||||||
void sound_items::recolour() {
|
void sound_items::recolour() {
|
||||||
u32 c=0;
|
u32 c=0;
|
||||||
for (auto &si:m_sound_items) {
|
for (auto &si:m_sound_items) {
|
||||||
QString style("color:black;background-color:lightblue;");
|
QString style("background-color:lightblue;");
|
||||||
if (c%2==0) style="color:black;background-color:pink;";
|
if (c%2==0) style="background-color:pink;";
|
||||||
si.m_enable->setStyleSheet(style);
|
si.m_enable->setStyleSheet(style);
|
||||||
si.m_del->setStyleSheet(style);
|
si.m_del->setStyleSheet(style);
|
||||||
si.m_label->setStyleSheet(style);
|
si.m_label->setStyleSheet(style);
|
||||||
|
|
@ -101,7 +102,7 @@ void sound_items::recolour() {
|
||||||
void sound_items::change_colour(const std::string &name, const std::string &colour) {
|
void sound_items::change_colour(const std::string &name, const std::string &colour) {
|
||||||
for (auto &si:m_sound_items) {
|
for (auto &si:m_sound_items) {
|
||||||
if (si.m_filename==name) {
|
if (si.m_filename==name) {
|
||||||
QString style("color:black;background-color:"+QString::fromStdString(colour)+";");
|
QString style("background-color:"+QString::fromStdString(colour)+";");
|
||||||
si.m_enable->setStyleSheet(style);
|
si.m_enable->setStyleSheet(style);
|
||||||
si.m_del->setStyleSheet(style);
|
si.m_del->setStyleSheet(style);
|
||||||
si.m_label->setStyleSheet(style);
|
si.m_label->setStyleSheet(style);
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ double square(double a) {
|
||||||
return a*a;
|
return a*a;
|
||||||
}
|
}
|
||||||
|
|
||||||
void normalise(spiralcore::sample &in) {
|
void normalise(sample &in) {
|
||||||
// find min/max
|
// find min/max
|
||||||
float max = 0;
|
float max = 0;
|
||||||
float min = FLT_MAX;
|
float min = FLT_MAX;
|
||||||
|
|
@ -77,7 +77,7 @@ block::block(u64 id, const string &filename, const sample &pcm, u32 rate, const
|
||||||
m_orig_filename(filename),
|
m_orig_filename(filename),
|
||||||
m_usage(0)
|
m_usage(0)
|
||||||
{
|
{
|
||||||
init_fft(m_pcm.get_length(),rate);
|
init_fft(m_pcm.get_length());
|
||||||
assert(m_mfcc_proc!=NULL);
|
assert(m_mfcc_proc!=NULL);
|
||||||
assert(m_fftw!=NULL);
|
assert(m_fftw!=NULL);
|
||||||
|
|
||||||
|
|
@ -97,12 +97,12 @@ block::block(u64 id, const string &filename, const sample &pcm, u32 rate, const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void block::init_fft(u32 block_size, u32 rate) {
|
void block::init_fft(u32 block_size) {
|
||||||
if (m_fftw == NULL || m_fftw->m_length!=block_size) {
|
if (m_fftw == NULL || m_fftw->m_length!=block_size) {
|
||||||
if (m_fftw == NULL) delete m_fftw;
|
if (m_fftw == NULL) delete m_fftw;
|
||||||
m_fftw = new FFT(block_size,rate,100);
|
m_fftw = new FFT(block_size,100);
|
||||||
if (m_mfcc_proc == NULL) delete m_mfcc_proc;
|
if (m_mfcc_proc == NULL) delete m_mfcc_proc;
|
||||||
m_mfcc_proc = new Aquila::Mfcc(block_size,rate);
|
m_mfcc_proc = new Aquila::Mfcc(block_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,7 +112,6 @@ void block::process(const sample &pcm, sample &fft, sample &mfcc, float &freq) {
|
||||||
|
|
||||||
// calculate fft
|
// calculate fft
|
||||||
std::vector<std::complex<double> > mfspec;
|
std::vector<std::complex<double> > mfspec;
|
||||||
mfspec.reserve(m_block_size);
|
|
||||||
for (u32 i=0; i<m_block_size; ++i) {
|
for (u32 i=0; i<m_block_size; ++i) {
|
||||||
mfspec.push_back(std::complex<double>(m_fftw->m_spectrum[i][0],
|
mfspec.push_back(std::complex<double>(m_fftw->m_spectrum[i][0],
|
||||||
m_fftw->m_spectrum[i][1]));
|
m_fftw->m_spectrum[i][1]));
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ namespace spiralcore {
|
||||||
// returns distance based on ratio of fft-mfcc values
|
// returns distance based on ratio of fft-mfcc values
|
||||||
double compare(const block &other, const search_params ¶ms) const;
|
double compare(const block &other, const search_params ¶ms) const;
|
||||||
|
|
||||||
static void init_fft(u32 block_size, u32 rate);
|
static void init_fft(u32 block_size);
|
||||||
static bool unit_test();
|
static bool unit_test();
|
||||||
|
|
||||||
const sample &get_pcm() const { return m_pcm; }
|
const sample &get_pcm() const { return m_pcm; }
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <signal.h>
|
|
||||||
#include "block_stream.h"
|
#include "block_stream.h"
|
||||||
|
|
||||||
using namespace spiralcore;
|
using namespace spiralcore;
|
||||||
|
|
@ -35,36 +34,15 @@ block_stream::block_stream() :
|
||||||
m_block_index_offset(0),
|
m_block_index_offset(0),
|
||||||
m_sent_block_index(0)
|
m_sent_block_index(0)
|
||||||
{
|
{
|
||||||
}
|
|
||||||
|
|
||||||
block_stream::~block_stream() {}
|
|
||||||
|
|
||||||
void block_stream::start() {
|
|
||||||
cerr<<"block stream starting up"<<endl;
|
|
||||||
for (u32 i=0; i<NUM_WORKERS; ++i) {
|
for (u32 i=0; i<NUM_WORKERS; ++i) {
|
||||||
m_workers.push_back(new worker(i,&m_window));
|
m_workers.push_back(new worker(i,&m_window));
|
||||||
// ????
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
usleep(1);
|
usleep(1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void block_stream::stop() {
|
block_stream::~block_stream() {}
|
||||||
cerr<<"block stream ending"<<endl;
|
|
||||||
|
|
||||||
bool killcount = 0;
|
|
||||||
for (auto &w : m_workers) {
|
|
||||||
pthread_join(*w->m_thread,NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
usleep(500);
|
|
||||||
|
|
||||||
for (u32 i=0; i<NUM_WORKERS; ++i) {
|
|
||||||
delete m_workers[i];
|
|
||||||
}
|
|
||||||
m_workers.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void block_stream::init(u32 block_size, u32 overlap, window::type t, bool ditchpcm) {
|
void block_stream::init(u32 block_size, u32 overlap, window::type t, bool ditchpcm) {
|
||||||
m_block_size=block_size;
|
m_block_size=block_size;
|
||||||
|
|
@ -79,7 +57,6 @@ void block_stream::init(u32 block_size, u32 overlap, window::type t, bool ditchp
|
||||||
m_window.set_current_type(t);
|
m_window.set_current_type(t);
|
||||||
|
|
||||||
m_blocks.clear();
|
m_blocks.clear();
|
||||||
m_blocks.reserve(MAX_BLOCKS);
|
|
||||||
sample dummy(block_size);
|
sample dummy(block_size);
|
||||||
for (u32 i=0; i<MAX_BLOCKS; i++) {
|
for (u32 i=0; i<MAX_BLOCKS; i++) {
|
||||||
m_blocks.push_back(block(0,"dummy",dummy,44100,m_window));
|
m_blocks.push_back(block(0,"dummy",dummy,44100,m_window));
|
||||||
|
|
@ -116,6 +93,7 @@ void block_stream::process(const sample &left, const sample &right) {
|
||||||
|
|
||||||
m_block_position=0;
|
m_block_position=0;
|
||||||
|
|
||||||
|
|
||||||
if (m_blocks.size()>MAX_BLOCKS) {
|
if (m_blocks.size()>MAX_BLOCKS) {
|
||||||
m_blocks.erase(m_blocks.begin());
|
m_blocks.erase(m_blocks.begin());
|
||||||
m_block_index_offset++;
|
m_block_index_offset++;
|
||||||
|
|
@ -153,12 +131,8 @@ block_stream::worker::worker(u32 id, window *w) :
|
||||||
pthread_create(m_thread,NULL,(void*(*)(void*))_run_worker,this);
|
pthread_create(m_thread,NULL,(void*(*)(void*))_run_worker,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
block_stream::worker::~worker() {
|
|
||||||
delete m_worker_mutex;
|
|
||||||
delete m_thread;
|
|
||||||
}
|
|
||||||
|
|
||||||
void block_stream::worker::run() {
|
void block_stream::worker::run() {
|
||||||
|
//cerr<<"worker "<<m_id<<" started..."<<endl;
|
||||||
while (true) {
|
while (true) {
|
||||||
pthread_mutex_lock(m_worker_mutex);
|
pthread_mutex_lock(m_worker_mutex);
|
||||||
if (m_status==ACTIVATE) {
|
if (m_status==ACTIVATE) {
|
||||||
|
|
@ -168,7 +142,6 @@ void block_stream::worker::run() {
|
||||||
m_status=FINISHED;
|
m_status=FINISHED;
|
||||||
cerr<<"ending "<<m_id<<endl;
|
cerr<<"ending "<<m_id<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(m_worker_mutex);
|
pthread_mutex_unlock(m_worker_mutex);
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
usleep(5);
|
usleep(5);
|
||||||
|
|
@ -176,10 +149,11 @@ void block_stream::worker::run() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void block_stream::scatter_gather(u32 block_index, const sample ®ion) {
|
void block_stream::scatter_gather(u32 block_index, const sample ®ion) {
|
||||||
while(true) {
|
while(true) {
|
||||||
for (auto &w : m_workers) {
|
for (auto &w : m_workers) {
|
||||||
if (pthread_mutex_trylock(w->m_worker_mutex)==0) {
|
if (pthread_mutex_trylock(w->m_worker_mutex)) {
|
||||||
if (w->m_status == worker::FINISHED) {
|
if (w->m_status == worker::FINISHED) {
|
||||||
//cerr<<"adding finished block "<<w->m_block_index<<endl;
|
//cerr<<"adding finished block "<<w->m_block_index<<endl;
|
||||||
m_blocks[w->m_block_index]=*w->m_output;
|
m_blocks[w->m_block_index]=*w->m_output;
|
||||||
|
|
@ -192,7 +166,6 @@ void block_stream::scatter_gather(u32 block_index, const sample ®ion) {
|
||||||
w->m_block_index = block_index;
|
w->m_block_index = block_index;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(w->m_worker_mutex);
|
pthread_mutex_unlock(w->m_worker_mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,15 +41,11 @@ class block_stream : public block_source {
|
||||||
virtual const block &get_block(u32 index) const;
|
virtual const block &get_block(u32 index) const;
|
||||||
virtual u32 get_num_blocks() const { return UINT_MAX; }
|
virtual u32 get_num_blocks() const { return UINT_MAX; }
|
||||||
|
|
||||||
void start();
|
|
||||||
void stop();
|
|
||||||
|
|
||||||
u32 last_block_index() const { return m_block_index_offset+m_blocks.size()-1; }
|
u32 last_block_index() const { return m_block_index_offset+m_blocks.size()-1; }
|
||||||
|
|
||||||
class worker {
|
class worker {
|
||||||
public:
|
public:
|
||||||
worker(u32 id, window *w);
|
worker(u32 id, window *w);
|
||||||
~worker();
|
|
||||||
|
|
||||||
enum worker_status { READY=0, ACTIVATE, WORKING, FINISHED };
|
enum worker_status { READY=0, ACTIVATE, WORKING, FINISHED };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <atomic>
|
|
||||||
#include <sndfile.h>
|
#include <sndfile.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <spiralcore/audio.h>
|
#include <spiralcore/audio.h>
|
||||||
|
|
@ -70,8 +69,6 @@ void brain::load_sound(std::string filename, stereo_mode mode) {
|
||||||
delete[] temp;
|
delete[] temp;
|
||||||
m_samples.push_back(sound(filename,s));
|
m_samples.push_back(sound(filename,s));
|
||||||
status::update("loaded %s",filename.c_str());
|
status::update("loaded %s",filename.c_str());
|
||||||
} else {
|
|
||||||
status::update("problem loading %s",filename.c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -229,7 +226,6 @@ u32 brain::rev_search(const block &target, const search_params ¶ms) {
|
||||||
return furthest_index;
|
return furthest_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// really slow - every to every comparison of blocks calculating average distance
|
// really slow - every to every comparison of blocks calculating average distance
|
||||||
double brain::calc_average_diff(search_params ¶ms) {
|
double brain::calc_average_diff(search_params ¶ms) {
|
||||||
double diff=0;
|
double diff=0;
|
||||||
|
|
@ -246,12 +242,10 @@ void brain::build_synapses_thresh(search_params ¶ms, double thresh) {
|
||||||
m_average_error = calc_average_diff(params)*thresh;
|
m_average_error = calc_average_diff(params)*thresh;
|
||||||
double err = m_average_error*thresh;
|
double err = m_average_error*thresh;
|
||||||
u32 brain_size = m_blocks.size();
|
u32 brain_size = m_blocks.size();
|
||||||
std::atomic<u32> progress{0};
|
u32 outer_index = 0;
|
||||||
#pragma omp parallel for
|
for (auto &i : m_blocks) {
|
||||||
for (u32 outer_index = 0; outer_index < brain_size; ++outer_index) {
|
|
||||||
auto &i = m_blocks[outer_index];
|
|
||||||
u32 index = 0;
|
u32 index = 0;
|
||||||
status::update("building synapses %d%%",(int)(progress/(float)brain_size*100));
|
status::update("building synapses %d%%",(int)(outer_index/(float)brain_size*100));
|
||||||
for (auto &j : m_blocks) {
|
for (auto &j : m_blocks) {
|
||||||
if (index!=outer_index) {
|
if (index!=outer_index) {
|
||||||
// collect connections that are under threshold in closeness
|
// collect connections that are under threshold in closeness
|
||||||
|
|
@ -262,33 +256,30 @@ void brain::build_synapses_thresh(search_params ¶ms, double thresh) {
|
||||||
}
|
}
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
++progress;
|
++outer_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
void brain::build_synapses_fixed(search_params ¶ms) {
|
void brain::build_synapses_fixed(search_params ¶ms) {
|
||||||
//m_average_error = calc_average_diff(params)*thresh;
|
//m_average_error = calc_average_diff(params)*thresh;
|
||||||
u32 brain_size = m_blocks.size();
|
u32 brain_size = m_blocks.size();
|
||||||
|
u32 outer_index = 0;
|
||||||
u32 num_synapses = NUM_FIXED_SYNAPSES;
|
u32 num_synapses = NUM_FIXED_SYNAPSES;
|
||||||
if (num_synapses>=m_blocks.size()) num_synapses=m_blocks.size()-1;
|
if (num_synapses>=m_blocks.size()) num_synapses=m_blocks.size()-1;
|
||||||
|
|
||||||
// need to stop the progress updates flooding osc
|
// need to stop the progress updates flooding osc
|
||||||
u32 update_period = 100;
|
u32 update_period = 100;
|
||||||
std::atomic<u32> update_tick{0};
|
u32 update_tick = 0;
|
||||||
std::atomic<u32> progress{0};
|
|
||||||
#pragma omp parallel for
|
for (auto &i:m_blocks) {
|
||||||
for (u32 outer_index = 0; outer_index < brain_size; ++outer_index) {
|
|
||||||
auto &i = m_blocks[outer_index];
|
|
||||||
if (update_tick>update_period) {
|
if (update_tick>update_period) {
|
||||||
status::update("building synapses %d%%",(int)(progress/(float)brain_size*100));
|
status::update("building synapses %d%%",(int)(outer_index/(float)brain_size*100));
|
||||||
update_tick=0;
|
update_tick=0;
|
||||||
}
|
}
|
||||||
update_tick++;
|
update_tick++;
|
||||||
|
|
||||||
u32 index = 0;
|
u32 index = 0;
|
||||||
vector<pair<u32,double>> collect;
|
vector<pair<u32,double>> collect;
|
||||||
collect.reserve(brain_size);
|
|
||||||
|
|
||||||
// collect comparisons to all other blocks
|
// collect comparisons to all other blocks
|
||||||
for (auto &j:m_blocks) {
|
for (auto &j:m_blocks) {
|
||||||
|
|
@ -313,7 +304,7 @@ void brain::build_synapses_fixed(search_params ¶ms) {
|
||||||
i.get_synapse().push_back(collect[n].first);
|
i.get_synapse().push_back(collect[n].first);
|
||||||
}
|
}
|
||||||
|
|
||||||
++progress;
|
++outer_index;
|
||||||
}
|
}
|
||||||
status::update("Done: %d synapses grown for %d blocks",num_synapses*brain_size,brain_size);
|
status::update("Done: %d synapses grown for %d blocks",num_synapses*brain_size,brain_size);
|
||||||
}
|
}
|
||||||
|
|
@ -386,6 +377,34 @@ void brain::deplete_usage() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// take another brain and rebuild this brain from bits of that one
|
||||||
|
// (presumably this one is made from a single sample)
|
||||||
|
/*void brain::resynth(const string &filename, const brain &other, const search_params ¶ms){
|
||||||
|
sample out((m_block_size-m_overlap)*m_blocks.size());
|
||||||
|
out.zero();
|
||||||
|
u32 pos = 0;
|
||||||
|
u32 count = 0;
|
||||||
|
cerr<<other.m_blocks.size()<<" brain blocks..."<<endl;
|
||||||
|
cerr<<endl;
|
||||||
|
for (vector<block>::iterator i=m_blocks.begin(); i!=m_blocks.end(); ++i) {
|
||||||
|
cerr<<'\r';
|
||||||
|
cerr<<"searching: "<<count/float(m_blocks.size())*100;
|
||||||
|
u32 index = other.search(*i, params);
|
||||||
|
//cerr<<index<<endl;
|
||||||
|
out.mul_mix(other.get_block_pcm(index),pos,0.2);
|
||||||
|
|
||||||
|
if (count%1000==0) {
|
||||||
|
audio_device::save_sample(filename,out);
|
||||||
|
}
|
||||||
|
|
||||||
|
++count;
|
||||||
|
pos += (m_block_size-m_overlap);
|
||||||
|
}
|
||||||
|
audio_device::save_sample(filename,out);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
ios &spiralcore::operator||(ios &s, brain::sound &b) {
|
ios &spiralcore::operator||(ios &s, brain::sound &b) {
|
||||||
u32 version=1;
|
u32 version=1;
|
||||||
string id("brain::sound");
|
string id("brain::sound");
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ public:
|
||||||
u32 rev_search(const block &target, const search_params ¶ms);
|
u32 rev_search(const block &target, const search_params ¶ms);
|
||||||
|
|
||||||
// synaptic search
|
// synaptic search
|
||||||
// double calc_average_diff(search_params ¶ms);
|
double calc_average_diff(search_params ¶ms);
|
||||||
// void build_synapses_thresh(search_params ¶ms, double threshold);
|
void build_synapses_thresh(search_params ¶ms, double threshold);
|
||||||
void build_synapses_fixed(search_params ¶ms);
|
void build_synapses_fixed(search_params ¶ms);
|
||||||
u32 search_synapses(const block &target, search_params ¶ms);
|
u32 search_synapses(const block &target, search_params ¶ms);
|
||||||
double get_current_error() { return m_current_error; }
|
double get_current_error() { return m_current_error; }
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,8 @@ using namespace std;
|
||||||
|
|
||||||
static const int MAX_FFT_LENGTH = 4096;
|
static const int MAX_FFT_LENGTH = 4096;
|
||||||
|
|
||||||
FFT::FFT(u32 length, u32 rate, u32 bins) :
|
FFT::FFT(u32 length, u32 bins) :
|
||||||
m_length(length),
|
m_length(length),
|
||||||
m_rate(rate),
|
|
||||||
m_num_bins(bins),
|
m_num_bins(bins),
|
||||||
m_in(new double[length]),
|
m_in(new double[length]),
|
||||||
m_spectrum(new fftw_complex[length]),
|
m_spectrum(new fftw_complex[length]),
|
||||||
|
|
@ -36,19 +35,26 @@ FFT::FFT(u32 length, u32 rate, u32 bins) :
|
||||||
m_plan = fftw_plan_dft_r2c_1d(m_length, m_in, m_spectrum, FFTW_ESTIMATE);
|
m_plan = fftw_plan_dft_r2c_1d(m_length, m_in, m_spectrum, FFTW_ESTIMATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
FFT::~FFT() {
|
FFT::~FFT()
|
||||||
|
{
|
||||||
delete[] m_in;
|
delete[] m_in;
|
||||||
fftw_destroy_plan(m_plan);
|
fftw_destroy_plan(m_plan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FFT::impulse2freq(const float *imp) {
|
void FFT::impulse2freq(const float *imp)
|
||||||
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i=0; i<m_length; i++) {
|
|
||||||
|
for (i=0; i<m_length; i++)
|
||||||
|
{
|
||||||
m_in[i] = imp[i];
|
m_in[i] = imp[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
fftw_execute(m_plan);
|
fftw_execute(m_plan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const float SRATE = 44100;
|
||||||
|
|
||||||
float FFT::calculate_dominant_freq() {
|
float FFT::calculate_dominant_freq() {
|
||||||
double highest = 0;
|
double highest = 0;
|
||||||
u32 index = 0;
|
u32 index = 0;
|
||||||
|
|
@ -59,7 +65,7 @@ float FFT::calculate_dominant_freq() {
|
||||||
highest=t;
|
highest=t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float freq = index * (m_rate/(float)m_length);
|
float freq = index * (SRATE/(float)m_length);
|
||||||
if (freq<0.01) freq=0.01;
|
if (freq<0.01) freq=0.01;
|
||||||
return freq;
|
return freq;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ namespace spiralcore {
|
||||||
class FFT
|
class FFT
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FFT(u32 length, u32 rate, u32 num_bins);
|
FFT(u32 length, u32 num_bins);
|
||||||
~FFT();
|
~FFT();
|
||||||
void impulse2freq(const float *imp);
|
void impulse2freq(const float *imp);
|
||||||
void calculate_bins();
|
void calculate_bins();
|
||||||
|
|
@ -35,7 +35,6 @@ namespace spiralcore {
|
||||||
|
|
||||||
fftw_plan m_plan;
|
fftw_plan m_plan;
|
||||||
u32 m_length;
|
u32 m_length;
|
||||||
u32 m_rate;
|
|
||||||
u32 m_num_bins;
|
u32 m_num_bins;
|
||||||
double *m_in;
|
double *m_in;
|
||||||
fftw_complex *m_spectrum;
|
fftw_complex *m_spectrum;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ namespace Aquila
|
||||||
{
|
{
|
||||||
//auto spectrum = m_fft->fft(source);
|
//auto spectrum = m_fft->fft(source);
|
||||||
|
|
||||||
Aquila::MelFilterBank bank(m_sampleRate, m_inputSize);
|
Aquila::MelFilterBank bank(44100, m_inputSize);
|
||||||
auto filterOutput = bank.applyAll(spectrum);
|
auto filterOutput = bank.applyAll(spectrum);
|
||||||
|
|
||||||
Aquila::Dct dct;
|
Aquila::Dct dct;
|
||||||
|
|
|
||||||
|
|
@ -59,9 +59,8 @@ namespace Aquila
|
||||||
*
|
*
|
||||||
* @param inputSize input length (common to all inputs)
|
* @param inputSize input length (common to all inputs)
|
||||||
*/
|
*/
|
||||||
Mfcc(std::size_t inputSize, unsigned int sampleRate):
|
Mfcc(std::size_t inputSize):
|
||||||
m_inputSize(inputSize), // m_fft(FftFactory::getFft(inputSize))
|
m_inputSize(inputSize)//, m_fft(FftFactory::getFft(inputSize))
|
||||||
m_sampleRate(sampleRate)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,7 +71,6 @@ namespace Aquila
|
||||||
* Number of samples in each processed input.
|
* Number of samples in each processed input.
|
||||||
*/
|
*/
|
||||||
const std::size_t m_inputSize;
|
const std::size_t m_inputSize;
|
||||||
const unsigned int m_sampleRate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FFT calculator.
|
* FFT calculator.
|
||||||
|
|
|
||||||
|
|
@ -31,41 +31,41 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OSC_server::OSC_server(const string &port) :
|
OSC_server::OSC_server(const string &port) :
|
||||||
m_port(port),
|
m_port(port),
|
||||||
m_exit(false),
|
m_exit(false),
|
||||||
m_command_ring_buffer(262144) {
|
m_command_ring_buffer(262144)
|
||||||
cerr<<"OSC using port: ["<<port<<"]"<<endl;
|
{
|
||||||
|
//cerr<<"using port: ["<<port<<"]"<<endl;
|
||||||
m_server = lo_server_thread_new(port.c_str(), error_handler);
|
m_server = lo_server_thread_new(port.c_str(), error_handler);
|
||||||
if (m_server) {
|
|
||||||
lo_server_thread_add_method(m_server, NULL, NULL, default_handler, this);
|
lo_server_thread_add_method(m_server, NULL, NULL, default_handler, this);
|
||||||
} else {
|
|
||||||
cerr<<"error opening OSC port"<<endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OSC_server::~OSC_server() {
|
OSC_server::~OSC_server()
|
||||||
|
{
|
||||||
m_exit=true;
|
m_exit=true;
|
||||||
lo_server_thread_stop(m_server);
|
lo_server_thread_stop(m_server);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSC_server::run() {
|
void OSC_server::run()
|
||||||
if (!m_server) return;
|
{
|
||||||
lo_server_thread_start(m_server);
|
lo_server_thread_start(m_server);
|
||||||
// while (!m_exit) usleep(1000);
|
// while (!m_exit) usleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSC_server::error_handler(int num, const char *msg, const char *path) {
|
void OSC_server::error_handler(int num, const char *msg, const char *path)
|
||||||
|
{
|
||||||
//cerr<<"liblo server error "<<num<<" in path "<<path<<": "<<msg<<endl;
|
//cerr<<"liblo server error "<<num<<" in path "<<path<<": "<<msg<<endl;
|
||||||
cerr<<"liblo server error "<<num<<endl;
|
cerr<<"liblo server error "<<num<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int OSC_server::default_handler(const char *path, const char *types, lo_arg **argv,
|
int OSC_server::default_handler(const char *path, const char *types, lo_arg **argv,
|
||||||
int argc, void *data, void *user_data) {
|
int argc, void *data, void *user_data)
|
||||||
|
{
|
||||||
OSC_server *server = (OSC_server*)user_data;
|
OSC_server *server = (OSC_server*)user_data;
|
||||||
if (!server) return -1;
|
|
||||||
|
|
||||||
unsigned int size = 0;
|
unsigned int size = 0;
|
||||||
for (int i=0; i<argc; i++) {
|
for (int i=0; i<argc; i++)
|
||||||
|
{
|
||||||
size+=lo_arg_size((lo_type)types[i],argv[i]);
|
size+=lo_arg_size((lo_type)types[i],argv[i]);
|
||||||
// add one for the null terminator
|
// add one for the null terminator
|
||||||
if (types[i]=='s') size++;
|
if (types[i]=='s') size++;
|
||||||
|
|
@ -73,10 +73,14 @@ int OSC_server::default_handler(const char *path, const char *types, lo_arg **ar
|
||||||
|
|
||||||
char *newdata=new char[size];
|
char *newdata=new char[size];
|
||||||
unsigned int pos=0;
|
unsigned int pos=0;
|
||||||
for (int i=0; i<argc; i++) {
|
for (int i=0; i<argc; i++)
|
||||||
switch (types[i]) {
|
{
|
||||||
case LO_INT32: {
|
switch (types[i])
|
||||||
if (pos+4>COMMAND_DATA_SIZE) {
|
{
|
||||||
|
case LO_INT32:
|
||||||
|
{
|
||||||
|
if (pos+4>COMMAND_DATA_SIZE)
|
||||||
|
{
|
||||||
cerr<<"osc data too big for ringbuffer command"<<endl;
|
cerr<<"osc data too big for ringbuffer command"<<endl;
|
||||||
delete[] newdata;
|
delete[] newdata;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -86,8 +90,10 @@ int OSC_server::default_handler(const char *path, const char *types, lo_arg **ar
|
||||||
pos+=4;
|
pos+=4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LO_FLOAT: {
|
case LO_FLOAT:
|
||||||
if (pos+4>COMMAND_DATA_SIZE) {
|
{
|
||||||
|
if (pos+4>COMMAND_DATA_SIZE)
|
||||||
|
{
|
||||||
cerr<<"osc data too big for ringbuffer command"<<endl;
|
cerr<<"osc data too big for ringbuffer command"<<endl;
|
||||||
delete[] newdata;
|
delete[] newdata;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -97,10 +103,12 @@ int OSC_server::default_handler(const char *path, const char *types, lo_arg **ar
|
||||||
pos+=4;
|
pos+=4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LO_STRING: {
|
case LO_STRING:
|
||||||
|
{
|
||||||
int size=strlen(&argv[i]->s);
|
int size=strlen(&argv[i]->s);
|
||||||
|
|
||||||
if (pos+size+1>COMMAND_DATA_SIZE) {
|
if (pos+size+1>COMMAND_DATA_SIZE)
|
||||||
|
{
|
||||||
cerr<<"osc data too big for ringbuffer command"<<endl;
|
cerr<<"osc data too big for ringbuffer command"<<endl;
|
||||||
delete[] newdata;
|
delete[] newdata;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -111,7 +119,8 @@ int OSC_server::default_handler(const char *path, const char *types, lo_arg **ar
|
||||||
pos+=size+1;
|
pos+=size+1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: {
|
default:
|
||||||
|
{
|
||||||
cerr<<"unsupported type: "<<types[i]<<endl;
|
cerr<<"unsupported type: "<<types[i]<<endl;
|
||||||
delete[] newdata;
|
delete[] newdata;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -120,14 +129,16 @@ int OSC_server::default_handler(const char *path, const char *types, lo_arg **ar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1) { //pos==size) hmm
|
if (1)//pos==size) hmm
|
||||||
|
{
|
||||||
command_ring_buffer::command command(path,types,newdata,pos);
|
command_ring_buffer::command command(path,types,newdata,pos);
|
||||||
if (!server->m_command_ring_buffer.send(command)) {
|
if (!server->m_command_ring_buffer.send(command))
|
||||||
|
{
|
||||||
//cerr<<"OSC_server - ringbuffer full!"<<endl;
|
//cerr<<"OSC_server - ringbuffer full!"<<endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
cerr<<"OSC_server::default_handler: size mismatch ["<<pos<<":"<<size<<"], not sending message"<<endl;
|
cerr<<"OSC_server::default_handler: size mismatch ["<<pos<<":"<<size<<"], not sending message"<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ public:
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
bool get(command_ring_buffer::command& command) { return m_command_ring_buffer.get(command);}
|
bool get(command_ring_buffer::command& command) { return m_command_ring_buffer.get(command);}
|
||||||
bool ok() { return m_server!=NULL; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int default_handler(const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data);
|
static int default_handler(const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data);
|
||||||
|
|
|
||||||
|
|
@ -22,23 +22,13 @@ using namespace std;
|
||||||
using namespace spiralcore;
|
using namespace spiralcore;
|
||||||
|
|
||||||
audio_device::audio_device(const string &clientname, u32 samplerate, u32 buffer_size) :
|
audio_device::audio_device(const string &clientname, u32 samplerate, u32 buffer_size) :
|
||||||
|
left_out(buffer_size),
|
||||||
|
right_out(buffer_size),
|
||||||
|
left_in(buffer_size),
|
||||||
|
right_in(buffer_size),
|
||||||
m_recording(false),
|
m_recording(false),
|
||||||
m_record_filename(""),
|
m_record_filename("")
|
||||||
m_samplerate(samplerate) {
|
{
|
||||||
// connect to default device
|
|
||||||
m_client.init();
|
|
||||||
connect("", clientname, samplerate, buffer_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void audio_device::connect(const string &output_device_name, const string &clientname, u32 samplerate, u32 buffer_size) {
|
|
||||||
m_client.detach();
|
|
||||||
|
|
||||||
left_out.allocate(buffer_size);
|
|
||||||
right_out.allocate(buffer_size);
|
|
||||||
left_in.allocate(buffer_size);
|
|
||||||
right_in.allocate(buffer_size);
|
|
||||||
m_samplerate = samplerate;
|
|
||||||
|
|
||||||
portaudio_client::device_options opt;
|
portaudio_client::device_options opt;
|
||||||
opt.buffer_size = buffer_size;
|
opt.buffer_size = buffer_size;
|
||||||
opt.num_buffers = 2;
|
opt.num_buffers = 2;
|
||||||
|
|
@ -48,14 +38,15 @@ void audio_device::connect(const string &output_device_name, const string &clien
|
||||||
|
|
||||||
m_client.set_outputs(left_out.get_buffer(), right_out.get_buffer());
|
m_client.set_outputs(left_out.get_buffer(), right_out.get_buffer());
|
||||||
m_client.set_inputs(left_in.get_non_const_buffer(), right_in.get_non_const_buffer());
|
m_client.set_inputs(left_in.get_non_const_buffer(), right_in.get_non_const_buffer());
|
||||||
m_client.attach(output_device_name,clientname,opt);
|
m_client.attach(clientname,opt);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio_device::save_sample(const string &filename, const sample s) {
|
void audio_device::save_sample(const string &filename, const sample s) {
|
||||||
SF_INFO sfinfo;
|
SF_INFO sfinfo;
|
||||||
sfinfo.format=SF_FORMAT_WAV | SF_FORMAT_FLOAT;
|
sfinfo.format=SF_FORMAT_WAV | SF_FORMAT_FLOAT;
|
||||||
sfinfo.frames=s.get_length();
|
sfinfo.frames=s.get_length();
|
||||||
sfinfo.samplerate=m_samplerate;
|
sfinfo.samplerate=44100;
|
||||||
sfinfo.channels=1;
|
sfinfo.channels=1;
|
||||||
sfinfo.sections=1;
|
sfinfo.sections=1;
|
||||||
sfinfo.seekable=0;
|
sfinfo.seekable=0;
|
||||||
|
|
@ -91,4 +82,5 @@ void audio_device::maybe_record() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void audio_device::start_graph(graph *graph) {
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,11 @@ class graph;
|
||||||
|
|
||||||
namespace spiralcore {
|
namespace spiralcore {
|
||||||
|
|
||||||
class audio_device {
|
class audio_device {
|
||||||
public:
|
public:
|
||||||
audio_device(const string &clientname, u32 samplerate, u32 buffer_size);
|
audio_device(const string &clientname, u32 samplerate, u32 buffer_size);
|
||||||
|
|
||||||
void connect(const string &output_device, const string &clientname, u32 samplerate, u32 buffer_size);
|
void start_graph(graph *graph);
|
||||||
|
|
||||||
void start_recording(std::string filename);
|
void start_recording(std::string filename);
|
||||||
void stop_recording();
|
void stop_recording();
|
||||||
|
|
@ -42,15 +42,15 @@ namespace spiralcore {
|
||||||
|
|
||||||
portaudio_client m_client;
|
portaudio_client m_client;
|
||||||
|
|
||||||
void save_sample(const std::string &filename, const sample s);
|
static void save_sample(const std::string &filename, const sample s);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_recording;
|
bool m_recording;
|
||||||
std::string m_record_filename;
|
std::string m_record_filename;
|
||||||
sample m_record_buffer_left;
|
sample m_record_buffer_left;
|
||||||
sample m_record_buffer_right;
|
sample m_record_buffer_right;
|
||||||
u32 m_record_counter;
|
u32 m_record_counter;
|
||||||
u32 m_samplerate;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#ifndef COMMAND_RING_BUFFER
|
#ifndef COMMAND_RING_BUFFER
|
||||||
#define COMMAND_RING_BUFFER
|
#define COMMAND_RING_BUFFER
|
||||||
|
|
||||||
static const unsigned int COMMAND_DATA_SIZE = 1024;
|
static const unsigned int COMMAND_DATA_SIZE = 128;
|
||||||
|
|
||||||
class command_ring_buffer : public ring_buffer
|
class command_ring_buffer : public ring_buffer
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,16 +19,15 @@
|
||||||
|
|
||||||
#include "portaudio_client.h"
|
#include "portaudio_client.h"
|
||||||
|
|
||||||
|
bool portaudio_client::m_attached = false;
|
||||||
long unsigned int portaudio_client::m_buffer_size = 0;
|
long unsigned int portaudio_client::m_buffer_size = 0;
|
||||||
bool portaudio_client::m_initialised = false;
|
long unsigned int portaudio_client::m_sample_rate = 44100;
|
||||||
int portaudio_client::m_attached_device = -1;
|
|
||||||
void (*portaudio_client::run_callback)(void*, unsigned int buf_size)=NULL;
|
void (*portaudio_client::run_callback)(void*, unsigned int buf_size)=NULL;
|
||||||
void *portaudio_client::run_context = NULL;
|
void *portaudio_client::run_context = NULL;
|
||||||
const float *portaudio_client::m_right_data=NULL;
|
const float *portaudio_client::m_right_data=NULL;
|
||||||
const float *portaudio_client::m_left_data=NULL;
|
const float *portaudio_client::m_left_data=NULL;
|
||||||
float *portaudio_client::m_right_in_data=NULL;
|
float *portaudio_client::m_right_in_data=NULL;
|
||||||
float *portaudio_client::m_left_in_data=NULL;
|
float *portaudio_client::m_left_in_data=NULL;
|
||||||
PaStream *portaudio_client::m_stream=NULL;
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
@ -41,103 +40,55 @@ portaudio_client::~portaudio_client() {
|
||||||
detach();
|
detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool portaudio_client::init() {
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
m_initialised=false;
|
|
||||||
if (!m_initialised) {
|
bool portaudio_client::attach(const string &client_name, const device_options &dopt) {
|
||||||
|
if (m_attached) return true;
|
||||||
|
|
||||||
PaError err;
|
PaError err;
|
||||||
err = Pa_Initialize();
|
err = Pa_Initialize();
|
||||||
if( err != paNoError ) {
|
if( err != paNoError ) {
|
||||||
|
cerr<<"could not init portaudio_client"<<endl;
|
||||||
Pa_Terminate();
|
Pa_Terminate();
|
||||||
m_status="error initialising portaudio: "+string(Pa_GetErrorText(err))+"\n";
|
fprintf( stderr, "an error occured while using the portaudio stream\n" );
|
||||||
return false;
|
fprintf( stderr, "error number: %d\n", err );
|
||||||
|
fprintf( stderr, "error message: %s\n", Pa_GetErrorText( err ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// load all the devices we have
|
PaDeviceIndex output_device_num = Pa_GetDefaultOutputDevice();
|
||||||
PaDeviceIndex default_output_num = Pa_GetDefaultOutputDevice();
|
PaDeviceIndex input_device_num = Pa_GetDefaultInputDevice();
|
||||||
PaDeviceIndex default_input_num = Pa_GetDefaultInputDevice();
|
|
||||||
|
|
||||||
m_devices.clear();
|
|
||||||
// get all devices we have available
|
|
||||||
int numDevices = Pa_GetDeviceCount();
|
|
||||||
if(numDevices <= 0) {
|
|
||||||
m_status="portaudio error: no audio devices found";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const PaDeviceInfo *deviceInfo;
|
|
||||||
|
|
||||||
for(int i=0; i<numDevices; i++) {
|
|
||||||
deviceInfo = Pa_GetDeviceInfo(i);
|
|
||||||
if (deviceInfo->maxOutputChannels>=2) {
|
|
||||||
device_desc desc;
|
|
||||||
desc.name = deviceInfo->name;
|
|
||||||
desc.id = i;
|
|
||||||
desc.default_input = i==default_input_num;
|
|
||||||
desc.default_output = i==default_output_num;
|
|
||||||
m_devices.push_back(desc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_initialised=true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int portaudio_client::device_name_to_id(const string &name) {
|
|
||||||
for (auto &d:m_devices) {
|
|
||||||
if (d.name==name) return d.id;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bool portaudio_client::attach(const string &requested_output_device, const string &client_name, const device_options &dopt) {
|
|
||||||
if (!init()) return false;
|
|
||||||
detach();
|
|
||||||
|
|
||||||
int requested_output_id = device_name_to_id(requested_output_device);
|
|
||||||
|
|
||||||
PaStreamParameters output_parameters;
|
PaStreamParameters output_parameters;
|
||||||
if (requested_output_device=="" || requested_output_id==-1) {
|
output_parameters.device = output_device_num;
|
||||||
// start up by connecting to the default one
|
if (output_parameters.device == paNoDevice) {
|
||||||
PaDeviceIndex default_output_num = Pa_GetDefaultOutputDevice();
|
cerr<<"error: no default output device."<<endl;
|
||||||
if (default_output_num == paNoDevice) {
|
|
||||||
m_status="error: no default output device.";
|
|
||||||
return false;
|
|
||||||
} else {
|
} else {
|
||||||
output_parameters.device = default_output_num;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
output_parameters.device = requested_output_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
output_parameters.channelCount = 2; /* stereo output */
|
output_parameters.channelCount = 2; /* stereo output */
|
||||||
output_parameters.sampleFormat = paFloat32; /* 32 bit floating point output */
|
output_parameters.sampleFormat = paFloat32; /* 32 bit floating point output */
|
||||||
output_parameters.suggestedLatency = Pa_GetDeviceInfo( output_parameters.device )->defaultLowOutputLatency;
|
output_parameters.suggestedLatency = Pa_GetDeviceInfo( output_parameters.device )->defaultLowOutputLatency;
|
||||||
output_parameters.hostApiSpecificStreamInfo = NULL;
|
output_parameters.hostApiSpecificStreamInfo = NULL;
|
||||||
m_status="connecting to "+string(Pa_GetDeviceInfo(output_parameters.device)->name)+" for output\n";
|
cerr<<"Connecting to "<<Pa_GetDeviceInfo( output_parameters.device )->name<<" for output"<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
// turn off input for the moment, it's causing
|
|
||||||
// too many cross platform security issues
|
|
||||||
|
|
||||||
/*PaStreamParameters input_parameters;
|
PaStreamParameters input_parameters;
|
||||||
PaStreamParameters *input_p=&input_parameters;
|
PaStreamParameters *input_p=&input_parameters;
|
||||||
input_parameters.device = input_device_num;
|
input_parameters.device = input_device_num;
|
||||||
if (true || input_parameters.device == paNoDevice) {
|
if (input_parameters.device == paNoDevice) {
|
||||||
cerr<<"error: no default input device."<<endl;
|
cerr<<"error: no default input device."<<endl;
|
||||||
input_p=0;
|
input_p=0;
|
||||||
} else {
|
} else {
|
||||||
input_parameters.channelCount = 2;
|
input_parameters.channelCount = 2; /* stereo output */
|
||||||
input_parameters.sampleFormat = paFloat32;
|
input_parameters.sampleFormat = paFloat32; /* 32 bit floating point output */
|
||||||
input_parameters.suggestedLatency = Pa_GetDeviceInfo( input_parameters.device )->defaultLowInputLatency;
|
input_parameters.suggestedLatency = Pa_GetDeviceInfo( input_parameters.device )->defaultLowInputLatency;
|
||||||
input_parameters.hostApiSpecificStreamInfo = NULL;
|
input_parameters.hostApiSpecificStreamInfo = NULL;
|
||||||
cerr<<"Connecting to "<<Pa_GetDeviceInfo( input_parameters.device )->name<<" for input"<<endl;
|
cerr<<"Connecting to "<<Pa_GetDeviceInfo( input_parameters.device )->name<<" for input"<<endl;
|
||||||
} */
|
}
|
||||||
|
|
||||||
PaError err = Pa_OpenStream(&m_stream,
|
PaStream *stream;
|
||||||
NULL,
|
|
||||||
|
err = Pa_OpenStream(&stream,
|
||||||
|
input_p,
|
||||||
&output_parameters,
|
&output_parameters,
|
||||||
dopt.samplerate,
|
dopt.samplerate,
|
||||||
dopt.buffer_size,
|
dopt.buffer_size,
|
||||||
|
|
@ -145,38 +96,31 @@ bool portaudio_client::attach(const string &requested_output_device, const strin
|
||||||
process,
|
process,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
m_attached_device=output_parameters.device;
|
|
||||||
|
|
||||||
if(err != paNoError) {
|
if(err != paNoError) {
|
||||||
m_status+="could not attach: "+string(Pa_GetErrorText(err))+"\n";
|
cerr<<"could not attach portaudio_client: "<<Pa_GetErrorText( err )<<endl;
|
||||||
detach();
|
Pa_Terminate();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = Pa_StartStream(m_stream);
|
err = Pa_StartStream(stream);
|
||||||
|
|
||||||
if(err != paNoError) {
|
if(err != paNoError) {
|
||||||
m_status+="could not start stream: "+string(Pa_GetErrorText(err))+"\n";
|
cerr<<"could not start stream: "<<Pa_GetErrorText( err )<<endl;
|
||||||
detach();
|
Pa_Terminate();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_status+="we are connected to portaudio!\n";
|
m_attached=true;
|
||||||
|
cerr<<"connected to portaudio..."<<endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void portaudio_client::detach() {
|
void portaudio_client::detach() {
|
||||||
if (m_attached_device!=-1) {
|
cerr<<"detaching from portaudio"<<endl;
|
||||||
if (m_stream!=NULL) {
|
|
||||||
Pa_CloseStream(m_stream);
|
|
||||||
}
|
|
||||||
m_stream=NULL;
|
|
||||||
m_status+="detaching from portaudio\n";
|
|
||||||
Pa_Terminate();
|
Pa_Terminate();
|
||||||
m_attached_device=-1;
|
m_attached=false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,9 @@ class portaudio_client
|
||||||
public:
|
public:
|
||||||
portaudio_client();
|
portaudio_client();
|
||||||
~portaudio_client();
|
~portaudio_client();
|
||||||
bool init();
|
|
||||||
|
|
||||||
class device_options {
|
class device_options
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
enum type {READ,WRITE,READWRITE};
|
enum type {READ,WRITE,READWRITE};
|
||||||
unsigned int buffer_size;
|
unsigned int buffer_size;
|
||||||
|
|
@ -42,25 +42,13 @@ class portaudio_client
|
||||||
unsigned int out_channels;
|
unsigned int out_channels;
|
||||||
};
|
};
|
||||||
|
|
||||||
class device_desc {
|
bool attach(const string &client_name, const device_options &dopt);
|
||||||
public:
|
|
||||||
string name;
|
|
||||||
int id;
|
|
||||||
bool default_input;
|
|
||||||
bool default_output;
|
|
||||||
};
|
|
||||||
|
|
||||||
vector<portaudio_client::device_desc> m_devices;
|
|
||||||
|
|
||||||
bool attach(const string &requested_output_device, const string &client_name, const device_options &dopt);
|
|
||||||
void detach();
|
void detach();
|
||||||
bool is_attached() { return m_attached_device!=-1; }
|
bool is_attached() { return m_attached; }
|
||||||
void set_callback(void(*run)(void*, unsigned int),void *context) { run_callback=run; run_context=context; }
|
void set_callback(void(*run)(void*, unsigned int),void *context) { run_callback=run; run_context=context; }
|
||||||
void set_outputs(const float *l, const float *r) { m_left_data=l; m_right_data=r; }
|
void set_outputs(const float *l, const float *r) { m_left_data=l; m_right_data=r; }
|
||||||
void set_inputs(float *l, float *r) { m_left_in_data=l; m_right_in_data=r; }
|
void set_inputs(float *l, float *r) { m_left_in_data=l; m_right_in_data=r; }
|
||||||
|
|
||||||
string m_status;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
static int process(const void *input_buffer, void *output_buffer,
|
static int process(const void *input_buffer, void *output_buffer,
|
||||||
|
|
@ -71,11 +59,9 @@ class portaudio_client
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int device_name_to_id(const string &name);
|
|
||||||
|
|
||||||
static long unsigned int m_buffer_size;
|
static long unsigned int m_buffer_size;
|
||||||
static bool m_initialised;
|
static long unsigned int m_sample_rate;
|
||||||
static int m_attached_device;
|
static bool m_attached;
|
||||||
|
|
||||||
static const float *m_right_data;
|
static const float *m_right_data;
|
||||||
static const float *m_left_data;
|
static const float *m_left_data;
|
||||||
|
|
@ -84,8 +70,6 @@ class portaudio_client
|
||||||
|
|
||||||
static void(*run_callback)(void *, unsigned int);
|
static void(*run_callback)(void *, unsigned int);
|
||||||
static void *run_context;
|
static void *run_context;
|
||||||
static PaStream *m_stream;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,6 @@ using namespace std;
|
||||||
|
|
||||||
lo_address status::m_address = lo_address_new_from_url("osc.udp://localhost:8890");
|
lo_address status::m_address = lo_address_new_from_url("osc.udp://localhost:8890");
|
||||||
|
|
||||||
void status::set_port(const std::string &port) {
|
|
||||||
status::m_address = lo_address_new_from_url(string("osc.udp://localhost:"+port).c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void status::_update(const std::string &msg) {
|
void status::_update(const std::string &msg) {
|
||||||
lo_send(m_address,"/report","s",msg.c_str());
|
lo_send(m_address,"/report","s",msg.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,10 @@ namespace spiralcore {
|
||||||
|
|
||||||
class status {
|
class status {
|
||||||
public:
|
public:
|
||||||
static void set_port(const std::string &port);
|
|
||||||
static void _update(const std::string &msg);
|
static void _update(const std::string &msg);
|
||||||
static void update(const char *msg, ...);
|
static void update(const char *msg, ...);
|
||||||
static void sound_item(const std::string &name, const std::string &colour);
|
static void sound_item(const std::string &name, const std::string &colour);
|
||||||
static void sound_item_refresh();
|
static void sound_item_refresh();
|
||||||
static void add_audio_device(int id, const std::string &name, bool default_output);
|
|
||||||
static void audio_device_status(const std::string &status);
|
|
||||||
static lo_address m_address;
|
static lo_address m_address;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
# Flatpak Build Instructions
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
To build the Flatpak, install the `flatpak` and `flatpak-builder` packages
|
|
||||||
from your repositories. Then, [add Flathub](https://flatpak.org/setup/).
|
|
||||||
|
|
||||||
Now, install the KDE SDK:
|
|
||||||
```sh
|
|
||||||
flatpak install flathub org.kde.Sdk//5.15-22.08
|
|
||||||
```
|
|
||||||
|
|
||||||
## Building and installing
|
|
||||||
To build and install the app locally:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
flatpak-builder --force-clean --install --user builddir build-aux/flatpak/org.thentrythis.Samplebrain.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
## Building and exporting
|
|
||||||
To build and export a Flatpak bundle:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
flatpak-builder --force-clean --repo=repo builddir build-aux/flatpak/org.thentrythis.Samplebrain.yaml
|
|
||||||
flatpak build-bundle repo org.thentrythis.Samplebrain.flatpak org.thentrythis.Samplebrain
|
|
||||||
```
|
|
||||||
|
|
||||||
To install the bundle:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
flatpak install org.thentrythis.Samplebrain.flatpak
|
|
||||||
```
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
id: org.thentrythis.Samplebrain
|
|
||||||
runtime: org.kde.Platform
|
|
||||||
runtime-version: "5.15-22.08"
|
|
||||||
sdk: org.kde.Sdk
|
|
||||||
|
|
||||||
rename-desktop-file: samplebrain.desktop
|
|
||||||
rename-icon: samplebrain
|
|
||||||
|
|
||||||
command: samplebrain
|
|
||||||
|
|
||||||
finish-args:
|
|
||||||
- "--share=ipc"
|
|
||||||
- "--socket=wayland"
|
|
||||||
- "--socket=fallback-x11"
|
|
||||||
- "--socket=pulseaudio"
|
|
||||||
- "--device=dri"
|
|
||||||
- "--share=network"
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
- "/include"
|
|
||||||
- "/lib/cmake"
|
|
||||||
- "/lib/pkgconfig"
|
|
||||||
- "/share/doc"
|
|
||||||
|
|
||||||
modules:
|
|
||||||
- name: libsndfile
|
|
||||||
buildsystem: cmake-ninja
|
|
||||||
config-opts:
|
|
||||||
- "-DCMAKE_BUILD_TYPE=Release"
|
|
||||||
- "-DBUILD_SHARED_LIBS=ON"
|
|
||||||
- "-DENABLE_EXTERNAL_LIBS=NO"
|
|
||||||
- "-DENABLE_CPACK=NO"
|
|
||||||
- "-DBUILD_PROGRAMS=OFF"
|
|
||||||
- "-DBUILD_EXAMPLES=OFF"
|
|
||||||
sources:
|
|
||||||
- type: archive
|
|
||||||
url: https://github.com/libsndfile/libsndfile/releases/download/1.1.0/libsndfile-1.1.0.tar.xz
|
|
||||||
sha256: 0f98e101c0f7c850a71225fb5feaf33b106227b3d331333ddc9bacee190bcf41
|
|
||||||
|
|
||||||
- name: portaudio
|
|
||||||
buildsystem: autotools
|
|
||||||
config-opts:
|
|
||||||
- "--with-alsa"
|
|
||||||
- "--without-jack"
|
|
||||||
- "--without-oss"
|
|
||||||
- "--without-asihpi"
|
|
||||||
sources:
|
|
||||||
- type: archive
|
|
||||||
url: http://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz
|
|
||||||
sha256: 47efbf42c77c19a05d22e627d42873e991ec0c1357219c0d74ce6a2948cb2def
|
|
||||||
|
|
||||||
- name: liblo
|
|
||||||
buildsystem: autotools
|
|
||||||
config-opts:
|
|
||||||
- "--disable-tests"
|
|
||||||
- "--disable-network-tests"
|
|
||||||
- "--disable-tools"
|
|
||||||
- "--disable-examples"
|
|
||||||
sources:
|
|
||||||
- type: archive
|
|
||||||
url: https://versaweb.dl.sourceforge.net/project/liblo/liblo/0.31/liblo-0.31.tar.gz
|
|
||||||
sha256: 2b4f446e1220dcd624ecd8405248b08b7601e9a0d87a0b94730c2907dbccc750
|
|
||||||
|
|
||||||
- name: samplebrain
|
|
||||||
buildsystem: qmake
|
|
||||||
build-options:
|
|
||||||
env:
|
|
||||||
PREFIX: /app
|
|
||||||
config-opts:
|
|
||||||
- "LIBS+=-L/app/lib"
|
|
||||||
sources:
|
|
||||||
- type: dir
|
|
||||||
path: ../../
|
|
||||||
71
building.md
71
building.md
|
|
@ -1,71 +0,0 @@
|
||||||
# Building from source
|
|
||||||
## Linux (Ubuntu)
|
|
||||||
Install cmake:
|
|
||||||
|
|
||||||
$ sudo apt install cmake
|
|
||||||
|
|
||||||
Install dependencies for the interface:
|
|
||||||
|
|
||||||
$ sudo apt install build-essential qtcreator qt5-default
|
|
||||||
|
|
||||||
On ubuntu 22.04 it's:
|
|
||||||
|
|
||||||
$ apt install build-essential qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
|
|
||||||
|
|
||||||
Build & run it:
|
|
||||||
|
|
||||||
$ mkdir build
|
|
||||||
$ cd build
|
|
||||||
$ cmake ..
|
|
||||||
$ cmake --build .
|
|
||||||
$ ./samplebrain
|
|
||||||
|
|
||||||
## Mac
|
|
||||||
Install cmake:
|
|
||||||
|
|
||||||
$ brew install cmake
|
|
||||||
|
|
||||||
Install dependencies for the interface:
|
|
||||||
|
|
||||||
$ brew install qt
|
|
||||||
$ brew link qt
|
|
||||||
|
|
||||||
Build & run it:
|
|
||||||
|
|
||||||
$ mkdir build
|
|
||||||
$ cd build
|
|
||||||
$ cmake ..
|
|
||||||
$ cmake --build .
|
|
||||||
|
|
||||||
`samplebrain.app` should then be in the build folder for you to run.
|
|
||||||
|
|
||||||
# Mac build additions
|
|
||||||
|
|
||||||
To make a mac app bundle:
|
|
||||||
|
|
||||||
Run `macdeployqt` which copies all dependencies inside the app.
|
|
||||||
|
|
||||||
$ cd build
|
|
||||||
$ macdeployqt
|
|
||||||
|
|
||||||
If the icon is not visible, you might need to copy desktop/samplebrain.icns (the icon) to the Resources directory in the app bundle.
|
|
||||||
|
|
||||||
$ cp ../desktop/samplebrain.icns samplebrain.app/Contents/Resources
|
|
||||||
|
|
||||||
Then edit Info.plist to add samplebrain.icns to CFBundleIconFile. Key `CFBundleIconFile` should match:
|
|
||||||
|
|
||||||
<key>CFBundleIconFile</key>
|
|
||||||
<string>samplebrain.icns</string>
|
|
||||||
|
|
||||||
You might also need to resign the app bundle after making any changes
|
|
||||||
|
|
||||||
$ codesign --force --deep --sign - samplebrain.app
|
|
||||||
|
|
||||||
# Windows (Work in progress)
|
|
||||||
|
|
||||||
* Install [MSYS2](https://www.msys2.org/)
|
|
||||||
* Install dependances via pacman
|
|
||||||
* Build with qmake as usual
|
|
||||||
* Run `windeployqt` and copy missing .dll files into release directory
|
|
||||||
|
|
||||||
|
|
||||||
36
changelog.md
36
changelog.md
|
|
@ -1,36 +0,0 @@
|
||||||
# Changlog
|
|
||||||
|
|
||||||
0.18.4
|
|
||||||
|
|
||||||
* **Windows**: [samplebrain_0.18.4_win.zip](https://static.thentrythis.org/samplebrain/samplebrain_0.18.4_win.zip)
|
|
||||||
* **Mac (intel/m1)**: [samplebrain_0.18.4_macintel.zip](https://static.thentrythis.org/samplebrain/samplebrain_0.18.4_macintel.app.zip)
|
|
||||||
|
|
||||||
Changes in 0.18.4: New audio device settings window and updated
|
|
||||||
windows build. Better default block size, tool tip tweaks and fixes
|
|
||||||
for dark themes by [Claude Heiland-Allen](https://mathr.co.uk/).
|
|
||||||
|
|
||||||
0.18.3
|
|
||||||
|
|
||||||
* **Windows**: [samplebrain_0.18.3_win.zip](https://static.thentrythis.org/samplebrain/samplebrain_0.18.3_win.zip)
|
|
||||||
* **Mac (intel/m1)**: [samplebrain_0.18.3_macintel.zip](https://static.thentrythis.org/samplebrain/samplebrain_0.18.3_macintel.app.zip)
|
|
||||||
|
|
||||||
Changes: Release fixes loading samples from paths longer than 255 characters
|
|
||||||
|
|
||||||
0.18.2
|
|
||||||
|
|
||||||
* **Windows**: [samplebrain_0.18.2_win.zip](https://static.thentrythis.org/samplebrain/samplebrain_0.18.2_win.zip)
|
|
||||||
|
|
||||||
Changes: Crash fix when closing load session file dialog
|
|
||||||
|
|
||||||
0.18.1
|
|
||||||
|
|
||||||
* **Windows**: [samplebrain_0.18.1_win.zip](https://static.thentrythis.org/samplebrain/samplebrain_0.18.1_win.zip)
|
|
||||||
* **Mac (intel/m1)**: [samplebrain_0.18.1_macintel.zip](https://static.thentrythis.org/samplebrain/samplebrain_0.18.1_macintel.app.zip)
|
|
||||||
|
|
||||||
Changes: Turned off microphone input to prevent security problems
|
|
||||||
|
|
||||||
0.18 (initial release)
|
|
||||||
|
|
||||||
* **Windows**: [samplebrain_0.18_win.zip](https://static.thentrythis.org/samplebrain/samplebrain_0.18_win.zip)
|
|
||||||
* **Mac (intel)**: [samplebrain_0.18_macintel.zip](https://static.thentrythis.org/samplebrain/samplebrain_0.18_macintel.zip)
|
|
||||||
* **Mac (m1)**: [samplebrain_0.18_m1_v2.dmg](https://static.thentrythis.org/samplebrain/samplebrain_0.18_m1_v2.dmg)
|
|
||||||
|
|
@ -1,11 +1,6 @@
|
||||||
samplebrain (0.18.5rc1-1ubuntu0~bionic1) bionic; urgency=medium
|
samplebrain (0.18rc2-1ubuntu0~bionic4) bionic; urgency=medium
|
||||||
|
|
||||||
* Target sound filename shown (and tells you if you don't have one)
|
* Initial release
|
||||||
* More soundfile formats supported (aiff,aifc,au,snd,fasttracker xi,flac)
|
|
||||||
* New configurable OSC ports in settings
|
|
||||||
* Warning boxes if the OSC network connection fails
|
|
||||||
* File path memory per-dialog rather than global
|
|
||||||
|
|
||||||
-- Dave Griffiths <dave@thentrythis.org> Thu, 29 Oct 2022 08:47:10 +0100
|
|
||||||
|
|
||||||
|
-- Dave Griffiths <dave@thentrythis.org> Thu, 08 Sep 2022 13:08:26 +0100
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<component type="desktop-application">
|
|
||||||
<id>org.thentrythis.Samplebrain</id>
|
|
||||||
|
|
||||||
<name>Samplebrain</name>
|
|
||||||
<summary>A custom sample mashing app designed by Aphex Twin</summary>
|
|
||||||
|
|
||||||
<metadata_license>CC0-1.0</metadata_license>
|
|
||||||
<project_license>GPL-2.0-only</project_license>
|
|
||||||
|
|
||||||
<description>
|
|
||||||
<p>
|
|
||||||
Samplebrain chops samples up into a 'brain' of interconnected small sections called blocks which are connected into a network by similarity. It processes a target sample, chopping it up into blocks in the same way, and tries to match each block with one in it's brain to play in realtime.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
This allows you to interpret a sound with a different one. As we worked on it (during 2015 and 2016) we gradually added more and more tweakable parameters until it became slightly out of control.
|
|
||||||
</p>
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<launchable type="desktop-id">samplebrain.desktop</launchable>
|
|
||||||
|
|
||||||
<categories>
|
|
||||||
<category>AudioVideo</category>
|
|
||||||
<category>Music</category>
|
|
||||||
</categories>
|
|
||||||
|
|
||||||
<content_rating type="oars-1.0"></content_rating>
|
|
||||||
|
|
||||||
<url type="homepage">https://thentrythis.org/projects/samplebrain/</url>
|
|
||||||
<url type="bugtracker">https://gitlab.com/then-try-this/samplebrain/-/issues</url>
|
|
||||||
<url type="vcs-browser">https://gitlab.com/then-try-this/samplebrain</url>
|
|
||||||
|
|
||||||
<screenshots>
|
|
||||||
<screenshot type="default">
|
|
||||||
<image type="source" width="1280" height="720">https://gitlab.com/then-try-this/samplebrain/-/raw/main/desktop/screenshots/01-main-with-project.png</image>
|
|
||||||
</screenshot>
|
|
||||||
</screenshots>
|
|
||||||
|
|
||||||
<releases>
|
|
||||||
<release version="0.18" date="2022-09-22"/>
|
|
||||||
</releases>
|
|
||||||
</component>
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
Type=Application
|
Type=Application
|
||||||
Name=Samplebrain
|
Name=Samplebrain
|
||||||
Comment=A custom sample mashing app designed by Aphex Twin
|
Comment=A sample masher designed by Aphex Twin
|
||||||
Icon=samplebrain
|
Exec=/usr/bin/samplebrain
|
||||||
Exec=samplebrain
|
Icon=/usr/share/icons/hicolor/scalable/apps/samplebrain.svg
|
||||||
Categories=AudioVideo;Music
|
Terminal=false
|
||||||
|
Categories=GNOME;Application;
|
||||||
StartupNotify=true
|
StartupNotify=true
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Version=1.0
|
||||||
|
Name=Samplebrain
|
||||||
|
GenericName="Samplebrain"
|
||||||
|
Exec=samplebrain
|
||||||
|
Icon=samplebrain
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 113 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>FormSample</class>
|
||||||
|
<widget class="QWidget" name="FormSample">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>46</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Comic Sans MS</family>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>active</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelSampleName">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Comic Sans MS</family>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelSampleInfo">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Comic Sans MS</family>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Comic Sans MS</family>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>delete</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
|
|
@ -7,11 +7,11 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1188</width>
|
<width>1188</width>
|
||||||
<height>939</height>
|
<height>898</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>samplebrain 0.18.5</string>
|
<string>samplebrain 0.18</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
|
@ -96,9 +96,6 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string>plain fft match vs mfcc values </string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -159,9 +156,6 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string>match original or normalised blocks</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -304,9 +298,6 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string>use new blocks rather than similar ones</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -370,9 +361,6 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string>how long it takes for the novelty to wear off</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -415,7 +403,7 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>likelihood of playing the next block rather than the closest</string>
|
<string>how long it takes for the novelty to wear off</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>100</number>
|
<number>100</number>
|
||||||
|
|
@ -436,9 +424,6 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string>likelihood of playing the next block rather than the closest</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -506,7 +491,7 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>repeat search (set novelty to 0 for dodgy jungle timessssstretch)</string>
|
<string>how many connections to search (ordered in closeness)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
|
|
@ -681,7 +666,7 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>block difference higher than this causes a new search, skipping the target</string>
|
<string>how many connections to search (ordered in closeness)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>10000</number>
|
<number>10000</number>
|
||||||
|
|
@ -728,13 +713,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labelTargetSound">
|
|
||||||
<property name="text">
|
|
||||||
<string>no target sound loaded</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButtonLoadTarget">
|
<widget class="QPushButton" name="pushButtonLoadTarget">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
|
@ -774,7 +752,7 @@
|
||||||
<number>99999</number>
|
<number>99999</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>1000</number>
|
<number>3000</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
@ -805,7 +783,7 @@
|
||||||
<double>0.010000000000000</double>
|
<double>0.010000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<double>0.750000000000000</double>
|
<double>0.800000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
@ -889,22 +867,14 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="mic">
|
<widget class="QCheckBox" name="mic">
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Comic Sans MS</family>
|
<family>Comic Sans MS</family>
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>use mic input</string>
|
<string>use mic input</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
@ -966,9 +936,6 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string>amount to match the frequency</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -1026,9 +993,6 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string>mix in the normalised blocks</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -1089,9 +1053,6 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string>mix in the original blocks</string>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -1119,8 +1080,8 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>17</width>
|
<width>20</width>
|
||||||
<height>13</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
|
|
@ -1267,7 +1228,7 @@
|
||||||
<number>99999</number>
|
<number>99999</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>1000</number>
|
<number>3000</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
@ -1298,7 +1259,7 @@
|
||||||
<double>0.010000000000000</double>
|
<double>0.010000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<double>0.750000000000000</double>
|
<double>0.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
@ -1473,7 +1434,7 @@
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../samplebrain.qrc">
|
<iconset resource="../app/samplebrain.qrc">
|
||||||
<normaloff>:/images/images/play.png</normaloff>:/images/images/play.png</iconset>
|
<normaloff>:/images/images/play.png</normaloff>:/images/images/play.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
|
@ -1500,7 +1461,7 @@
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../samplebrain.qrc">
|
<iconset resource="../app/samplebrain.qrc">
|
||||||
<normaloff>:/images/images/pause.png</normaloff>:/images/images/pause.png</iconset>
|
<normaloff>:/images/images/pause.png</normaloff>:/images/images/pause.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
|
@ -1520,7 +1481,7 @@
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../samplebrain.qrc">
|
<iconset resource="../app/samplebrain.qrc">
|
||||||
<normaloff>:/images/images/record.png</normaloff>:/images/images/record.png</iconset>
|
<normaloff>:/images/images/record.png</normaloff>:/images/images/record.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
|
@ -1540,7 +1501,7 @@
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../samplebrain.qrc">
|
<iconset resource="../app/samplebrain.qrc">
|
||||||
<normaloff>:/images/images/stop.png</normaloff>:/images/images/stop.png</iconset>
|
<normaloff>:/images/images/stop.png</normaloff>:/images/images/stop.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
|
|
@ -1593,33 +1554,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Comic Sans MS</family>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../samplebrain.qrc">
|
|
||||||
<normaloff>:/images/images/settings.png</normaloff>:/images/images/settings.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>32</width>
|
|
||||||
<height>32</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
@ -1639,7 +1573,7 @@
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="pixmap">
|
<property name="pixmap">
|
||||||
<pixmap resource="../samplebrain.qrc">:/images/images/at.png</pixmap>
|
<pixmap resource="../app/samplebrain.qrc">:/images/images/at.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
@ -1650,8 +1584,9 @@
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
<widget class="QStatusBar" name="statusbar"/>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../samplebrain.qrc"/>
|
<include location="../app/samplebrain.qrc"/>
|
||||||
<include location="../samplebrain.qrc"/>
|
<include location="../app/samplebrain.qrc"/>
|
||||||
|
<include location="../app/samplebrain.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
|
|
@ -1661,8 +1596,8 @@
|
||||||
<slot>play_slot()</slot>
|
<slot>play_slot()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>78</x>
|
<x>64</x>
|
||||||
<y>830</y>
|
<y>62</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>399</x>
|
<x>399</x>
|
||||||
|
|
@ -1677,8 +1612,8 @@
|
||||||
<slot>stop_slot()</slot>
|
<slot>stop_slot()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>180</x>
|
<x>155</x>
|
||||||
<y>830</y>
|
<y>62</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>399</x>
|
<x>399</x>
|
||||||
|
|
@ -1693,8 +1628,8 @@
|
||||||
<slot>volume_slot(int)</slot>
|
<slot>volume_slot(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>465</x>
|
<x>189</x>
|
||||||
<y>852</y>
|
<y>480</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>361</x>
|
<x>361</x>
|
||||||
|
|
@ -1709,8 +1644,8 @@
|
||||||
<slot>stop_record()</slot>
|
<slot>stop_record()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>356</x>
|
<x>328</x>
|
||||||
<y>840</y>
|
<y>543</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>361</x>
|
<x>361</x>
|
||||||
|
|
@ -1725,8 +1660,8 @@
|
||||||
<slot>record()</slot>
|
<slot>record()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>268</x>
|
<x>236</x>
|
||||||
<y>840</y>
|
<y>543</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>361</x>
|
<x>361</x>
|
||||||
|
|
@ -1741,8 +1676,8 @@
|
||||||
<slot>fft1_end_slot(int)</slot>
|
<slot>fft1_end_slot(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>421</x>
|
<x>154</x>
|
||||||
<y>293</y>
|
<y>310</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>399</x>
|
<x>399</x>
|
||||||
|
|
@ -1757,8 +1692,8 @@
|
||||||
<slot>ratio_slot(double)</slot>
|
<slot>ratio_slot(double)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>421</x>
|
<x>109</x>
|
||||||
<y>185</y>
|
<y>223</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>399</x>
|
<x>399</x>
|
||||||
|
|
@ -1773,12 +1708,12 @@
|
||||||
<slot>setValue(int)</slot>
|
<slot>setValue(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>319</x>
|
<x>237</x>
|
||||||
<y>603</y>
|
<y>289</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>421</x>
|
<x>341</x>
|
||||||
<y>614</y>
|
<y>289</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
|
@ -1789,8 +1724,8 @@
|
||||||
<slot>target_mix_slot(double)</slot>
|
<slot>target_mix_slot(double)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>720</x>
|
<x>330</x>
|
||||||
<y>669</y>
|
<y>446</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>361</x>
|
<x>361</x>
|
||||||
|
|
@ -1805,8 +1740,8 @@
|
||||||
<slot>generate_target_blocks()</slot>
|
<slot>generate_target_blocks()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>670</x>
|
<x>277</x>
|
||||||
<y>395</y>
|
<y>202</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>399</x>
|
<x>399</x>
|
||||||
|
|
@ -1821,8 +1756,8 @@
|
||||||
<slot>target_block_size(int)</slot>
|
<slot>target_block_size(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>720</x>
|
<x>313</x>
|
||||||
<y>237</y>
|
<y>136</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>399</x>
|
<x>399</x>
|
||||||
|
|
@ -1837,8 +1772,8 @@
|
||||||
<slot>load_target()</slot>
|
<slot>load_target()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>670</x>
|
<x>277</x>
|
||||||
<y>184</y>
|
<y>103</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>399</x>
|
<x>399</x>
|
||||||
|
|
@ -1853,8 +1788,8 @@
|
||||||
<slot>fft1_start_slot(int)</slot>
|
<slot>fft1_start_slot(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>298</x>
|
<x>154</x>
|
||||||
<y>293</y>
|
<y>277</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>399</x>
|
<x>399</x>
|
||||||
|
|
@ -1869,8 +1804,8 @@
|
||||||
<slot>target_block_overlap(double)</slot>
|
<slot>target_block_overlap(double)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>720</x>
|
<x>619</x>
|
||||||
<y>291</y>
|
<y>196</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>361</x>
|
<x>361</x>
|
||||||
|
|
@ -1885,12 +1820,12 @@
|
||||||
<slot>setValue(int)</slot>
|
<slot>setValue(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>421</x>
|
<x>341</x>
|
||||||
<y>614</y>
|
<y>289</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>319</x>
|
<x>237</x>
|
||||||
<y>603</y>
|
<y>289</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
|
@ -1901,8 +1836,8 @@
|
||||||
<slot>synapses(int)</slot>
|
<slot>synapses(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>421</x>
|
<x>341</x>
|
||||||
<y>614</y>
|
<y>289</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>566</x>
|
<x>566</x>
|
||||||
|
|
@ -1917,8 +1852,8 @@
|
||||||
<slot>ratio_slot(int)</slot>
|
<slot>ratio_slot(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>323</x>
|
<x>189</x>
|
||||||
<y>174</y>
|
<y>141</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>361</x>
|
<x>361</x>
|
||||||
|
|
@ -1933,8 +1868,8 @@
|
||||||
<slot>n_ratio_slot(int)</slot>
|
<slot>n_ratio_slot(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>323</x>
|
<x>159</x>
|
||||||
<y>228</y>
|
<y>211</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>361</x>
|
<x>361</x>
|
||||||
|
|
@ -1949,8 +1884,8 @@
|
||||||
<slot>n_ratio_slot(double)</slot>
|
<slot>n_ratio_slot(double)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>421</x>
|
<x>330</x>
|
||||||
<y>239</y>
|
<y>211</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>361</x>
|
<x>361</x>
|
||||||
|
|
@ -1965,8 +1900,8 @@
|
||||||
<slot>target_mix_slot(int)</slot>
|
<slot>target_mix_slot(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>622</x>
|
<x>159</x>
|
||||||
<y>658</y>
|
<y>446</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>361</x>
|
<x>361</x>
|
||||||
|
|
@ -1981,8 +1916,8 @@
|
||||||
<slot>n_mix_slot(int)</slot>
|
<slot>n_mix_slot(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>622</x>
|
<x>159</x>
|
||||||
<y>604</y>
|
<y>386</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>361</x>
|
<x>361</x>
|
||||||
|
|
@ -1997,8 +1932,8 @@
|
||||||
<slot>n_mix_slot(double)</slot>
|
<slot>n_mix_slot(double)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>720</x>
|
<x>330</x>
|
||||||
<y>615</y>
|
<y>386</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>361</x>
|
<x>361</x>
|
||||||
|
|
@ -2013,8 +1948,8 @@
|
||||||
<slot>load_brain()</slot>
|
<slot>load_brain()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>941</x>
|
<x>615</x>
|
||||||
<y>661</y>
|
<y>357</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>566</x>
|
<x>566</x>
|
||||||
|
|
@ -2029,8 +1964,8 @@
|
||||||
<slot>boredom_slot(double)</slot>
|
<slot>boredom_slot(double)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>421</x>
|
<x>411</x>
|
||||||
<y>401</y>
|
<y>253</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>321</x>
|
<x>321</x>
|
||||||
|
|
@ -2045,8 +1980,8 @@
|
||||||
<slot>novelty_slot(double)</slot>
|
<slot>novelty_slot(double)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>421</x>
|
<x>411</x>
|
||||||
<y>347</y>
|
<y>217</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>321</x>
|
<x>321</x>
|
||||||
|
|
@ -2061,8 +1996,8 @@
|
||||||
<slot>novelty_slot(int)</slot>
|
<slot>novelty_slot(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>323</x>
|
<x>291</x>
|
||||||
<y>336</y>
|
<y>217</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>321</x>
|
<x>321</x>
|
||||||
|
|
@ -2077,8 +2012,8 @@
|
||||||
<slot>boredom_slot(int)</slot>
|
<slot>boredom_slot(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>323</x>
|
<x>291</x>
|
||||||
<y>390</y>
|
<y>253</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>321</x>
|
<x>321</x>
|
||||||
|
|
@ -2093,8 +2028,8 @@
|
||||||
<slot>synapses(int)</slot>
|
<slot>synapses(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>319</x>
|
<x>237</x>
|
||||||
<y>603</y>
|
<y>289</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>566</x>
|
<x>566</x>
|
||||||
|
|
@ -2109,8 +2044,8 @@
|
||||||
<slot>block_size(int)</slot>
|
<slot>block_size(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>1157</x>
|
<x>728</x>
|
||||||
<y>450</y>
|
<y>109</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>566</x>
|
<x>566</x>
|
||||||
|
|
@ -2125,8 +2060,8 @@
|
||||||
<slot>block_overlap(double)</slot>
|
<slot>block_overlap(double)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>1157</x>
|
<x>728</x>
|
||||||
<y>504</y>
|
<y>145</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>566</x>
|
<x>566</x>
|
||||||
|
|
@ -2141,8 +2076,8 @@
|
||||||
<slot>save_brain()</slot>
|
<slot>save_brain()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>1157</x>
|
<x>728</x>
|
||||||
<y>661</y>
|
<y>357</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>566</x>
|
<x>566</x>
|
||||||
|
|
@ -2157,8 +2092,8 @@
|
||||||
<slot>clear_brain()</slot>
|
<slot>clear_brain()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>1157</x>
|
<x>1061</x>
|
||||||
<y>396</y>
|
<y>550</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>566</x>
|
<x>566</x>
|
||||||
|
|
@ -2173,8 +2108,8 @@
|
||||||
<slot>generate()</slot>
|
<slot>generate()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>1158</x>
|
<x>671</x>
|
||||||
<y>608</y>
|
<y>322</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>566</x>
|
<x>566</x>
|
||||||
|
|
@ -2189,8 +2124,8 @@
|
||||||
<slot>load_sound()</slot>
|
<slot>load_sound()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>868</x>
|
<x>841</x>
|
||||||
<y>396</y>
|
<y>550</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>566</x>
|
<x>566</x>
|
||||||
|
|
@ -2205,12 +2140,12 @@
|
||||||
<slot>setValue(int)</slot>
|
<slot>setValue(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>346</x>
|
<x>241</x>
|
||||||
<y>498</y>
|
<y>282</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>421</x>
|
<x>343</x>
|
||||||
<y>509</y>
|
<y>282</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
|
@ -2221,12 +2156,12 @@
|
||||||
<slot>setValue(int)</slot>
|
<slot>setValue(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>421</x>
|
<x>343</x>
|
||||||
<y>509</y>
|
<y>282</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>346</x>
|
<x>241</x>
|
||||||
<y>498</y>
|
<y>282</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
|
@ -2237,8 +2172,8 @@
|
||||||
<slot>search_stretch(int)</slot>
|
<slot>search_stretch(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>346</x>
|
<x>241</x>
|
||||||
<y>498</y>
|
<y>282</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>566</x>
|
<x>566</x>
|
||||||
|
|
@ -2253,12 +2188,12 @@
|
||||||
<slot>setValue(int)</slot>
|
<slot>setValue(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>305</x>
|
<x>231</x>
|
||||||
<y>657</y>
|
<y>410</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>421</x>
|
<x>337</x>
|
||||||
<y>668</y>
|
<y>410</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
|
@ -2269,12 +2204,12 @@
|
||||||
<slot>setValue(int)</slot>
|
<slot>setValue(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>421</x>
|
<x>337</x>
|
||||||
<y>668</y>
|
<y>410</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>305</x>
|
<x>231</x>
|
||||||
<y>657</y>
|
<y>410</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
|
@ -2285,8 +2220,8 @@
|
||||||
<slot>slide_error(int)</slot>
|
<slot>slide_error(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>305</x>
|
<x>231</x>
|
||||||
<y>657</y>
|
<y>410</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>566</x>
|
<x>566</x>
|
||||||
|
|
@ -2301,8 +2236,8 @@
|
||||||
<slot>stickyness_slot(double)</slot>
|
<slot>stickyness_slot(double)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>421</x>
|
<x>385</x>
|
||||||
<y>455</y>
|
<y>296</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>609</x>
|
<x>609</x>
|
||||||
|
|
@ -2317,8 +2252,8 @@
|
||||||
<slot>stickyness_slot(int)</slot>
|
<slot>stickyness_slot(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>323</x>
|
<x>266</x>
|
||||||
<y>444</y>
|
<y>296</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>609</x>
|
<x>609</x>
|
||||||
|
|
@ -2333,8 +2268,8 @@
|
||||||
<slot>autotune(int)</slot>
|
<slot>autotune(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>622</x>
|
<x>531</x>
|
||||||
<y>550</y>
|
<y>477</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>454</x>
|
<x>454</x>
|
||||||
|
|
@ -2349,8 +2284,8 @@
|
||||||
<slot>autotune(double)</slot>
|
<slot>autotune(double)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>720</x>
|
<x>616</x>
|
||||||
<y>561</y>
|
<y>477</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>454</x>
|
<x>454</x>
|
||||||
|
|
@ -2365,8 +2300,8 @@
|
||||||
<slot>load_session()</slot>
|
<slot>load_session()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>616</x>
|
<x>535</x>
|
||||||
<y>799</y>
|
<y>707</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>454</x>
|
<x>454</x>
|
||||||
|
|
@ -2381,8 +2316,8 @@
|
||||||
<slot>save_session()</slot>
|
<slot>save_session()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>616</x>
|
<x>535</x>
|
||||||
<y>851</y>
|
<y>744</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>454</x>
|
<x>454</x>
|
||||||
|
|
@ -2397,8 +2332,8 @@
|
||||||
<slot>stereo_mode(bool)</slot>
|
<slot>stereo_mode(bool)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>721</x>
|
<x>539</x>
|
||||||
<y>717</y>
|
<y>594</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>454</x>
|
<x>454</x>
|
||||||
|
|
@ -2413,8 +2348,8 @@
|
||||||
<slot>algo(int)</slot>
|
<slot>algo(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>421</x>
|
<x>273</x>
|
||||||
<y>560</y>
|
<y>395</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>454</x>
|
<x>454</x>
|
||||||
|
|
@ -2429,8 +2364,8 @@
|
||||||
<slot>target_shape(int)</slot>
|
<slot>target_shape(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>720</x>
|
<x>557</x>
|
||||||
<y>342</y>
|
<y>233</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>454</x>
|
<x>454</x>
|
||||||
|
|
@ -2445,8 +2380,8 @@
|
||||||
<slot>brain_shape(int)</slot>
|
<slot>brain_shape(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>1157</x>
|
<x>824</x>
|
||||||
<y>555</y>
|
<y>432</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>454</x>
|
<x>454</x>
|
||||||
|
|
@ -2461,8 +2396,8 @@
|
||||||
<slot>load_sounds()</slot>
|
<slot>load_sounds()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>1013</x>
|
<x>754</x>
|
||||||
<y>396</y>
|
<y>321</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>454</x>
|
<x>454</x>
|
||||||
|
|
@ -2477,8 +2412,8 @@
|
||||||
<slot>select_all()</slot>
|
<slot>select_all()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>1073</x>
|
<x>813</x>
|
||||||
<y>124</y>
|
<y>74</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>454</x>
|
<x>454</x>
|
||||||
|
|
@ -2493,8 +2428,8 @@
|
||||||
<slot>select_none()</slot>
|
<slot>select_none()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>1157</x>
|
<x>862</x>
|
||||||
<y>124</y>
|
<y>74</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>454</x>
|
<x>454</x>
|
||||||
|
|
@ -2509,8 +2444,8 @@
|
||||||
<slot>mic(bool)</slot>
|
<slot>mic(bool)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>721</x>
|
<x>404</x>
|
||||||
<y>442</y>
|
<y>601</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>454</x>
|
<x>454</x>
|
||||||
|
|
@ -2518,22 +2453,6 @@
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
|
||||||
<sender>pushButton</sender>
|
|
||||||
<signal>clicked()</signal>
|
|
||||||
<receiver>MainWindow</receiver>
|
|
||||||
<slot>settings()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>680</x>
|
|
||||||
<y>809</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>776</x>
|
|
||||||
<y>849</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
</connections>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>play_slot()</slot>
|
<slot>play_slot()</slot>
|
||||||
|
|
@ -2591,6 +2510,5 @@
|
||||||
<slot>select_all()</slot>
|
<slot>select_all()</slot>
|
||||||
<slot>select_none()</slot>
|
<slot>select_none()</slot>
|
||||||
<slot>mic(bool)</slot>
|
<slot>mic(bool)</slot>
|
||||||
<slot>settings()</slot>
|
|
||||||
</slots>
|
</slots>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
######################################################################
|
||||||
|
# Automatically generated by qmake (2.01a) Sun Jul 5 17:49:45 2015
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
TEMPLATE = app
|
||||||
|
TARGET = samplebrain
|
||||||
|
DEPENDPATH += . 2
|
||||||
|
INCLUDEPATH += . 2
|
||||||
|
|
||||||
|
QT += core gui widgets
|
||||||
|
|
||||||
|
# Input
|
||||||
|
HEADERS += app/MainWindow.h \
|
||||||
|
app/generated/ui_samplebrain.h \
|
||||||
|
|
||||||
|
SOURCES += app/MainWindow.cpp \
|
||||||
|
app/sound_items.cpp \
|
||||||
|
app/audio_thread.cpp \
|
||||||
|
app/process_thread.cpp \
|
||||||
|
app/feedback.cpp \
|
||||||
|
app/qtmain.cpp \
|
||||||
|
brain/src/block.cpp \
|
||||||
|
brain/src/brain.cpp \
|
||||||
|
brain/src/fft.cpp \
|
||||||
|
brain/src/mfcc.cpp \
|
||||||
|
brain/src/renderer.cpp \
|
||||||
|
brain/src/search_params.cpp \
|
||||||
|
brain/src/status.cpp \
|
||||||
|
brain/src/window.cpp \
|
||||||
|
brain/src/block_stream.cpp \
|
||||||
|
brain/src/aquila/filter/MelFilterBank.cpp \
|
||||||
|
brain/src/aquila/filter/MelFilter.cpp \
|
||||||
|
brain/src/aquila/transform/Dct.cpp \
|
||||||
|
brain/src/spiralcore/sample.cpp \
|
||||||
|
brain/src/spiralcore/ring_buffer.cpp \
|
||||||
|
brain/src/spiralcore/command_ring_buffer.cpp \
|
||||||
|
brain/src/spiralcore/portaudio_client.cpp \
|
||||||
|
brain/src/spiralcore/audio.cpp \
|
||||||
|
brain/src/spiralcore/OSC_server.cpp \
|
||||||
|
brain/src/spiralcore/allocator.cpp \
|
||||||
|
brain/src/spiralcore/stream.cpp
|
||||||
|
|
||||||
|
INCLUDEPATH += brain/src
|
||||||
|
INCLUDEPATH += /usr/local/include
|
||||||
|
LIBS += -L.. -L/usr/local/lib -lportaudio -lfftw3 -lsndfile -llo -ldl -lpthread -lm
|
||||||
|
|
||||||
|
QMAKE_CXXFLAGS += -O3 -Wall -Wno-unused -std=c++11
|
||||||
|
|
||||||
|
# assets
|
||||||
|
RESOURCES = app/samplebrain.qrc
|
||||||
|
|
||||||
|
unix:desktopfile.path = /usr/share/applications/
|
||||||
|
unix:desktopfile.files = desktop/samplebrain.desktop
|
||||||
|
unix:iconfile.path = /usr/share/icons/hicolor/scalable/apps
|
||||||
|
unix:iconfile.files = desktop/samplebrain.svg
|
||||||
|
|
||||||
|
target.path = /usr/bin
|
||||||
|
INSTALLS += target desktopfile iconfile
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue