9#include <unordered_map>
68 void PlaySound2D(
const std::string& filePath,
float volume = 1.0f,
float pitch = 1.0f,
bool loop =
false);
71 SDL_AudioDeviceID deviceID;
76 std::unordered_map<std::string, std::unique_ptr<AudioClip>>
clipCache;
79 std::unordered_map<vex::Entity, SDL_AudioStream*>
streamMap;
90 SDL_AudioStream* stream;
94 std::vector<StandaloneAudio> standaloneStreams;
Defines the AudioSourceComponent struct.
Contains basic components like transform, camera, name components..
Main header for the Entity Component System (ECS) framework.
This file defines VirtualFileSystem and VPKStream classes.
AudioSystem(vex::Registry ®)
Constructor for AudioSystem.
std::unordered_map< vex::Entity, SDL_AudioStream * > streamMap
Map linking entities to their active SDL audio streams.
void PlaySound2D(const std::string &filePath, float volume=1.0f, float pitch=1.0f, bool loop=false)
Quickly plays a 2D sound without requiring an entity or AudioSourceComponent.
void Shutdown()
Shuts down the audio system.
void Init(vex::VirtualFileSystem *vfs)
Initializes the audio subsystem and binding to the VFS.
std::unordered_map< std::string, std::unique_ptr< AudioClip > > clipCache
Cache of loaded audio clips to prevent reloading the same file multiple times. Key is the file path.
void Update(vex::Entity cameraEntity)
Main update loop for the audio system.
void OnAudioComponentDestroyed(vex::Registry ®istry, vex::Entity entity)
Callback triggered when an AudioSourceComponent is destroyed.
Central registry for managing entities and their components in the ECS system.
This class provides abstraction of file system needed for loading packed and unpacked assets.
uint32_t Entity
Type alias representing a unique entity identifier in the ECS system.