Capycore Engine  0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
Loading...
Searching...
No Matches
AudioService Class Reference

Manages audio playback and sound instances within the engine. More...

#include <audio_service.h>

Inheritance diagram for AudioService:
[legend]

Public Member Functions

 AudioService ()=default
 
std::optional< std::shared_ptr< SoundResource > > register_sound (const std::string &file_path, const std::string &name, SoundType type=SoundType::GENERIC)
 
bool unregister_sound (const std::string &name)
 
std::optional< std::shared_ptr< SoundResource > > get_sound_resource (const std::string &file_path, const std::string &name="") const noexcept
 
std::reference_wrapper< SoundInstanceplay_sound (std::shared_ptr< SoundResource > sound_resource, float volume=1.0f, bool loop=false)
 
std::reference_wrapper< SoundInstanceplay_sound (const std::string &name, float volume=1.0f, bool loop=false)
 
void stop_sound (SoundInstance &instance)
 
void stop_sound (const std::string &name)
 
void stop_all_sounds ()
 
bool has_sound_instance (const std::string &name) const noexcept
 
std::optional< std::reference_wrapper< SoundInstance > > get_sound_instance (const std::string &name) const
 
std::vector< std::reference_wrapper< SoundInstance > > get_all_playing_sounds () const
 
void update ()
 Updates the audio manager, meaning it cleans up finished sounds.
 
- Public Member Functions inherited from IEngineService
virtual ~IEngineService ()=default
 

Detailed Description

Manages audio playback and sound instances within the engine.

Constructor & Destructor Documentation

◆ AudioService()

AudioService::AudioService ( )
default

Member Function Documentation

◆ get_all_playing_sounds()

std::vector< std::reference_wrapper< SoundInstance > > AudioService::get_all_playing_sounds ( ) const

◆ get_sound_instance()

std::optional< std::reference_wrapper< SoundInstance > > AudioService::get_sound_instance ( const std::string &  name) const

◆ get_sound_resource()

std::optional< std::shared_ptr< SoundResource > > AudioService::get_sound_resource ( const std::string &  file_path,
const std::string &  name = "" 
) const
noexcept

◆ has_sound_instance()

bool AudioService::has_sound_instance ( const std::string &  name) const
noexcept

◆ play_sound() [1/2]

std::reference_wrapper< SoundInstance > AudioService::play_sound ( const std::string &  name,
float  volume = 1.0f,
bool  loop = false 
)

◆ play_sound() [2/2]

std::reference_wrapper< SoundInstance > AudioService::play_sound ( std::shared_ptr< SoundResource sound_resource,
float  volume = 1.0f,
bool  loop = false 
)

◆ register_sound()

std::optional< std::shared_ptr< SoundResource > > AudioService::register_sound ( const std::string &  file_path,
const std::string &  name,
SoundType  type = SoundType::GENERIC 
)

◆ stop_all_sounds()

void AudioService::stop_all_sounds ( )

◆ stop_sound() [1/2]

void AudioService::stop_sound ( const std::string &  name)

◆ stop_sound() [2/2]

void AudioService::stop_sound ( SoundInstance instance)

◆ unregister_sound()

bool AudioService::unregister_sound ( const std::string &  name)

◆ update()

void AudioService::update ( )

Updates the audio manager, meaning it cleans up finished sounds.


The documentation for this class was generated from the following file: