Ref T494, CNotificationSounds refactring

* use Q_DECLARE_FLAGS NotificationFlag/Notification for sounds, not the weird version from very early swift days
* splt into h/cpp files
* added new sounds
This commit is contained in:
Klaus Basan
2018-12-31 06:42:59 +01:00
committed by Mat Sutcliffe
parent dc8ea83839
commit f8c17e10e8
14 changed files with 133 additions and 57 deletions

View File

@@ -166,7 +166,7 @@ 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::Notification notification, bool considerSettings) const = 0;
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings) const = 0;
//! Enable audio loopback
virtual void enableAudioLoopback(bool enable = true) = 0;

View File

@@ -150,7 +150,7 @@ namespace BlackCore
}
//! \copydoc IContextAudio::playNotification()
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::Notification notification, bool considerSettings) const override
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings) const override
{
Q_UNUSED(notification);
Q_UNUSED(considerSettings);

View File

@@ -430,22 +430,19 @@ namespace BlackCore
m_selcalPlayer->play(90, selcal);
}
void CContextAudio::playNotification(CNotificationSounds::Notification notification, bool considerSettings) const
void CContextAudio::playNotification(CNotificationSounds::NotificationFlag notification, bool considerSettings) const
{
Q_ASSERT(m_voice);
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << notification; }
bool play = !considerSettings || m_audioSettings.getThreadLocal().getNotificationFlag(notification);
if (play)
{
CSoundGenerator::playNotificationSound(90, notification);
}
const bool play = !considerSettings || m_audioSettings.getThreadLocal().isNotificationFlagSet(notification);
if (play) { CSoundGenerator::playNotificationSound(90, notification); }
}
void CContextAudio::initNotificationSounds()
{
// not possible in own thread
CSoundGenerator::playNotificationSound(0, CNotificationSounds::NotificationsLoadSounds);
CSoundGenerator::playNotificationSound(0, CNotificationSounds::LoadSounds);
}
void CContextAudio::enableAudioLoopback(bool enable)
@@ -544,10 +541,8 @@ namespace BlackCore
case IVoiceChannel::Connected:
emit this->changedVoiceRooms(getComVoiceRooms(), true);
break;
case IVoiceChannel::Disconnecting:
break;
case IVoiceChannel::Connecting:
break;
case IVoiceChannel::Disconnecting: break;
case IVoiceChannel::Connecting: break;
case IVoiceChannel::ConnectingFailed:
case IVoiceChannel::DisconnectedError:
CLogMessage(this).warning(u"Voice channel disconnecting error");

View File

@@ -92,7 +92,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::Notification notification, bool considerSettings) const override;
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings) const override;
virtual void enableAudioLoopback(bool enable = true) override;
virtual bool isAudioLoopbackEnabled() const override;
virtual BlackMisc::Audio::CVoiceSetup getVoiceSetup() const override;

View File

@@ -122,7 +122,7 @@ namespace BlackCore
this->m_dBusInterface->callDBus(QLatin1String("playSelcalTone"), selcal);
}
void CContextAudioProxy::playNotification(CNotificationSounds::Notification notification, bool considerSettings) const
void CContextAudioProxy::playNotification(CNotificationSounds::NotificationFlag notification, bool considerSettings) const
{
this->m_dBusInterface->callDBus(QLatin1String("playNotification"), notification, considerSettings);
}

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::Notification notification, bool considerSettings) const override;
virtual void playNotification(BlackMisc::Audio::CNotificationSounds::NotificationFlag notification, bool considerSettings) 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;