Commit 45f4df18 authored by David Jarvie's avatar David Jarvie
Browse files

Bug 456845: Set volume correctly for repeated audio alarms

The volume was only set the first time the alarm was played.
parent c094459a
Pipeline #206860 passed with stage
in 1 minute and 46 seconds
KAlarm Change Log
=== Version 3.5.0 (KDE Gear 22.08) --- 24 April 2022 ===
=== Version 3.5.0 (KDE Gear 22.08) --- 19 July 2022 ===
* Provide options to build and/or run KAlarm without any Akonadi dependency.
* Set volume correctly for repeated audio alarms [KDE Bug 456845]
=== Version 3.4.1 (KDE Gear 22.04.1) --- 2 May 2022 ===
* Fix checkboxes being disabled in Preferences dialogue.
......
......@@ -1012,12 +1012,12 @@ void AudioPlayer::execute()
mAudioObject = new Phonon::MediaObject(this);
mAudioObject->setCurrentSource(source);
mAudioObject->setTransitionTime(100); // workaround to prevent clipping of end of files in Xine backend
auto output = new Phonon::AudioOutput(Phonon::NotificationCategory, this); //NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
mPath = Phonon::createPath(mAudioObject, output);
mAudioOutput = new Phonon::AudioOutput(Phonon::NotificationCategory, this); //NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
mPath = Phonon::createPath(mAudioObject, mAudioOutput);
if (mVolume >= 0 || mFadeVolume >= 0)
{
if (mVolume >= 0)
output->setVolume(mVolume);
mAudioOutput->setVolume(mVolume);
if (mFadeVolume >= 0 && mFadeSeconds > 0)
{
mFader = new Phonon::VolumeFaderEffect(this);
......@@ -1031,7 +1031,7 @@ void AudioPlayer::execute()
else
{
if (mVolume < 0)
mVolume = output->volume();
mVolume = mAudioOutput->volume();
mPath.insertEffect(mFader);
}
}
......@@ -1087,6 +1087,8 @@ void AudioPlayer::checkAudioPlay()
// Start playing the file, either for the first time or again
qCDebug(KALARM_LOG) << "MessageDisplayHelper::AudioPlayer::checkAudioPlay: start";
if (mVolume >= 0)
mAudioOutput->setVolume(mVolume);
if (mFader)
{
mFader->setVolume(mFadeVolume);
......
......@@ -18,6 +18,7 @@ class MessageDisplayHelper;
namespace Phonon
{
class MediaObject;
class AudioOutput;
class VolumeFaderEffect;
}
......@@ -52,6 +53,7 @@ private:
int mRepeatPause;
Phonon::MediaObject* mAudioObject {nullptr};
Phonon::Path mPath;
Phonon::AudioOutput* mAudioOutput {nullptr};
Phonon::VolumeFaderEffect* mFader {nullptr};
QString mError;
bool mPlayedOnce; // the sound file has started playing at least once
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment