Ref T644, audio volume for notification sounds can be set

This commit is contained in:
Klaus Basan
2019-05-01 17:10:17 +02:00
parent e42a205f5e
commit 77fcde6465
9 changed files with 50 additions and 15 deletions

View File

@@ -162,7 +162,8 @@ namespace BlackCore
//! Play notification sound
//! \param notification CSoundGenerator::Notification
//! \param considerSettings consider settings (notification on/off), false means settings ignored
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings) const = 0;
//! \param volume 0..100
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume = -1) const = 0;
//! Enable audio loopback
virtual void enableAudioLoopback(bool enable = true) = 0;

View File

@@ -156,8 +156,9 @@ namespace BlackCore
}
//! \copydoc IContextAudio::playNotification()
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings) const override
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume = -1) const override
{
Q_UNUSED(volume);
Q_UNUSED(notification);
Q_UNUSED(considerSettings);
logEmptyContextWarning(Q_FUNC_INFO);

View File

@@ -438,7 +438,7 @@ namespace BlackCore
}
}
void CContextAudio::playNotification(CNotificationSounds::NotificationFlag notification, bool considerSettings) const
void CContextAudio::playNotification(CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume) const
{
Q_ASSERT(m_voice);
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << notification; }
@@ -455,9 +455,12 @@ namespace BlackCore
}
}
int volume = 90;
if (considerSettings) { volume = qMax(25, settings.getNotificationVolume()); }
m_notificationPlayer.play(notification, 100);
if (volume < 0 || volume > 100)
{
volume = 90;
if (considerSettings) { volume = qMax(25, settings.getNotificationVolume()); }
}
m_notificationPlayer.play(notification, volume);
}
void CContextAudio::enableAudioLoopback(bool enable)

View File

@@ -94,7 +94,7 @@ namespace BlackCore
virtual void setMute(bool muted) override;
virtual bool isMuted() const override;
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const override;
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings) const override;
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume = -1) const override;
virtual void enableAudioLoopback(bool enable = true) override;
virtual bool isAudioLoopbackEnabled() const override;
virtual BlackMisc::Audio::CVoiceSetup getVoiceSetup() const override;

View File

@@ -130,9 +130,9 @@ namespace BlackCore
this->m_dBusInterface->callDBus(QLatin1String("playSelcalTone"), selcal);
}
void CContextAudioProxy::playNotification(CNotificationSounds::NotificationFlag notification, bool considerSettings) const
void CContextAudioProxy::playNotification(CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume) const
{
this->m_dBusInterface->callDBus(QLatin1String("playNotification"), notification, considerSettings);
this->m_dBusInterface->callDBus(QLatin1String("playNotification"), notification, considerSettings, volume);
}
void CContextAudioProxy::setVoiceOutputVolume(int volume)

View File

@@ -80,7 +80,7 @@ namespace BlackCore
virtual void setMute(bool muted) override;
virtual bool isMuted() const override;
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const override;
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings) const override;
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume = -1) const override;
virtual void enableAudioLoopback(bool enable = true) override;
virtual bool isAudioLoopbackEnabled() const override;
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;