|
Brenta Engine 1.2
|
Audio subsystem. More...
#include <audio.hpp>
Data Structures | |
| class | builder |
Public Types | |
| enum class | error : int { init_from_file , stream_not_found , sound_not_found , stream_init , stream_stop , stream_start } |
Public Types inherited from brenta::subsystem | |
| using | error = std::string |
Public Member Functions | |
| std::expected< void, subsystem::error > | initialize () override |
| Initialize the audio subsystem. | |
| std::expected< void, subsystem::error > | terminate () override |
| Terminate the audio system. | |
| std::string | name () override |
| Returns the name of the sybsystem. | |
| bool | is_initialized () override |
| Returns true if the subsystem is initialized. | |
Public Member Functions inherited from brenta::subsystem | |
Static Public Member Functions | |
| static audio & | instance () |
| static std::expected< void, audio::error > | load (const types::sound_id_t &sound_id, const std::string &path, const types::stream_id_t &stream_id="default") |
| Load a sound from path on a stream. | |
| static std::expected< void, audio::error > | play (const types::sound_id_t &id) |
| Play a sound on its stream. | |
| static std::expected< void, audio::error > | create_stream (const types::stream_id_t &id) |
| static types::stream_t * | get_stream (const types::stream_id_t &id) |
| static std::expected< void, audio::error > | stream_stop (const types::stream_id_t &id) |
| static std::expected< void, audio::error > | stream_start (const types::stream_id_t &id) |
| static std::expected< void, audio::error > | stream_set_volume (const types::stream_id_t &id, float volume) |
| Set the volume of a stream. | |
Static Public Attributes | |
| static std::unordered_map< types::sound_id_t, types::sound_t > | sounds |
| Map of sound files. | |
| static std::unordered_map< types::stream_id_t, types::stream_t > | streams |
| Map of audio streams. | |
| static const std::string | subsystem_name = "audio" |
Audio subsystem.
This class contains the audio subsystem of the engine. It is used to load audio files, create audio streams, play audio files on streams, set the volume, start and stop streams. The audio subsystem needs to be initialized and destroyed via initialize() and terminate(). Audio files and streams are stored in maps and are identified by a string id.
|
static |
|
static |
|
overridevirtual |
Initialize the audio subsystem.
This function initializes the audio subsystem of the engine. It creates a default stream called "default".
Implements brenta::subsystem.
|
overridevirtual |
Returns true if the subsystem is initialized.
Implements brenta::subsystem.
|
static |
|
overridevirtual |
Returns the name of the sybsystem.
Implements brenta::subsystem.
|
static |
|
static |
|
static |
|
static |
|
overridevirtual |
Terminate the audio system.
This function frees all audio streams and sound files, and closes the audio subsystem.
Implements brenta::subsystem.
|
static |
|
static |