summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-12-15 01:05:33 +0100
committerJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-12-15 01:57:06 +0100
commit0471998e13aada9a76e92b13ab3885c2d1c2fb84 (patch)
tree776d15ab92ef044956940bc2228b61256ca4feb9 /src/engine
parent63b858b5d827797eec959d009ad0b970de167dc5 (diff)
Add missing braces around single-line statements
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/controls/bpmcontrol.cpp16
-rw-r--r--src/engine/controls/cuecontrol.cpp6
-rw-r--r--src/engine/controls/loopingcontrol.cpp5
-rw-r--r--src/engine/controls/ratecontrol.cpp3
-rw-r--r--src/engine/enginemaster.cpp3
-rw-r--r--src/engine/enginevumeter.cpp20
-rw-r--r--src/engine/filters/enginefilter.cpp3
-rw-r--r--src/engine/sidechain/shoutconnection.cpp22
8 files changed, 52 insertions, 26 deletions
diff --git a/src/engine/controls/bpmcontrol.cpp b/src/engine/controls/bpmcontrol.cpp
index ee3bbf8f21..91642192f6 100644
--- a/src/engine/controls/bpmcontrol.cpp
+++ b/src/engine/controls/bpmcontrol.cpp
@@ -516,8 +516,12 @@ double BpmControl::getBeatDistance(double dThisPosition) const {
(dThisPosition - dPrevBeat) / dBeatLength;
// Because findNext and findPrev have an epsilon built in, sometimes
// the beat percentage is out of range. Fix it.
- if (dBeatPercentage < 0) ++dBeatPercentage;
- if (dBeatPercentage > 1) --dBeatPercentage;
+ if (dBeatPercentage < 0) {
+ ++dBeatPercentage;
+ }
+ if (dBeatPercentage > 1) {
+ --dBeatPercentage;
+ }
return dBeatPercentage - m_dUserOffset.getValue();
}
@@ -572,8 +576,12 @@ bool BpmControl::getBeatContextNoLookup(
(dPosition - dPrevBeat) / dBeatLength;
// Because findNext and findPrev have an epsilon built in, sometimes
// the beat percentage is out of range. Fix it.
- if (*dpBeatPercentage < 0) ++*dpBeatPercentage;
- if (*dpBeatPercentage > 1) --*dpBeatPercentage;
+ if (*dpBeatPercentage < 0) {
+ ++*dpBeatPercentage;
+ }
+ if (*dpBeatPercentage > 1) {
+ --*dpBeatPercentage;
+ }
}
return true;
diff --git a/src/engine/controls/cuecontrol.cpp b/src/engine/controls/cuecontrol.cpp
index e73c60e14b..00c8bf6f56 100644
--- a/src/engine/controls/cuecontrol.cpp
+++ b/src/engine/controls/cuecontrol.cpp
@@ -756,8 +756,9 @@ void CueControl::hotcueGotoAndStop(HotcueControl* pControl, double value) {
}
QMutexLocker lock(&m_mutex);
- if (!m_pLoadedTrack)
+ if (!m_pLoadedTrack) {
return;
+ }
CuePointer pCue(pControl->getCue());
@@ -918,8 +919,9 @@ void CueControl::hotcueClear(HotcueControl* pControl, double value) {
void CueControl::hotcuePositionChanged(HotcueControl* pControl, double newPosition) {
QMutexLocker lock(&m_mutex);
- if (!m_pLoadedTrack)
+ if (!m_pLoadedTrack) {
return;
+ }
CuePointer pCue(pControl->getCue());
if (pCue) {
diff --git a/src/engine/controls/loopingcontrol.cpp b/src/engine/controls/loopingcontrol.cpp
index 833dbdf329..a201815612 100644
--- a/src/engine/controls/loopingcontrol.cpp
+++ b/src/engine/controls/loopingcontrol.cpp
@@ -264,10 +264,11 @@ void LoopingControl::slotLoopScale(double scaleFactor) {
// Don't allow 0 samples loop, so one can still manipulate it
if (loopSamples.end == loopSamples.start) {
- if ((loopSamples.end + 2) >= trackSamples)
+ if ((loopSamples.end + 2) >= trackSamples) {
loopSamples.start -= 2;
- else
+ } else {
loopSamples.end += 2;
+ }
}
// Do not allow loops to go past the end of the song
else if (loopSamples.end > trackSamples) {
diff --git a/src/engine/controls/ratecontrol.cpp b/src/engine/controls/ratecontrol.cpp
index f2c4465dfe..e32580d30a 100644
--- a/src/engine/controls/ratecontrol.cpp
+++ b/src/engine/controls/ratecontrol.cpp
@@ -369,8 +369,9 @@ double RateControl::getJogFactor() const {
double jogValue = m_pJog->get();
// Since m_pJog is an accumulator, reset it since we've used its value.
- if(jogValue != 0.)
+ if (jogValue != 0.) {
m_pJog->set(0.);
+ }
double jogValueFiltered = m_pJogFilter->filter(jogValue);
double jogFactor = jogValueFiltered * jogSensitivity;
diff --git a/src/engine/enginemaster.cpp b/src/engine/enginemaster.cpp
index 79b99636a5..cd60faabae 100644
--- a/src/engine/enginemaster.cpp
+++ b/src/engine/enginemaster.cpp
@@ -841,8 +841,9 @@ const CSAMPLE* EngineMaster::getDeckBuffer(unsigned int i) const {
}
const CSAMPLE* EngineMaster::getOutputBusBuffer(unsigned int i) const {
- if (i <= EngineChannel::RIGHT)
+ if (i <= EngineChannel::RIGHT) {
return m_pOutputBusBuffers[i];
+ }
return NULL;
}
diff --git a/src/engine/enginevumeter.cpp b/src/engine/enginevumeter.cpp
index 07c761ff09..7826a5cc2f 100644
--- a/src/engine/enginevumeter.cpp
+++ b/src/engine/enginevumeter.cpp
@@ -80,14 +80,17 @@ void EngineVuMeter::process(CSAMPLE* pIn, const int iBufferSize) {
// ControlObject will not prevent us from causing tons of extra
// work. Because of this, we use an epsilon here to be gentle on the GUI
// and MIDI controllers.
- if (fabs(m_fRMSvolumeL - m_ctrlVuMeterL->get()) > epsilon)
+ if (fabs(m_fRMSvolumeL - m_ctrlVuMeterL->get()) > epsilon) {
m_ctrlVuMeterL->set(m_fRMSvolumeL);
- if (fabs(m_fRMSvolumeR - m_ctrlVuMeterR->get()) > epsilon)
+ }
+ if (fabs(m_fRMSvolumeR - m_ctrlVuMeterR->get()) > epsilon) {
m_ctrlVuMeterR->set(m_fRMSvolumeR);
+ }
double fRMSvolume = (m_fRMSvolumeL + m_fRMSvolumeR) / 2.0;
- if (fabs(fRMSvolume - m_ctrlVuMeter->get()) > epsilon)
+ if (fabs(fRMSvolume - m_ctrlVuMeter->get()) > epsilon) {
m_ctrlVuMeter->set(fRMSvolume);
+ }
// Reset calculation:
m_iSamplesCalculated = 0;
@@ -121,14 +124,17 @@ void EngineVuMeter::process(CSAMPLE* pIn, const int iBufferSize) {
void EngineVuMeter::doSmooth(CSAMPLE &currentVolume, CSAMPLE newVolume)
{
- if (currentVolume > newVolume)
+ if (currentVolume > newVolume) {
currentVolume -= kDecaySmoothing * (currentVolume - newVolume);
- else
+ } else {
currentVolume += kAttackSmoothing * (newVolume - currentVolume);
- if (currentVolume < 0)
+ }
+ if (currentVolume < 0) {
currentVolume=0;
- if (currentVolume > 1.0)
+ }
+ if (currentVolume > 1.0) {
currentVolume=1.0;
+ }
}
void EngineVuMeter::reset() {
diff --git a/src/engine/filters/enginefilter.cpp b/src/engine/filters/enginefilter.cpp
index b299f04772..731d973567 100644
--- a/src/engine/filters/enginefilter.cpp
+++ b/src/engine/filters/enginefilter.cpp
@@ -40,8 +40,9 @@ EngineFilter::EngineFilter(char * conf, int predefinedType)
processSample = funcp;
}
int i;
- for(i=0; i < FILTER_BUF_SIZE; i++)
+ for (i = 0; i < FILTER_BUF_SIZE; i++) {
buf1[i] = buf2[i] = 0;
+ }
}
EngineFilter::~EngineFilter()
diff --git a/src/engine/sidechain/shoutconnection.cpp b/src/engine/sidechain/shoutconnection.cpp
index 2407df7516..6f77a9fdf7 100644
--- a/src/engine/sidechain/shoutconnection.cpp
+++ b/src/engine/sidechain/shoutconnection.cpp
@@ -106,8 +106,9 @@ ShoutConnection::ShoutConnection(BroadcastProfilePtr profile,
ShoutConnection::~ShoutConnection() {
delete m_pMasterSamplerate;
- if (m_pShoutMetaData)
+ if (m_pShoutMetaData) {
shout_metadata_free(m_pShoutMetaData);
+ }
if (m_pShout) {
shout_close(m_pShout);
@@ -128,8 +129,9 @@ ShoutConnection::~ShoutConnection() {
bool ShoutConnection::isConnected() {
if (m_pShout) {
m_iShoutStatus = shout_get_connected(m_pShout);
- if (m_iShoutStatus == SHOUTERR_CONNECTED)
+ if (m_iShoutStatus == SHOUTERR_CONNECTED) {
return true;
+ }
}
return false;
}
@@ -137,9 +139,9 @@ bool ShoutConnection::isConnected() {
// Only called when applying settings while broadcasting is active
void ShoutConnection::applySettings() {
// Do nothing if profile or Live Broadcasting is disabled
- if(!m_pBroadcastEnabled->toBool()
- || !m_pProfile->getEnabled())
+ if (!m_pBroadcastEnabled->toBool() || !m_pProfile->getEnabled()) {
return;
+ }
// Setting the profile's enabled value to false tells the
// connection's thread to exit, so no need to call
@@ -465,8 +467,9 @@ void ShoutConnection::updateFromPreferences() {
}
bool ShoutConnection::serverConnect() {
- if(!m_pProfile->getEnabled())
+ if (!m_pProfile->getEnabled()) {
return false;
+ }
start(QThread::HighPriority);
setState(NETWORKSTREAMWORKER_STATE_CONNECTING);
@@ -701,14 +704,16 @@ bool ShoutConnection::writeSingle(const unsigned char* data, size_t len) {
void ShoutConnection::process(const CSAMPLE* pBuffer, const int iBufferSize) {
setFunctionCode(4);
- if(!m_pProfile->getEnabled())
+ if (!m_pProfile->getEnabled()) {
return;
+ }
setState(NETWORKSTREAMWORKER_STATE_BUSY);
// If we aren't connected, bail.
- if (m_iShoutStatus != SHOUTERR_CONNECTED)
+ if (m_iShoutStatus != SHOUTERR_CONNECTED) {
return;
+ }
// If we are connected, encode the samples.
if (iBufferSize > 0 && m_encoder) {
@@ -737,8 +742,9 @@ bool ShoutConnection::metaDataHasChanged() {
m_iMetaDataLife = 0;
pTrack = PlayerInfo::instance().getCurrentPlayingTrack();
- if (!pTrack)
+ if (!pTrack) {
return false;
+ }
if (m_pMetaData) {
if (!pTrack->getId().isValid() || !m_pMetaData->getId().isValid()) {