Rhythm
Game Engines Final Project
Loading...
Searching...
No Matches
systems::audio::SoundSystem Class Reference

Manages and plays sounds within a scene. More...

Inheritance diagram for systems::audio::SoundSystem:

Public Member Functions

 this (Scene *owner)
 Constructs a SoundSystem with the given scene owner.
 
override void Update ()
 Updates the sound system, reducing frames and freeing sounds that have finished playing.
 
 typeof (this) PlaySound(string soundPath
 Plays a sound from the given file path for a specified number of frames.
 
 if (chunk==null)
 
 Mix_PlayChannel (-1, chunk, 0)
 
void OnSoundEnd (void delegate() callback)
 Sets the callback function to be called when a sound ends.
 

Public Attributes

int frames
 
Mix_Chunk * chunk = Mix_LoadWAV(soundPath.toStringz())
 
 mSounds = new Sound(chunk, frames)
 

Detailed Description

Manages and plays sounds within a scene.

Constructor & Destructor Documentation

◆ this()

systems::audio::SoundSystem::this ( Scene * owner)
inline

Constructs a SoundSystem with the given scene owner.

Parameters
ownerPointer to the scene that owns this sound system.

Member Function Documentation

◆ OnSoundEnd()

void systems::audio::SoundSystem::OnSoundEnd ( void delegate() callback)
inline

Sets the callback function to be called when a sound ends.

Parameters
callbackDelegate function to be called on sound end.

◆ typeof()

systems::audio::SoundSystem::typeof ( this )

Plays a sound from the given file path for a specified number of frames.

Parameters
soundPathPath to the sound file.
framesNumber of frames the sound should play.
Returns
Reference to the current SoundSystem instance.

Member Data Documentation

◆ frames

int systems::audio::SoundSystem::frames
Initial value:
{
writeln("Playing sound: ", soundPath)

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