diff --git a/include/SparkyStudios/Audio/Amplitude/Core/Engine.h b/include/SparkyStudios/Audio/Amplitude/Core/Engine.h index 76ac376..62674e6 100644 --- a/include/SparkyStudios/Audio/Amplitude/Core/Engine.h +++ b/include/SparkyStudios/Audio/Amplitude/Core/Engine.h @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -77,7 +76,7 @@ namespace SparkyStudios::Audio::Amplitude * and provides methods to create, destroy, and manipulate them. You can also * access to the internal state of the engine through the public API. * - * The `Engine` is a singleton class and you can access it using the `amEngine` macro. Before + * The `Engine` is a singleton class, and you can access it using the `amEngine` macro. Before * using most of the methods of the engine, you need to [initialize the * engine](../../../integration/initializing-the-engine.md) first, for example: * ```cpp @@ -397,7 +396,7 @@ namespace SparkyStudios::Audio::Amplitude * @brief Starts the loading of sound files referenced in loaded sound banks. * * This process will run in another thread. You must call @ref TryFinalizeLoadSoundFiles `TryFinalizeLoadSoundFiles()` to - * know when the loading has completed, and to automaticaly release used resources. + * know when the loading has completed, and to automatically release used resources. */ virtual void StartLoadSoundFiles() = 0; @@ -578,7 +577,7 @@ namespace SparkyStudios::Audio::Amplitude * @example * ```cpp * // Assuming the asset file is located in "sounds/env/forest/calm_lake_bg.amsound" - * // Note that the return value in this case is a indeed a `SoundHandle` + * // Note that the return value in this case is indeed a `SoundHandle` * SoundObjectHandle handle = amEngine->GetSoundObjectHandleFromFile("env/forest/calm_lake_bg.amsound"); * ``` * @@ -1746,7 +1745,7 @@ namespace SparkyStudios::Audio::Amplitude #pragma region Singleton Implementation /** - * @brief Returns an unique instance of the Amplitude Engine. + * @brief Returns a unique instance of the Amplitude Engine. */ [[nodiscard]] static Engine* GetInstance(); diff --git a/src/Core/Engine.cpp b/src/Core/Engine.cpp index a3758b2..711d058 100644 --- a/src/Core/Engine.cpp +++ b/src/Core/Engine.cpp @@ -455,6 +455,10 @@ namespace SparkyStudios::Audio::Amplitude Engine* Engine::GetInstance() { + // Cannot implement the singleton pattern with an uninitialized memory manager. + if (!MemoryManager::IsInitialized()) + return nullptr; + // Amplitude Engine unique instance. if (gAmplitude == nullptr) gAmplitude.reset(ampoolnew(eMemoryPoolKind_Engine, EngineImpl)); diff --git a/src/Mixer/Amplimix.h b/src/Mixer/Amplimix.h index 5cc479e..ffe9f80 100644 --- a/src/Mixer/Amplimix.h +++ b/src/Mixer/Amplimix.h @@ -85,7 +85,7 @@ namespace SparkyStudios::Audio::Amplitude AmMutexHandle mutex = nullptr; // mutex for thread-safe access std::unordered_map mutexLocked; // true if mutex is locked - ~AmplimixLayerImpl(); + ~AmplimixLayerImpl() override; /** * @brief Resets the layer.