Capycore Engine  0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
Loading...
Searching...
No Matches
sdl_sound_resource.h
Go to the documentation of this file.
1#pragma once
2
3#include <SDL3/SDL.h>
4#include <SDL3/SDL_audio.h>
7
14 public:
15 SDLSoundResource(const std::string& name, const std::string& file_path,
17 ~SDLSoundResource() override = default;
18
19 [[nodiscard]] const SDL_AudioSpec& audio_spec() const;
20 [[nodiscard]] const Uint8* audio_buffer() const;
21 [[nodiscard]] Uint32 length() const;
22
23 private:
24 SDL_AudioSpec spec_{};
25 Uint32 audio_length_{0};
26 std::unique_ptr<Uint8, decltype(&SDL_free)> audio_buffer_{nullptr, &SDL_free};
27};
Represents a SDL-specific resource. Inherits from the generic SoundResource class and contains SDL-sp...
Definition sdl_sound_resource.h:13
~SDLSoundResource() override=default
const Uint8 * audio_buffer() const
Uint32 length() const
const SDL_AudioSpec & audio_spec() const
SDLSoundResource(const std::string &name, const std::string &file_path, SoundType type=SoundType::SDL_MIXER)
Represents a generic sound resource in the audio engine. This class serves as a base for specific sou...
Definition sound_resource.h:12
const std::string & name() const noexcept
const SoundType & type() const noexcept
const std::string & file_path() const noexcept
SoundType
Definition sound_type.h:5