mirror of
https://gitlab.com/then-try-this/samplebrain.git
synced 2025-07-06 04:03:34 +00:00
added audio settings options for selection of device, samplrate and buffer size, also fixed: #65 & fixed: #64
This commit is contained in:
75
app/SettingsDialog.h
Normal file
75
app/SettingsDialog.h
Normal file
@ -0,0 +1,75 @@
|
||||
// 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
|
Reference in New Issue
Block a user