Compare commits

..

1 Commits

Author SHA1 Message Date
Claude Heiland-Allen 6b8b3a238d Merge branch 'parallel-synapse-generation' into 'main'
parallelize synapse generation using OpenMP

See merge request then-try-this/samplebrain!6
2022-10-01 17:51:10 +00:00
19 changed files with 276 additions and 853 deletions

View File

@ -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>
@ -49,8 +46,6 @@ MainWindow::MainWindow() :
m_Ui.brain_contents->setSpacing(0); m_Ui.brain_contents->setSpacing(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);
// add default local dest // add default local dest
// turn on first one // turn on first one
@ -188,5 +183,3 @@ void MainWindow::init_from_session(const string &filename) {
} }
#endif

View File

@ -19,7 +19,6 @@
#include <QFileDialog> #include <QFileDialog>
#include <QLineEdit> #include <QLineEdit>
#include "ui_samplebrain.h" #include "ui_samplebrain.h"
#include "SettingsDialog.h"
#include <iostream> #include <iostream>
#include <lo/lo.h> #include <lo/lo.h>
@ -27,7 +26,6 @@
#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;
@ -39,64 +37,6 @@ class MainWindow : public QMainWindow
public: public:
MainWindow(); MainWindow();
// 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:
@ -370,7 +310,7 @@ private slots:
} }
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) {
@ -396,9 +336,6 @@ private slots:
} }
void settings() {
m_settings_dialog->show();
}
private: private:
@ -425,6 +362,41 @@ 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,
@ -439,7 +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;
}; };

View File

@ -1,39 +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):
m_device(""),
m_parent(parent),
m_buffersize(2048),
m_samplerate(44100) {
m_Ui.setupUi(this);
}
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());
}

View File

@ -1,75 +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 "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);
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(); }
private:
void connect();
MainWindow *m_parent;
unsigned int m_buffersize;
unsigned int m_samplerate;
};
#endif

View File

@ -28,18 +28,15 @@ audio_thread::audio_thread(process_thread &p) :
m_stereo_mode(false), m_stereo_mode(false),
m_mic_mode(false), m_mic_mode(false),
m_bufsize(2048), m_bufsize(2048),
m_samplerate(44100), m_samplerate(44100)
m_device("")
{ {
// start_audio(); start_audio();
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);
m_block_stream = new block_stream(); m_block_stream = new block_stream();
pthread_mutex_unlock(m_brain_mutex); pthread_mutex_unlock(m_brain_mutex);
m_osc.run(); m_osc.run();
// it this threadsafe?
// m_audio_device->report_devices();
} }
static bool state = 1; static bool state = 1;
@ -57,17 +54,6 @@ void audio_thread::start_audio() {
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;

View File

@ -29,9 +29,6 @@ namespace spiralcore {
audio_thread(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);
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);
@ -42,6 +39,7 @@ namespace spiralcore {
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;
@ -50,7 +48,6 @@ namespace spiralcore {
bool m_mic_mode; bool m_mic_mode;
u32 m_bufsize; u32 m_bufsize;
u32 m_samplerate; u32 m_samplerate;
string m_device;
}; };
} }

View File

@ -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)) {

View File

@ -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,7 +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);
private: private:

View File

@ -34,9 +34,9 @@ static void* _process(void *c) {
process_thread::process_thread() : process_thread::process_thread() :
m_osc("8889"), 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)

View File

@ -30,11 +30,12 @@ int main( int argc , char *argv[] ){
QApplication app(argc, argv); QApplication app(argc, argv);
MainWindow mainWin; MainWindow mainWin;
mainWin.show(); mainWin.show();
cerr<<"Qt version: "<<qVersion()<<endl;
process_thread pt; process_thread pt;
audio_thread at(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);
return app.exec(); return app.exec();
} }

View File

@ -22,23 +22,14 @@ 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) { 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,7 +39,8 @@ 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) {
@ -91,4 +83,5 @@ void audio_device::maybe_record() {
} }
} }
void audio_device::start_graph(graph *graph) {
}

View File

