- fix in setting
- change to volume approach on raspi in sound player
This commit is contained in:
parent
10645e9eb8
commit
a20e7e2fc9
4 changed files with 23 additions and 3 deletions
|
@ -28,6 +28,10 @@
|
|||
#include <QDateTime>
|
||||
#include <QSoundEffect>
|
||||
|
||||
#ifdef RASPI
|
||||
#include <QProcess>
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief The ScStwSoundPlayer class is used for ultra low latency sound playback of the speed clibing start tones and commands
|
||||
*/
|
||||
|
|
|
@ -22,6 +22,9 @@ ScStwRemoteRace::ScStwRemoteRace(ScStwClient *scStwClient, ScStwSettings *settin
|
|||
{
|
||||
this->isReadyForNextState = true;
|
||||
|
||||
this->remoteTimers = {};
|
||||
this->localTimers = {};*********
|
||||
|
||||
this->scStwClient = scStwClient;
|
||||
|
||||
this->scStwClient->addSignalSubscription(ScStw::RaceDetailsChanged);
|
||||
|
@ -213,6 +216,9 @@ void ScStwRemoteRace::refreshDetails(QVariantMap details) {
|
|||
}
|
||||
|
||||
void ScStwRemoteRace::rebuildRemoteTimers(QVariantList remoteTimers) {
|
||||
|
||||
qDebug() << "REBUILDING TIMERS";
|
||||
|
||||
// delete all current timers
|
||||
foreach(ScStwTimer * oldTimer, this->timers){
|
||||
oldTimer->deleteLater();
|
||||
|
@ -271,8 +277,10 @@ bool ScStwRemoteRace::refreshRemoteTimers(QVariantList remoteTimers) {
|
|||
}
|
||||
|
||||
bool ScStwRemoteRace::addTimer(ScStwTimer* timer) {
|
||||
if(this->local())
|
||||
if(this->local()) {
|
||||
this->localTimers.append(timer);
|
||||
return ScStwRace::addTimer(timer);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -30,8 +30,10 @@ ScStwSettings::ScStwSettings(QObject *parent) : QObject(parent)
|
|||
if(!this->settingsFile->open(QFile::ReadWrite))
|
||||
qFatal("[FATAL] Couldn't open settings file %s", qPrintable(path + "/settings.json"));
|
||||
|
||||
if(!this->loadSettingsFromFile() && this->settingsFile->size() != 0)
|
||||
qFatal("[FATAL] Settings file (%s) is of invalid format!", qPrintable(path + "/settings.json"));
|
||||
if(!this->loadSettingsFromFile() && this->settingsFile->size() != 0) {
|
||||
this->writeSettingsToFile();
|
||||
qWarning("[WARNING] Settings file (%s) was of invalid format and therefore overwritten!", qPrintable(path + "/settings.json"));
|
||||
}
|
||||
|
||||
connect(this, &ScStwSettings::settingChanged, this, &ScStwSettings::writeSettingsToFile);
|
||||
|
||||
|
|
|
@ -49,7 +49,13 @@ ScStwSoundPlayer::PlayResult ScStwSoundPlayer::play(ScStwSoundPlayer::StartSound
|
|||
this->currentlyPlayingSound = sound;
|
||||
|
||||
// update volume
|
||||
|
||||
#ifdef RASPI
|
||||
// set volume on raspi using alsamixer
|
||||
QProcess::execute("amixer -q -M sset PCM " + QString::number(volume * 100, 'f', 0) + "%");
|
||||
#else
|
||||
this->soundEffect->setVolume(volume);
|
||||
#endif
|
||||
|
||||
// load
|
||||
this->soundEffect->setSource(this->soundFiles[sound]["path"].toString());
|
||||
|
|
Reference in a new issue