Move Notification sounds into CNotificationPlayer

This commit is contained in:
Roland Rossgotterer
2019-03-05 15:18:16 +01:00
committed by Mat Sutcliffe
parent 77a8c46790
commit d5b3a336dd
8 changed files with 128 additions and 74 deletions

View File

@@ -79,9 +79,6 @@ namespace BlackCore
m_audioMixer->makeMixerConnection(IAudioMixer::InputVoiceChannel2, IAudioMixer::OutputOutputDevice1);
this->setVoiceOutputVolume(90);
// Load sounds (init), not possible in own thread
QTimer::singleShot(10 * 1000, this, &CContextAudio::initNotificationSounds);
m_unusedVoiceChannels.push_back(m_channel1);
m_unusedVoiceChannels.push_back(m_channel2);
@@ -452,13 +449,7 @@ namespace BlackCore
}
}
CSoundGenerator::playNotificationSound(90, notification);
}
void CContextAudio::initNotificationSounds()
{
// not possible in own thread
CSoundGenerator::playNotificationSound(0, CNotificationSounds::LoadSounds);
m_notificationPlayer.play(notification, 90);
}
void CContextAudio::enableAudioLoopback(bool enable)

View File

@@ -30,6 +30,7 @@
#include "blackmisc/settingscache.h"
#include "blackmisc/icons.h"
#include "blacksound/selcalplayer.h"
#include "blacksound/notificationplayer.h"
#include <QHash>
#include <QList>
@@ -118,9 +119,6 @@ namespace BlackCore
CContextAudio *registerWithDBus(BlackMisc::CDBusServer *server);
private:
//! Init notification sounds
void initNotificationSounds();
//! \copydoc IVoice::connectionStatusChanged
//! \sa IContextAudio::changedVoiceRooms
void onConnectionStatusChanged(IVoiceChannel::ConnectionStatus oldStatus, IVoiceChannel::ConnectionStatus newStatus);
@@ -159,6 +157,7 @@ namespace BlackCore
QHash<BlackMisc::Aviation::CComSystem::ComUnit, QSharedPointer<IVoiceChannel>> m_voiceChannelMapping;
QHash<QSharedPointer<IVoiceChannel>, IAudioMixer::OutputPort> m_voiceChannelOutputPortMapping;
BlackSound::CSelcalPlayer *m_selcalPlayer = nullptr;
BlackSound::CNotificationPlayer m_notificationPlayer;
// settings
BlackMisc::CSetting<BlackMisc::Audio::TSettings> m_audioSettings { this };