Compare commits
20 Commits
b5fd6dd3e0
...
1d03e9addd
| Author | SHA1 | Date |
|---|---|---|
|
|
1d03e9addd | |
|
|
af44ac43f0 | |
|
|
b971435101 | |
|
|
7bc12ac0be | |
|
|
8038fdd9c2 | |
|
|
bbdcd4b29c | |
|
|
385563e64e | |
|
|
e1c8e0ea67 | |
|
|
cf06a21160 | |
|
|
6471b1e066 | |
|
|
7d7a7d24a2 | |
|
|
2c1a3692e7 | |
|
|
30e16d80d9 | |
|
|
2743caa02a | |
|
|
572d6a127c | |
|
|
6aa25397de | |
|
|
55e5427ec4 | |
|
|
c2e923bcee | |
|
|
ddf7f8538a | |
|
|
1dc55a982c |
|
|
@ -1,3 +1 @@
|
||||||
*.*~
|
build
|
||||||
*.o
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
build-job:
|
||||||
|
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 .
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
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_CXX_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core)
|
||||||
|
find_package(Qt5 REQUIRED COMPONENTS Gui Widgets)
|
||||||
|
|
||||||
|
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/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
|
||||||
|
)
|
||||||
|
|
||||||
|
# Resources:
|
||||||
|
set(samplebrain_resource_files
|
||||||
|
"app/images/at.png"
|
||||||
|
"app/images/pause.png"
|
||||||
|
"app/images/play.png"
|
||||||
|
"app/images/record.png"
|
||||||
|
"app/images/settings.png"
|
||||||
|
"app/images/stop.png"
|
||||||
|
)
|
||||||
|
|
||||||
|
#qt5_add_resources(samplebrain "samplebrain"
|
||||||
|
# PREFIX
|
||||||
|
# "/images"
|
||||||
|
# BASE
|
||||||
|
# "app"
|
||||||
|
# FILES
|
||||||
|
# ${samplebrain_resource_files}
|
||||||
|
#)
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
################################################################################
|
||||||
|
# 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)
|
||||||
|
|
@ -31,7 +31,8 @@ MainWindow::MainWindow(const string &port, const string &audio_port, const strin
|
||||||
m_last_file("."),
|
m_last_file("."),
|
||||||
m_feedback(port),
|
m_feedback(port),
|
||||||
m_audio_port(audio_port),
|
m_audio_port(audio_port),
|
||||||
m_process_port(process_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);
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "ui_samplebrain.h"
|
#include "gui/ui_samplebrain.h"
|
||||||
#include "SettingsDialog.h"
|
#include "SettingsDialog.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
@ -206,11 +206,10 @@ private slots:
|
||||||
|
|
||||||
void run_slot() {}
|
void run_slot() {}
|
||||||
void load_target() {
|
void load_target() {
|
||||||
m_last_file=QFileDialog::getOpenFileName(
|
m_last_file=QFileDialog::getOpenFileName(this,
|
||||||
this,
|
QString("Select an audio file"),
|
||||||
QString("Select an wav file"),
|
|
||||||
m_last_file,
|
m_last_file,
|
||||||
QString("Sounds (*.wav)"));
|
m_format_string);
|
||||||
|
|
||||||
send_process_osc("/load_target","s",m_last_file.toStdString().c_str());
|
send_process_osc("/load_target","s",m_last_file.toStdString().c_str());
|
||||||
}
|
}
|
||||||
|
|
@ -222,26 +221,25 @@ 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() {
|
||||||
m_last_file=QFileDialog::getOpenFileName(
|
m_last_file=QFileDialog::getOpenFileName(this,
|
||||||
this,
|
|
||||||
QString("Select a wav file"),
|
QString("Select a wav file"),
|
||||||
m_last_file,
|
m_last_file,
|
||||||
QString("Sounds (*.wav)"));
|
m_format_string);
|
||||||
|
|
||||||
send_process_osc("/load_sample","s",m_last_file.toStdString().c_str());
|
if (m_last_file!="") {
|
||||||
|
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);
|
sound_items::sound_item &si = m_sound_items.add(m_Ui.brain_contents, m_last_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() {
|
||||||
m_last_file=QFileDialog::getExistingDirectory(this,
|
m_last_file=QFileDialog::getExistingDirectory(this,
|
||||||
QString("Select a directory"),
|
QString("Select a directory of wav files"),
|
||||||
m_last_file);
|
m_last_file);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -319,7 +317,7 @@ private slots:
|
||||||
this,
|
this,
|
||||||
QString("Select a wav file"),
|
QString("Select a wav file"),
|
||||||
m_last_file,
|
m_last_file,
|
||||||
QString("Sounds (*.wav)"));
|
QString("Sounds (*.wav);;All files (*.*)"));
|
||||||
m_save_wav = m_last_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(".");
|
||||||
|
|
@ -345,7 +343,7 @@ private slots:
|
||||||
this,
|
this,
|
||||||
QString("Select a brain file"),
|
QString("Select a brain file"),
|
||||||
m_last_file,
|
m_last_file,
|
||||||
QString("Brains (*.brain)"));
|
QString("Brains (*.brain);;All files (*.*)"));
|
||||||
|
|
||||||
send_process_osc("/load_brain","s",m_last_file.toStdString().c_str());
|
send_process_osc("/load_brain","s",m_last_file.toStdString().c_str());
|
||||||
}
|
}
|
||||||
|
|
@ -354,7 +352,7 @@ private slots:
|
||||||
this,
|
this,
|
||||||
QString("Select a brain file"),
|
QString("Select a brain file"),
|
||||||
m_last_file,
|
m_last_file,
|
||||||
QString("Brains (*.brain)"));
|
QString("Brains (*.brain);;All files (*.*)"));
|
||||||
|
|
||||||
send_process_osc("/save_brain","s",m_last_file.toStdString().c_str());
|
send_process_osc("/save_brain","s",m_last_file.toStdString().c_str());
|
||||||
}
|
}
|
||||||
|
|
@ -364,7 +362,7 @@ private slots:
|
||||||
this,
|
this,
|
||||||
QString("Select a session file"),
|
QString("Select a session file"),
|
||||||
m_last_file,
|
m_last_file,
|
||||||
QString("Sessions *.samplebrain (*.samplebrain)"));
|
QString("Sessions *.samplebrain (*.samplebrain);;All files (*.*)"));
|
||||||
|
|
||||||
send_process_osc("/load_session","s",m_last_file.toStdString().c_str());
|
send_process_osc("/load_session","s",m_last_file.toStdString().c_str());
|
||||||
init_from_session(m_last_file.toStdString());
|
init_from_session(m_last_file.toStdString());
|
||||||
|
|
@ -455,5 +453,5 @@ private:
|
||||||
|
|
||||||
string m_audio_port;
|
string m_audio_port;
|
||||||
string m_process_port;
|
string m_process_port;
|
||||||
|
QString m_format_string;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include "ui_settings.h"
|
#include "gui/ui_settings.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <lo/lo.h>
|
#include <lo/lo.h>
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
|
@ -69,6 +69,8 @@ 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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
21
building.md
21
building.md
|
|
@ -1,8 +1,8 @@
|
||||||
# Building from source
|
# Building from source
|
||||||
## Linux (Ubuntu)
|
## Linux (Ubuntu)
|
||||||
Install libraries for the sample engine (use brew on mac, MinGW on win):
|
Install cmake:
|
||||||
|
|
||||||
$ sudo apt install libsndfile1-dev portaudio19-dev liblo-dev libfftw3-dev
|
$ sudo apt install cmake
|
||||||
|
|
||||||
Install dependencies for the interface:
|
Install dependencies for the interface:
|
||||||
|
|
||||||
|
|
@ -16,15 +16,14 @@ Build & run it:
|
||||||
|
|
||||||
$ mkdir build
|
$ mkdir build
|
||||||
$ cd build
|
$ cd build
|
||||||
$ qmake ..
|
$ cmake ..
|
||||||
$ make
|
$ cmake --build .
|
||||||
$ sudo make install
|
$ ./samplebrain
|
||||||
$ samplebrain
|
|
||||||
|
|
||||||
## Mac
|
## Mac
|
||||||
Install libraries for sample engine:
|
Install cmake:
|
||||||
|
|
||||||
$ brew install fftw portaudio liblo libsndfile
|
$ brew install cmake
|
||||||
|
|
||||||
Install dependencies for the interface:
|
Install dependencies for the interface:
|
||||||
|
|
||||||
|
|
@ -35,10 +34,10 @@ Build & run it:
|
||||||
|
|
||||||
$ mkdir build
|
$ mkdir build
|
||||||
$ cd build
|
$ cd build
|
||||||
$ qmake ..
|
$ cmake ..
|
||||||
$ make
|
$ cmake --build .
|
||||||
|
|
||||||
`samplebrain.app` should then be in the app folder for you to run.
|
`samplebrain.app` should then be in the build folder for you to run.
|
||||||
|
|
||||||
# Mac build additions
|
# Mac build additions
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
######################################################################
|
|
||||||
# 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/SettingsDialog.h
|
|
||||||
|
|
||||||
FORMS += gui/samplebrain.ui \
|
|
||||||
gui/settings.ui
|
|
||||||
|
|
||||||
SOURCES += app/MainWindow.cpp \
|
|
||||||
app/SettingsDialog.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
|
|
||||||
INCLUDEPATH += /opt/homebrew/include
|
|
||||||
LIBS += -L.. -L/usr/local/lib -L/opt/homebrew/lib -lportaudio -lfftw3 -lsndfile -llo -ldl -lpthread -lm
|
|
||||||
|
|
||||||
QMAKE_CXXFLAGS += -O3 -Wall -Wno-unused -std=c++11
|
|
||||||
|
|
||||||
# assets
|
|
||||||
RESOURCES = app/samplebrain.qrc
|
|
||||||
ICON = desktop/samplebrain.icns
|
|
||||||
|
|
||||||
PREFIX = $$(PREFIX)
|
|
||||||
isEmpty(PREFIX) {
|
|
||||||
PREFIX = /usr
|
|
||||||
}
|
|
||||||
|
|
||||||
unix:desktopfile.path = $$PREFIX/share/applications/
|
|
||||||
unix:desktopfile.files = desktop/samplebrain.desktop
|
|
||||||
unix:iconfile.path = $$PREFIX/share/icons/hicolor/scalable/apps
|
|
||||||
unix:iconfile.files = desktop/samplebrain.svg
|
|
||||||
unix:metainfofile.path = $$PREFIX/share/metainfo
|
|
||||||
unix:metainfofile.files = desktop/org.thentrythis.Samplebrain.metainfo.xml
|
|
||||||
|
|
||||||
target.path = $$PREFIX/bin
|
|
||||||
INSTALLS += target desktopfile iconfile metainfofile
|
|
||||||
Loading…
Reference in New Issue