Skip to content

Commit

Permalink
engine: fix stopping audio with fade out while fading in (fix #1469)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcallegari committed Oct 28, 2023
1 parent 7f25542 commit 268df5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
qlcplus (4.12.8) stable; urgency=low

* engine: fix Chaser random startup (thanks to Dennis Suermann)
* engine: do not fade out looped audio
* engine: fix stopping audio with fade in and fade out while fading in
* Virtual Console/Slider: fix switching from playback to submaster mode
* Virtual Console/XY Pad: fix Scene preset controlling wrong channels
* Plugins/ArtNet: add default standard transmission mode as per protocol specifications
Expand Down
7 changes: 4 additions & 3 deletions engine/audio/src/audiorenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,13 @@ void AudioRenderer::setFadeIn(uint fadeTime)

void AudioRenderer::setFadeOut(uint fadeTime)
{
if (fadeTime == 0 || m_fadeStep != 0 || m_adec == NULL)
if (fadeTime == 0 || m_adec == NULL)
return;

quint32 sampleRate = m_adec->audioParameters().sampleRate();
int channels = m_adec->audioParameters().channels();
qreal stepsCount = (qreal)fadeTime * ((qreal)(sampleRate * channels) / 1000);
m_fadeStep = -(m_intensity / stepsCount);
m_currentIntensity = m_intensity;

qDebug() << Q_FUNC_INFO << "stepsCount:" << stepsCount << ", fadeStep:" << m_fadeStep;
}
Expand Down Expand Up @@ -118,7 +117,7 @@ void AudioRenderer::run()
while (!m_userStop)
{
QMutexLocker locker(&m_mutex);
audioDataWritten = 0;

if (m_pause == false)
{
//qDebug() << "Pending audio bytes: " << pendingAudioBytes;
Expand All @@ -140,6 +139,8 @@ void AudioRenderer::run()
}
if (m_intensity != 1.0 || m_fadeStep != 0)
{
//qDebug() << "Intensity" << m_intensity << ", current" << m_currentIntensity << ", fadeStep" << m_fadeStep;

for (int i = 0; i < audioDataRead; i+=sampleSize)
{
qreal scaleFactor = m_intensity;
Expand Down

0 comments on commit 268df5d

Please sign in to comment.