Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
AudioLoader.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <filesystem>
5#include <vector>
6
7namespace Engine::Assets {
8
12 struct AudioData {
13 uint32_t sampleRate = 0;
14 uint32_t channels = 0;
15 uint64_t frameCount = 0;
16 std::vector<float> pcmData;
17
18 [[nodiscard]] float getDurationSeconds() const {
19 return sampleRate > 0 ? static_cast<float>(frameCount) / static_cast<float>(sampleRate) : 0.0f;
20 }
21 };
22
23 namespace Loaders
24 {
32 public:
38 static AudioData load(const std::filesystem::path& path);
39 };
40 }
41
42} // namespace EngineCore
Loader for audio files using miniaudio's built-in decoders.
Definition AudioLoader.h:31
static AudioData load(const std::filesystem::path &path)
Decode an audio file to PCM float data.
Decoded audio data ready for playback.
Definition AudioLoader.h:12
float getDurationSeconds() const
Definition AudioLoader.h:18
std::vector< float > pcmData
Interleaved float samples.
Definition AudioLoader.h:16