This commit is contained in:
mrbesen 2021-12-14 12:46:57 +01:00
parent c5d1e24df9
commit 1832a01e24
Signed by untrusted user: MrBesen
GPG Key ID: 596B2350DCD67504
7 changed files with 29 additions and 4 deletions

View File

@ -22,6 +22,7 @@ public:
public slots:
void reloadConfig();
void stop();
signals:
void newStatusMessage(const QString&);
@ -33,6 +34,7 @@ private:
Ui::Soundboard *ui;
std::vector<SoundButton*> soundbuttons;
QxtGlobalShortcut* stopGlobal = nullptr;
Config config;
};
#endif // MAINWINDOW_H

View File

@ -38,7 +38,6 @@ private:
struct SoundData {
std::list<Playback*> playbacks; //liste der decoder
unsigned int decoderCount = 0;
unsigned int musicdecoderCount = 0;
ma_mutex* mutex;
};

View File

@ -13,7 +13,8 @@
"key": "",
"offset": 0,
"length": 0,
"volume": 1.0
"volume": 1.0,
"width": 6
}
]
]

View File

@ -11,13 +11,18 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::Soundb
reloadConfig();
QKeySequence seq("Num+,");
stopGlobal = new QxtGlobalShortcut(seq);
QObject::connect(ui->reloadButton, SIGNAL(clicked()), this, SLOT(reloadConfig()));
QObject::connect(ui->stopButton, SIGNAL( clicked() ), this, SLOT( stop() ));
QObject::connect(stopGlobal, SIGNAL( activated() ), this, SLOT( stop() ));
QObject::connect(this, SIGNAL(newStatusMessage(const QString&)), ui->statusbar, SLOT(showMessage(const QString&)));
}
MainWindow::~MainWindow() {
delete ui;
delete stopGlobal;
Sound::deinit();
}
@ -42,6 +47,10 @@ void MainWindow::reloadConfig() {
Log::info << "realodConfig() done";
}
void MainWindow::stop() {
Sound::instance().stopAll();
}
void MainWindow::loadSoundFromConfig() {
Sound& sound = Sound::instance(); // init sound
sound.reset();

View File

@ -78,5 +78,5 @@ void SoundButton::play() {
void SoundButton::setDisabled() {
disabled = true;
button->setText(QString::fromStdString(name + " DISABLED"));
button->setEnabled(false);
}

View File

@ -148,6 +148,7 @@ void SoundDevice::stop() {
delete pb;
}
data.playbacks.clear();
data.decoderCount = 0;
ma_mutex_unlock(data.mutex);
if(deviceRunning)

View File

@ -23,7 +23,7 @@
<height>561</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout" rowminimumheight="0">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
@ -42,6 +42,19 @@
<string>reload Config</string>
</property>
</widget>
<widget class="QPushButton" name="stopButton">
<property name="geometry">
<rect>
<x>160</x>
<y>10</y>
<width>100</width>
<height>27</height>
</rect>
</property>
<property name="text">
<string>Stop</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">