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
+9 -11
View File
@@ -97,6 +97,7 @@ AZ_POP_DISABLE_WARNING
#include "ActionManager.h"
#include <ImGuiBus.h>
#include <LmbrCentral/Audio/AudioSystemComponentBus.h>
using namespace AZ;
using namespace AzQtComponents;
@@ -1474,25 +1475,22 @@ int MainWindow::ViewPaneVersion() const
void MainWindow::OnStopAllSounds()
{
Audio::SAudioRequest oStopAllSoundsRequest;
Audio::SAudioManagerRequestData<Audio::eAMRT_STOP_ALL_SOUNDS> oStopAllSoundsRequestData;
oStopAllSoundsRequest.pData = &oStopAllSoundsRequestData;
CryLogAlways("<Audio> Executed \"Stop All Sounds\" command.");
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequest, oStopAllSoundsRequest);
LmbrCentral::AudioSystemComponentRequestBus::Broadcast(&LmbrCentral::AudioSystemComponentRequestBus::Events::GlobalStopAllSounds);
}
void MainWindow::OnRefreshAudioSystem()
{
QString sLevelName = GetIEditor()->GetGameEngine()->GetLevelName();
AZStd::string levelName;
AzToolsFramework::EditorRequestBus::BroadcastResult(levelName, &AzToolsFramework::EditorRequestBus::Events::GetLevelName);
AZStd::to_lower(levelName.begin(), levelName.end());
if (QString::compare(sLevelName, "Untitled", Qt::CaseInsensitive) == 0)
if (levelName == "untitled")
{
// Rather pass nullptr to indicate that no level is loaded!
sLevelName = QString();
levelName.clear();
}
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::RefreshAudioSystem, sLevelName.toUtf8().data());
LmbrCentral::AudioSystemComponentRequestBus::Broadcast(
&LmbrCentral::AudioSystemComponentRequestBus::Events::GlobalRefreshAudio, AZStd::string_view{ levelName });
}
void MainWindow::SaveLayout()