CPP-TOOLBOX
Loading...
Searching...
No Matches
SoundSystem Class Reference

#include <sound_system.hpp>

Public Member Functions

 SoundSystem (int num_sources=100, const std::unordered_map< SoundType, std::string > &sound_type_to_file={})
 
void queue_sound (SoundType type, glm::vec3 position=glm::vec3(0))
 
unsigned int queue_looping_sound (SoundType type, glm::vec3 position)
 
void stop_looping_sound (const unsigned int &source_id)
 
void play_all_sounds ()
 
void set_listener_position (float x, float y, float z)
 
 ~SoundSystem ()
 
void load_sound_into_system_for_playback (const std::string &sound_name, const char *filename)
 
void create_sound_source (const std::string &source_name)
 
void set_source_gain_by_name (const std::string &source_name, float gain)
 
void set_source_looping_by_name (const std::string &source_name, bool looping)
 
void play_sound (const std::string &source_name, const std::string &sound_name)
 
void set_listener_orientation (const glm::vec3 &forward, const glm::vec3 &up)
 

Public Attributes

Logger logger = Logger("sound_system")
 

Constructor & Destructor Documentation

◆ SoundSystem()

SoundSystem::SoundSystem ( int num_sources = 100,
const std::unordered_map< SoundType, std::string > & sound_type_to_file = {} )

◆ ~SoundSystem()

SoundSystem::~SoundSystem ( )

Member Function Documentation

◆ create_sound_source()

void SoundSystem::create_sound_source ( const std::string & source_name)

◆ load_sound_into_system_for_playback()

void SoundSystem::load_sound_into_system_for_playback ( const std::string & sound_name,
const char * filename )

◆ play_all_sounds()

void SoundSystem::play_all_sounds ( )

◆ play_sound()

void SoundSystem::play_sound ( const std::string & source_name,
const std::string & sound_name )

I think this is deprecated

Bug
if you try to play a sound which is already playing this fails, need to enqueue the sound for playback or somehow play two at once? or just overwrite the last sound playing.

◆ queue_looping_sound()

unsigned int SoundSystem::queue_looping_sound ( SoundType type,
glm::vec3 position )
nodiscard

◆ queue_sound()

void SoundSystem::queue_sound ( SoundType type,
glm::vec3 position = glm::vec3(0) )

◆ set_listener_orientation()

void SoundSystem::set_listener_orientation ( const glm::vec3 & forward,
const glm::vec3 & up )

◆ set_listener_position()

void SoundSystem::set_listener_position ( float x,
float y,
float z )

◆ set_source_gain_by_name()

void SoundSystem::set_source_gain_by_name ( const std::string & source_name,
float gain )

◆ set_source_looping_by_name()

void SoundSystem::set_source_looping_by_name ( const std::string & source_name,
bool looping )

◆ stop_looping_sound()

void SoundSystem::stop_looping_sound ( const unsigned int & source_id)

Member Data Documentation

◆ logger

Logger SoundSystem::logger = Logger("sound_system")

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