diff --git a/src/blackcore/context/contextaudioimpl.cpp b/src/blackcore/context/contextaudioimpl.cpp index 9762fdf53..3ccde9e07 100644 --- a/src/blackcore/context/contextaudioimpl.cpp +++ b/src/blackcore/context/contextaudioimpl.cpp @@ -156,10 +156,10 @@ namespace BlackCore { Q_ASSERT(m_voice); if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; } - return getComVoiceRooms(); + return this->getComVoiceRooms(); } - CVoiceRoom CContextAudio::getVoiceRoom(BlackMisc::Aviation::CComSystem::ComUnit comUnitValue, bool withAudioStatus) const + CVoiceRoom CContextAudio::getVoiceRoom(CComSystem::ComUnit comUnitValue, bool withAudioStatus) const { Q_ASSERT(m_voice); if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << withAudioStatus; } @@ -291,7 +291,7 @@ namespace BlackCore Q_ASSERT(m_voiceOutputDevice); if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << volume; } - bool wasMuted = isMuted(); + const bool wasMuted = isMuted(); volume = qMin(CSettings::MaxAudioVolume, volume); bool changedVoiceOutput = m_voiceOutputDevice->getOutputVolume() != volume; @@ -345,11 +345,11 @@ namespace BlackCore if (newVolume != m_voiceOutputDevice->getOutputVolume()) { m_voiceOutputDevice->setOutputVolume(newVolume); - emit changedAudioVolume(newVolume); + emit this->changedAudioVolume(newVolume); } // signal - emit changedMute(muted); + emit this->changedMute(muted); } bool CContextAudio::isMuted() const @@ -400,8 +400,8 @@ namespace BlackCore QSharedPointer newVoiceChannel = this->getVoiceChannelBy(newRoomCom1); newVoiceChannel->setOwnAircraftCallsign(ownCallsign); newVoiceChannel->setUserId(id); - bool inUse = m_voiceChannelMapping.values().contains(newVoiceChannel); - m_voiceChannelMapping.insert(BlackMisc::Aviation::CComSystem::Com1, newVoiceChannel); + const bool inUse = m_voiceChannelMapping.values().contains(newVoiceChannel); + m_voiceChannelMapping.insert(CComSystem::Com1, newVoiceChannel); // If the voice channel is not used by anybody else if (!inUse) @@ -627,8 +627,9 @@ namespace BlackCore this->setVoiceTransmission(enabled, COMActive); } - void CContextAudio::onConnectionStatusChanged(BlackCore::IVoiceChannel::ConnectionStatus oldStatus, - BlackCore::IVoiceChannel::ConnectionStatus newStatus) + void CContextAudio::onConnectionStatusChanged( + IVoiceChannel::ConnectionStatus oldStatus, + IVoiceChannel::ConnectionStatus newStatus) { Q_UNUSED(oldStatus); @@ -717,7 +718,11 @@ namespace BlackCore QSharedPointer voiceChannel; for (const auto &channel : as_const(m_voiceChannelMapping)) { - if (channel->getVoiceRoom().getVoiceRoomUrl() == voiceRoom.getVoiceRoomUrl()) voiceChannel = channel; + if (channel->getVoiceRoom().getVoiceRoomUrl() == voiceRoom.getVoiceRoomUrl()) + { + voiceChannel = channel; + break; + } } // If we haven't found a valid voice channel pointer, get an unused one diff --git a/src/blackcore/context/contextaudioimpl.h b/src/blackcore/context/contextaudioimpl.h index c788a7775..8da052d14 100644 --- a/src/blackcore/context/contextaudioimpl.h +++ b/src/blackcore/context/contextaudioimpl.h @@ -11,13 +11,13 @@ #ifndef BLACKCORE_CONTEXT_CONTEXTAUDIO_IMPL_H #define BLACKCORE_CONTEXT_CONTEXTAUDIO_IMPL_H -#include "blackcore/actionbind.h" -#include "blackcore/blackcoreexport.h" #include "blackcore/context/contextaudio.h" -#include "blackcore/corefacadeconfig.h" #include "blackcore/audio/audiosettings.h" +#include "blackcore/actionbind.h" +#include "blackcore/corefacadeconfig.h" #include "blackcore/voicechannel.h" #include "blackcore/audiomixer.h" +#include "blackcore/blackcoreexport.h" #include "blackmisc/audio/audiosettings.h" #include "blackmisc/audio/audiodeviceinfolist.h" #include "blackmisc/audio/notificationsounds.h" @@ -26,11 +26,11 @@ #include "blackmisc/aviation/callsignset.h" #include "blackmisc/aviation/comsystem.h" #include "blackmisc/aviation/selcal.h" +#include "blackmisc/macos/microphoneaccess.h" #include "blackmisc/identifier.h" #include "blackmisc/network/userlist.h" #include "blackmisc/settingscache.h" #include "blackmisc/icons.h" -#include "blackmisc/macos/microphoneaccess.h" #include "blacksound/selcalplayer.h" #include "blacksound/notificationplayer.h" @@ -121,7 +121,7 @@ namespace BlackCore CContextAudio *registerWithDBus(BlackMisc::CDBusServer *server); private: - // Voice COM channel + //! Voice COM channel enum COM { COM1, @@ -140,7 +140,7 @@ namespace BlackCore //! \sa IContextAudio::changedVoiceRooms void onConnectionStatusChanged(IVoiceChannel::ConnectionStatus oldStatus, IVoiceChannel::ConnectionStatus newStatus); - //! Enable/disable voice transmission @{ + //! Enable/disable voice transmission, nornally used with hotkey @{ void setVoiceTransmission(bool enable, COM com); void setVoiceTransmissionCom1(bool enabled); void setVoiceTransmissionCom2(bool enabled); @@ -162,7 +162,7 @@ namespace BlackCore //! Changed audio settings void onChangedAudioSettings(); - //! Audio increase/decrease @{ + //! Audio increase/decrease volume @{ void audioIncreaseVolume(bool enabled); void audioDecreaseVolume(bool enabled); //! @} @@ -193,9 +193,9 @@ namespace BlackCore std::unique_ptr m_voiceInputDevice; QList> m_unusedVoiceChannels; - QHash> m_voiceChannelMapping; - QHash, IAudioMixer::OutputPort> m_voiceChannelOutputPortMapping; - BlackSound::CSelcalPlayer *m_selcalPlayer = nullptr; + QHash> m_voiceChannelMapping; //!< COM unit to voice channel + QHash, IAudioMixer::OutputPort> m_voiceChannelOutputPortMapping; //!< channel to output port + BlackSound::CSelcalPlayer *m_selcalPlayer = nullptr; BlackSound::CNotificationPlayer m_notificationPlayer; // settings