Audio legacy cleanup - Move global functions to be handled by AudioSystemComponent (#3283)

* Removes legacy audio listener updates from ViewSys

These functions were empty and logging a warning, removed.

Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>

* Move more audio functions to AudioSystemComponent

For global actions like Mute/Unmute, Reload, StopAll, Load/Unload Level,
we move those functions to be handled by the AudioSystemComponent in
LmbrCentral.  This lets us remove some includes of IAudioSystem.h from
Editor and Legacy/CrySystem.

There were several locations where audio banks were being loaded and
unloaded for a level.  Now they all call into the AudioSystemComponent
and we don't have multiple copies of the same code.

Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
This commit is contained in:
amzn-phist
2021-08-17 17:59:09 -05:00
committed by GitHub
parent 3e51240a05
commit 078e0a8693
17 changed files with 192 additions and 246 deletions
+27 -14
View File
@@ -43,6 +43,8 @@
#include <AzCore/Casting/numeric_cast.h>
#include <AzToolsFramework/Viewport/ViewportMessages.h>
#include <LmbrCentral/Audio/AudioSystemComponentBus.h>
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include "ui_ViewportTitleDlg.h"
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
@@ -119,17 +121,20 @@ CViewportTitleDlg::CViewportTitleDlg(QWidget* pParent)
LoadCustomPresets("AspectRatioPresets", "AspectRatioPreset", m_customAspectRatioPresets);
LoadCustomPresets("ResPresets", "ResPreset", m_customResPresets);
// audio request setup
m_oMuteAudioRequest.pData = &m_oMuteAudioRequestData;
m_oUnmuteAudioRequest.pData = &m_oUnmuteAudioRequestData;
SetupCameraDropdownMenu();
SetupResolutionDropdownMenu();
SetupViewportInformationMenu();
SetupHelpersButton();
SetupOverflowMenu();
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequest, gSettings.bMuteAudio ? m_oMuteAudioRequest : m_oUnmuteAudioRequest);
if (gSettings.bMuteAudio)
{
LmbrCentral::AudioSystemComponentRequestBus::Broadcast(&LmbrCentral::AudioSystemComponentRequestBus::Events::GlobalMuteAudio);
}
else
{
LmbrCentral::AudioSystemComponentRequestBus::Broadcast(&LmbrCentral::AudioSystemComponentRequestBus::Events::GlobalUnmuteAudio);
}
connect(this, &CViewportTitleDlg::ActionTriggered, MainWindow::instance()->GetActionManager(), &ActionManager::ActionTriggered);
@@ -877,25 +882,33 @@ void CViewportTitleDlg::OnBnClickedGotoPosition()
void CViewportTitleDlg::OnBnClickedMuteAudio()
{
gSettings.bMuteAudio = !gSettings.bMuteAudio;
Audio::AudioSystemRequestBus::Broadcast(
&Audio::AudioSystemRequestBus::Events::PushRequest, gSettings.bMuteAudio ? m_oMuteAudioRequest : m_oUnmuteAudioRequest);
if (gSettings.bMuteAudio)
{
LmbrCentral::AudioSystemComponentRequestBus::Broadcast(&LmbrCentral::AudioSystemComponentRequestBus::Events::GlobalMuteAudio);
}
else
{
LmbrCentral::AudioSystemComponentRequestBus::Broadcast(&LmbrCentral::AudioSystemComponentRequestBus::Events::GlobalUnmuteAudio);
}
UpdateMuteActionText();
}
void CViewportTitleDlg::UpdateMuteActionText()
{
if (!Audio::AudioSystemRequestBus::HasHandlers())
{
m_audioMuteAction->setEnabled(false);
m_audioMuteAction->setText(tr("Mute Audio: Enable Audio Gem"));
}
else
bool audioSystemConnected = false;
LmbrCentral::AudioSystemComponentRequestBus::BroadcastResult(
audioSystemConnected, &LmbrCentral::AudioSystemComponentRequestBus::Events::IsAudioSystemInitialized);
if (audioSystemConnected)
{
m_audioMuteAction->setEnabled(true);
m_audioMuteAction->setText(gSettings.bMuteAudio ? tr("Un-mute Audio") : tr("Mute Audio"));
}
else
{
m_audioMuteAction->setEnabled(false);
m_audioMuteAction->setText(tr("Mute Audio: Enable Audio Gem"));
}
}
void CViewportTitleDlg::OnHMDInitialized()