From 2b9a02d6c4c70c9694dd46e06e874e7f2895b0ea Mon Sep 17 00:00:00 2001 From: Diogo Miranda Date: Wed, 2 Oct 2024 17:43:42 +0100 Subject: [PATCH] feat(audio): Add AudioPlugin --- engine/CMakeLists.txt | 3 ++ engine/include/cubos/engine/audio/audio.hpp | 2 +- engine/include/cubos/engine/audio/bridge.hpp | 4 +- .../include/cubos/engine/audio/listener.hpp | 22 ++++++++++ engine/include/cubos/engine/audio/plugin.hpp | 40 +++++++++++++++++++ engine/include/cubos/engine/audio/source.hpp | 20 ++++++++++ engine/src/audio/audio.cpp | 2 +- engine/src/audio/listener.cpp | 11 +++++ engine/src/audio/plugin.cpp | 39 ++++++++++++++++++ engine/src/audio/source.cpp | 9 +++++ 10 files changed, 148 insertions(+), 4 deletions(-) create mode 100644 engine/include/cubos/engine/audio/listener.hpp create mode 100644 engine/include/cubos/engine/audio/plugin.hpp create mode 100644 engine/include/cubos/engine/audio/source.hpp create mode 100644 engine/src/audio/listener.cpp create mode 100644 engine/src/audio/plugin.cpp create mode 100644 engine/src/audio/source.cpp diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 14bb380277..ef63e69c80 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -36,6 +36,9 @@ set(CUBOS_ENGINE_SOURCE "src/utils/free_camera/plugin.cpp" "src/utils/free_camera/controller.cpp" + "src/audio/plugin.cpp" + "src/audio/source.cpp" + "src/audio/listener.cpp" "src/audio/audio.cpp" "src/audio/bridge.cpp" diff --git a/engine/include/cubos/engine/audio/audio.hpp b/engine/include/cubos/engine/audio/audio.hpp index 62f7c3bda4..b7c6bc568c 100644 --- a/engine/include/cubos/engine/audio/audio.hpp +++ b/engine/include/cubos/engine/audio/audio.hpp @@ -20,7 +20,7 @@ namespace cubos::engine std::shared_ptr mData; // Raw data of the audio size_t mLength; // Audio length in seconds TODO: add getter in audio - explicit Audio(std::shared_ptr, core::memory::Stream& stream); + explicit Audio(std::shared_ptr, core::memory::Stream& stream); Audio(Audio&& other) noexcept; ~Audio(); }; diff --git a/engine/include/cubos/engine/audio/bridge.hpp b/engine/include/cubos/engine/audio/bridge.hpp index fb196361a1..6fd5209668 100644 --- a/engine/include/cubos/engine/audio/bridge.hpp +++ b/engine/include/cubos/engine/audio/bridge.hpp @@ -17,10 +17,10 @@ namespace cubos::engine class AudioBridge : public FileBridge { public: - std::shared_ptr mContext; + std::shared_ptr mContext; /// @brief Constructs a bridge. - AudioBridge(std::shared_ptr context) + AudioBridge(std::shared_ptr context) : FileBridge(core::reflection::reflect