diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index c17dca0871..14bb380277 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/audio.cpp" + "src/audio/bridge.cpp" + "src/assets/plugin.cpp" "src/assets/assets.cpp" "src/assets/bridge.cpp" diff --git a/engine/include/cubos/engine/audio/audio.hpp b/engine/include/cubos/engine/audio/audio.hpp new file mode 100644 index 0000000000..82a9aca1fc --- /dev/null +++ b/engine/include/cubos/engine/audio/audio.hpp @@ -0,0 +1,27 @@ +/// @file +/// @brief Class @ref cubos::engine::Audio. +/// @ingroup audio-plugin +#pragma once + +#include +#include +#include + +#include + +namespace cubos::engine +{ + /// @brief Asset containing raw Audio data. + /// + /// @ingroup audio-plugin + struct CUBOS_ENGINE_API Audio + { + CUBOS_REFLECT; + std::shared_ptr mData; // Raw data of the audio + size_t mLength; // Audio length in seconds TODO: add getter in audio + + explicit Audio(core::memory::Stream& stream); + Audio(Audio&& other) noexcept; + ~Audio(); + }; +} // namespace cubos::engine diff --git a/engine/include/cubos/engine/audio/bridge.hpp b/engine/include/cubos/engine/audio/bridge.hpp new file mode 100644 index 0000000000..576afe8cdd --- /dev/null +++ b/engine/include/cubos/engine/audio/bridge.hpp @@ -0,0 +1,30 @@ +/// @file +/// @brief Class @ref cubos::engine::AudioBridge. +/// @ingroup audio-plugin + +#pragma once + +#include +#include + +namespace cubos::engine +{ + /// @brief Bridge which loads and saves @ref Sound assets. + /// + /// Uses the format specified in @ref Audio::loadFrom and @ref Audio::writeTo + /// + /// @ingroup audio-plugin + class AudioBridge : public FileBridge + { + public: + /// @brief Constructs a bridge. + AudioBridge() + : FileBridge(core::reflection::reflect