0a68f23ee0
* Reinstates an allocator for FileCacheManager Replaces the allocator that was removed during redcode that is used for loading banks. Default schema for now to get things working again. * Update path functions to AZ::IO::Path Removes old PathUtil functions in favor of AZ::IO::Path apis. * Update the audio allocator classes Cleans up the audio allocator classes a bit. * Addresses PR feedback Updates some code to handle nullptr a bit better, and improve log messages. * Updates to audio CVars and address feedback Per feedback, converted more of the audio cvars to AZ_CVAR, but not all of them could be converted at this time. Moved audio allocator initialization to system component ctor/dtor to give RAII. Updated location of a PAL file. * Updates the copyright of the file added in this PR Merged copyright changes, so need to update new files.
98 lines
3.9 KiB
C++
98 lines
3.9 KiB
C++
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AzCore/Component/Component.h>
|
|
#include <AzFramework/API/ApplicationAPI.h>
|
|
#include <IAudioSystem.h>
|
|
#include <ISystem.h>
|
|
|
|
#if defined(AUDIO_SYSTEM_EDITOR)
|
|
#include <AzCore/std/smart_ptr/unique_ptr.h>
|
|
#include <Include/IPlugin.h>
|
|
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
|
#endif // AUDIO_SYSTEM_EDITOR
|
|
|
|
|
|
namespace AudioSystemGem
|
|
{
|
|
class AudioSystemGemSystemComponent
|
|
: public AZ::Component
|
|
, public ISystemEventListener
|
|
, public AzFramework::ApplicationLifecycleEvents::Bus::Handler
|
|
, protected Audio::Gem::AudioSystemGemRequestBus::Handler
|
|
#if defined(AUDIO_SYSTEM_EDITOR)
|
|
, private AzToolsFramework::EditorEvents::Bus::Handler
|
|
#endif // AUDIO_SYSTEM_EDITOR
|
|
{
|
|
public:
|
|
AZ_COMPONENT(AudioSystemGemSystemComponent, "{55095EE9-38E6-485F-8314-DF35CDFECC6B}", AZ::Component);
|
|
static void Reflect(AZ::ReflectContext* context);
|
|
|
|
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
|
|
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
|
|
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
|
|
static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
|
|
|
|
AudioSystemGemSystemComponent();
|
|
~AudioSystemGemSystemComponent() override;
|
|
|
|
protected:
|
|
////////////////////////////////////////////////////////////////////////
|
|
// AZ::Component interface implementation
|
|
void Init() override;
|
|
void Activate() override;
|
|
void Deactivate() override;
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
// Audio::Gem::AudioSystemGemRequestBus interface implementation
|
|
bool Initialize(const SSystemInitParams* initParams) override;
|
|
void Release() override;
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
// ISystemEventListener
|
|
void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam) override;
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
// AzFramework::ApplicationLifecycleEvents interface implementation
|
|
void OnApplicationConstrained(Event /*lastEvent*/) override;
|
|
void OnApplicationUnconstrained(Event /*lastEvent*/) override;
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
#if defined(AUDIO_SYSTEM_EDITOR)
|
|
////////////////////////////////////////////////////////////////////////
|
|
// AzToolsFramework::EditorEvents::Bus interface implementation
|
|
void NotifyRegisterViews() override;
|
|
void NotifyIEditorAvailable(IEditor*) override;
|
|
////////////////////////////////////////////////////////////////////////
|
|
#endif // AUDIO_SYSTEM_EDITOR
|
|
|
|
private:
|
|
////////////////////////////////////////////////////////////////////////
|
|
bool CreateAudioSystem();
|
|
bool CreateNullAudioSystem();
|
|
void PrepareAudioSystem();
|
|
|
|
Audio::SAudioRequest m_loseFocusRequest;
|
|
Audio::SAudioRequest m_getFocusRequest;
|
|
Audio::SAudioManagerRequestData<Audio::eAMRT_LOSE_FOCUS> m_loseFocusData;
|
|
Audio::SAudioManagerRequestData<Audio::eAMRT_GET_FOCUS> m_getFocusData;
|
|
|
|
/// This is here to express ownership
|
|
AZStd::unique_ptr<Audio::IAudioSystem> m_audioSystem;
|
|
|
|
#if defined(AUDIO_SYSTEM_EDITOR)
|
|
AZStd::unique_ptr<IPlugin> m_editorPlugin;
|
|
#endif // AUDIO_SYSTEM_EDITOR
|
|
};
|
|
|
|
} // namespace AudioSystemGem
|