Do not play QSoundEffect while it is still playing

* added m_playEffect as flag
* hooked up signals to reset the flags
This commit is contained in:
Klaus Basan
2019-09-20 15:10:00 +02:00
committed by Mat Sutcliffe
parent 55f70a794e
commit d944d0f6ee
8 changed files with 46 additions and 16 deletions

View File

@@ -142,13 +142,13 @@ namespace BlackCore
virtual bool isMuted() const = 0;
//! Play SELCAL tone
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const = 0;
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) = 0;
//! Play notification sound
//! \param notification CSoundGenerator::Notification
//! \param considerSettings consider settings (notification on/off), false means settings ignored
//! \param volume 0..100
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume = -1) const = 0;
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume = -1) = 0;
//! Enable audio loopback
virtual void enableAudioLoopback(bool enable = true) = 0;

View File

@@ -111,14 +111,14 @@ namespace BlackCore
}
//! \copydoc IContextAudio::playSelcalTone()
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) const override
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) override
{
Q_UNUSED(selcal);
logEmptyContextWarning(Q_FUNC_INFO);
}
//! \copydoc IContextAudio::playNotification()
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume = -1) const override
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume = -1) override
{
Q_UNUSED(volume);
Q_UNUSED(notification);

View File

@@ -478,7 +478,7 @@ namespace BlackCore
return this->getIContextNetwork()->getUsersForCallsigns(this->getRoomCallsigns(comUnit));
}
void CContextAudio::playSelcalTone(const CSelcal &selcal) const
void CContextAudio::playSelcalTone(const CSelcal &selcal)
{
Q_ASSERT(m_voice);
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << selcal; }
@@ -496,7 +496,7 @@ namespace BlackCore
}
}
void CContextAudio::playNotification(CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume) const
void CContextAudio::playNotification(CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume)
{
Q_ASSERT(m_voice);
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << notification; }

View File

@@ -94,8 +94,8 @@ namespace BlackCore
virtual int getVoiceOutputVolume() const override;
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, int volume = -1) const override;
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) override;
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume = -1) override;
virtual void enableAudioLoopback(bool enable = true) override;
virtual bool isAudioLoopbackEnabled() const override;
virtual BlackMisc::Audio::CVoiceSetup getVoiceSetup() const override;

View File

@@ -100,12 +100,12 @@ namespace BlackCore
this->m_dBusInterface->callDBus(QLatin1String("setComVoiceRooms"), voiceRooms);
}
void CContextAudioProxy::playSelcalTone(const CSelcal &selcal) const
void CContextAudioProxy::playSelcalTone(const CSelcal &selcal)
{
this->m_dBusInterface->callDBus(QLatin1String("playSelcalTone"), selcal);
}
void CContextAudioProxy::playNotification(CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume) const
void CContextAudioProxy::playNotification(CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume)
{
this->m_dBusInterface->callDBus(QLatin1String("playNotification"), notification, considerSettings, volume);
}

View File

@@ -74,8 +74,8 @@ namespace BlackCore
virtual int getVoiceOutputVolume() const override;
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, int volume = -1) const override;
virtual void playSelcalTone(const BlackMisc::Aviation::CSelcal &selcal) override;
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume = -1) override;
virtual void enableAudioLoopback(bool enable = true) override;
virtual bool isAudioLoopbackEnabled() const override;
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;