added osc ports to the settings interface, bumped the version num

This commit is contained in:
Dave Griffiths 2022-10-14 19:23:07 +01:00
parent 5e347f7f13
commit b5fd6dd3e0
8 changed files with 224 additions and 29 deletions

View File

@ -27,7 +27,7 @@
using namespace std;
MainWindow::MainWindow(const string &port, const string &audio_port, const string &process_port) :
MainWindow::MainWindow(const string &port, const string &audio_port, const string &process_port, QSettings *settings) :
m_last_file("."),
m_feedback(port),
m_audio_port(audio_port),
@ -51,7 +51,7 @@ MainWindow::MainWindow(const string &port, const string &audio_port, const strin
m_Ui.brain_contents->setSpacing(0);
m_Ui.brain_contents->setContentsMargins(0,0,0,0);
m_settings_dialog = new SettingsDialog(this);
m_settings_dialog = new SettingsDialog(this,settings);
// add default local dest
// turn on first one

View File

@ -33,13 +33,15 @@
using namespace std;
using namespace spiralcore;
class QSettings;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(const string &port, const string &audio_port, const string &process_port);
MainWindow(const string &port, const string &audio_port, const string &process_port, QSettings *settings);
void message(const string &msg) {
QMessageBox::information(this,"problem",msg.c_str(), QMessageBox::Ok);
}
@ -453,4 +455,5 @@ private:
string m_audio_port;
string m_process_port;
};

View File

@ -24,12 +24,16 @@
using namespace std;
SettingsDialog::SettingsDialog(MainWindow *parent):
SettingsDialog::SettingsDialog(MainWindow *parent, QSettings *settings):
m_device(""),
m_parent(parent),
m_buffersize(2048),
m_samplerate(44100) {
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() {

View File

@ -20,6 +20,7 @@
#include <QtGui>
#include <QDialog>
#include <QLineEdit>
#include <QSettings>
#include "ui_settings.h"
#include <iostream>
@ -36,7 +37,7 @@ class SettingsDialog : public QDialog
{
Q_OBJECT
public:
SettingsDialog(MainWindow *parent);
SettingsDialog(MainWindow *parent, QSettings *settings);
Ui_SettingsDialog m_Ui;
string m_device;
@ -61,15 +62,28 @@ class SettingsDialog : public QDialog
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;
void connect();
MainWindow *m_parent;
unsigned int m_buffersize;
unsigned int m_samplerate;
unsigned int m_buffersize;
unsigned int m_samplerate;
QSettings *m_settings;
};
#endif

View File

@ -50,7 +50,7 @@ int main( int argc , char *argv[] ){
status::set_port(gui_port);
MainWindow mainWin(gui_port,audio_port,process_port);
MainWindow mainWin(gui_port,audio_port,process_port,&settings);
mainWin.show();
process_thread pt(process_port);
audio_thread at(audio_port,pt);

View File

@ -34,11 +34,12 @@ OSC_server::OSC_server(const string &port) :
m_port(port),
m_exit(false),
m_command_ring_buffer(262144) {
//cerr<<"using port: ["<<port<<"]"<<endl;
cerr<<"OSC using port: ["<<port<<"]"<<endl;
m_server = lo_server_thread_new(port.c_str(), error_handler);
if (m_server) {
cerr<<m_server<<endl;
if (m_server) {
lo_server_thread_add_method(m_server, NULL, NULL, default_handler, this);
} else {
cerr<<"error opening OSC port"<<endl;
}
}

View File

@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>samplebrain 0.18.4</string>
<string>samplebrain 0.18.5</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout_4">

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>522</height>
<width>438</width>
<height>656</height>
</rect>
</property>
<property name="windowTitle">
@ -31,7 +31,13 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="deviceComboBox"/>
<widget class="QComboBox" name="deviceComboBox">
<property name="font">
<font>
<family>Comic Sans MS</family>
</font>
</property>
</widget>
</item>
</layout>
</item>
@ -57,6 +63,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Comic Sans MS</family>
</font>
</property>
<property name="text">
<string>44100</string>
</property>
@ -73,7 +84,7 @@
</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>
<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>
@ -98,6 +109,11 @@
</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>
@ -180,6 +196,112 @@
</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">
@ -218,8 +340,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>231</x>
<y>358</y>
<x>244</x>
<y>642</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
@ -234,8 +356,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>299</x>
<y>364</y>
<x>312</x>
<y>642</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
@ -266,8 +388,8 @@
<slot>apply()</slot>
<hints>
<hint type="sourcelabel">
<x>112</x>
<y>321</y>
<x>125</x>
<y>592</y>
</hint>
<hint type="destinationlabel">
<x>4</x>
@ -298,8 +420,8 @@
<slot>buffersize(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>326</x>
<y>131</y>
<x>390</x>
<y>215</y>
</hint>
<hint type="destinationlabel">
<x>395</x>
@ -307,11 +429,62 @@
</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>