8#ifndef RTYPE_AUDIO_SYSTEM_HPP_
9#define RTYPE_AUDIO_SYSTEM_HPP_
16#include <SFML/Audio.hpp>
17#include <unordered_map>
39 void update(
float dt)
override;
76 std::unordered_map<std::string, std::unique_ptr<sf::SoundBuffer>>
_soundBuffers;
Interface for ECS systems.
System responsible for handling audio playback (music, SFX, ambient)
void setSfxVolume(float volume)
Set SFX volume (affects SoundEvent components)
void updateAudioSources(float dt)
Update all AudioSource components.
ecs::Registry & _registry
void update(float dt) override
Update audio system (called every frame)
void stopAllSounds()
Stop all currently playing sounds.
std::unordered_map< uint32_t, bool > _soundIsMusic
Track if sound is music (true) or SFX (false)
std::unordered_map< uint32_t, float > _soundBaseVolumes
Track base volume (0.0-1.0) for each sound.
void cleanupFinishedSounds()
Remove finished non-looping sounds from tracking.
float getMasterVolume() const
Get current master volume.
std::unordered_map< uint32_t, std::unique_ptr< sf::Sound > > _activeSounds
void setMusicVolume(float volume)
Set music volume (affects AudioSource components)
void updateSoundEvents(float dt)
Update all SoundEvent components.
void playSoundEffect(ecs::components::audio::SoundEvent &soundEvent)
Play a sound effect (one-time)
std::unordered_map< std::string, std::unique_ptr< sf::SoundBuffer > > _soundBuffers
std::unordered_map< uint32_t, bool > _loopingSounds
Track which sounds should loop.
void playAudioSource(ecs::components::audio::AudioSource &audioSource)
Play an AudioSource.
void setMasterVolume(float volume)
Set master volume for all audio.
sf::SoundBuffer * loadSoundBuffer(const std::string &path)
Load or get cached sound buffer.
Abstract base class for all ECS systems.
Component for entities that emit continuous sound (music, loops, ambient)
Component for triggering one-time sound effects (SFX)