@ -28,7 +28,7 @@ namespace spiralcore {
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();

View File

@ -19,16 +19,14 @@
#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;
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 +39,72 @@ portaudio_client::~portaudio_client() {
detach(); detach();
} }
bool portaudio_client::init() { /////////////////////////////////////////////////////////////////////////////////////////////
m_initialised=false;
if (!m_initialised) {
PaError err;
err = Pa_Initialize();
if( err != paNoError ) {
Pa_Terminate();
m_status="error initialising portaudio: "+string(Pa_GetErrorText(err))+"\n";
return false;
}
// load all the devices we have vector<string> portaudio_client::sniff_devices() {
PaDeviceIndex default_output_num = Pa_GetDefaultOutputDevice(); vector<string> ret;
PaDeviceIndex default_input_num = Pa_GetDefaultInputDevice();
m_devices.clear();
// get all devices we have available
int numDevices = Pa_GetDeviceCount(); int numDevices = Pa_GetDeviceCount();
if(numDevices <= 0) { if(numDevices < 0) {
m_status="portaudio error: no audio devices found"; // this is an error I guess
return false; return ret;
} }
const PaDeviceInfo *deviceInfo; const PaDeviceInfo *deviceInfo;
for(int i=0; i<numDevices; i++) { for(int i=0; i<numDevices; i++) {
deviceInfo = Pa_GetDeviceInfo(i); deviceInfo = Pa_GetDeviceInfo(i);
if (deviceInfo->maxOutputChannels>=2) { ret.push_back(deviceInfo->name);
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);
} }
} return ret;
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) { bool portaudio_client::attach(const string &client_name, const device_options &dopt) {
if (!init()) return false; if (m_attached) return true;
detach();
int requested_output_id = device_name_to_id(requested_output_device); PaError err;
err = Pa_Initialize();
if( err != paNoError ) {
cerr<<"could not init portaudio_client"<<endl;
Pa_Terminate();
fprintf( stderr, "an error occured while using the portaudio stream\n" );
fprintf( stderr, "error number: %d\n", err );
fprintf( stderr, "error message: %s\n", Pa_GetErrorText( err ) );
}
PaDeviceIndex output_device_num = Pa_GetDefaultOutputDevice();
PaDeviceIndex input_device_num = Pa_GetDefaultInputDevice();
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 (true || 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 +112,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;
}
} }
///////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -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,14 @@ class portaudio_client
unsigned int out_channels; unsigned int out_channels;
}; };
class device_desc { vector<string> sniff_devices();
public: bool attach(const string &client_name, const device_options &dopt);
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 +60,8 @@ 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 bool m_attached;
static int m_attached_device;
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

View File

@ -34,6 +34,10 @@ void status::sound_item_refresh() {
lo_send(m_address,"/sound-item-refresh",""); lo_send(m_address,"/sound-item-refresh","");
} }
void status::add_audio_device(const std::string &name) {
lo_send(m_address,"/add_audio_device",name.c_str());
}
void status::update(const char *msg, ...) { void status::update(const char *msg, ...) {
va_list args; va_list args;
va_start(args, msg); va_start(args, msg);

View File

@ -28,8 +28,7 @@ public:
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 add_audio_device(const std::string &name);
static void audio_device_status(const std::string &status);
static lo_address m_address; static lo_address m_address;
}; };

View File

@ -403,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>
@ -752,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>
@ -783,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>
@ -1236,7 +1236,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>
@ -1267,7 +1267,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>
@ -1562,20 +1562,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>settings</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
@ -1618,8 +1604,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>
@ -1634,8 +1620,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>
@ -1650,8 +1636,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>
@ -1666,8 +1652,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>
@ -1682,8 +1668,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>
@ -1698,8 +1684,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>
@ -1714,8 +1700,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>
@ -1730,12 +1716,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>
@ -1746,8 +1732,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>
@ -1762,8 +1748,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>
@ -1778,8 +1764,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>
@ -1794,8 +1780,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>
@ -1810,8 +1796,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>
@ -1826,8 +1812,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>
@ -1842,12 +1828,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>
@ -1858,8 +1844,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>
@ -1874,8 +1860,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>
@ -1890,8 +1876,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>
@ -1906,8 +1892,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>
@ -1922,8 +1908,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>
@ -1938,8 +1924,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>
@ -1954,8 +1940,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>
@ -1970,8 +1956,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>
@ -1986,8 +1972,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>
@ -2002,8 +1988,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>
@ -2018,8 +2004,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>
@ -2034,8 +2020,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>
@ -2050,8 +2036,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>
@ -2066,8 +2052,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>
@ -2082,8 +2068,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>
@ -2098,8 +2084,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>
@ -2114,8 +2100,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>
@ -2130,8 +2116,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>
@ -2146,8 +2132,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>
@ -2162,12 +2148,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>
@ -2178,12 +2164,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>
@ -2194,8 +2180,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>
@ -2210,12 +2196,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>
@ -2226,12 +2212,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>
@ -2242,8 +2228,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>
@ -2258,8 +2244,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>
@ -2274,8 +2260,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>
@ -2290,8 +2276,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>
@ -2306,8 +2292,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>
@ -2322,8 +2308,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>
@ -2338,8 +2324,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>
@ -2354,8 +2340,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>
@ -2370,8 +2356,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>
@ -2386,8 +2372,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>
@ -2402,8 +2388,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>
@ -2418,8 +2404,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>
@ -2434,8 +2420,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>
@ -2450,8 +2436,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>
@ -2466,8 +2452,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>
@ -2475,22 +2461,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>
@ -2548,6 +2518,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>

View File

@ -1,314 +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>400</width>
<height>522</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"/>
</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="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="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>
</widget>
</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>231</x>
<y>358</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>299</x>
<y>364</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>112</x>
<y>321</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>326</x>
<y>131</y>
</hint>
<hint type="destinationlabel">
<x>395</x>
<y>208</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>output_device(QString)</slot>
<slot>samplerate(QString)</slot>
<slot>buffersize(QString)</slot>
<slot>apply()</slot>
</slots>
</ui>

View File

@ -10,14 +10,11 @@ INCLUDEPATH += . 2
QT += core gui widgets QT += core gui widgets
# Input # Input
HEADERS += app/MainWindow.h \ HEADERS += app/MainWindow.h
app/SettingsDialog.h
FORMS += gui/samplebrain.ui \ FORMS += gui/samplebrain.ui
gui/settings.ui
SOURCES += app/MainWindow.cpp \ SOURCES += app/MainWindow.cpp \
app/SettingsDialog.cpp \
app/sound_items.cpp \ app/sound_items.cpp \
app/audio_thread.cpp \ app/audio_thread.cpp \
app/process_thread.cpp \ app/process_thread.cpp \