|
ToyMaker Game Engine 0.0.2
ToyMaker is a game engine developed and maintained by Zoheb Shujauddin.
|
System responsible for servicing sound playback commands from the game and managing platform audio hardware. More...
#include <system.hpp>
Public Member Functions | |
| SoundSystem (std::weak_ptr< ECSWorld > world) | |
| Constructs a new SoundSystem object. | |
| bool | isSingleton () const override |
| Informs this System's ECSWorld that the SoundSystem is a singleton, i.e., there should not be more than one instance of it in the entire project, regardless of how many ECSWorlds are present. | |
| void | onApplicationInitialize () |
| Creates a sound mixer device object to be managed by this system. | |
| void | onApplicationEnd () |
| Called during the application shutdown procedure, destroying owned sound mixer device. | |
| std::unique_ptr< SoundChannel > | createChannel () |
| Returns a single sound channel, to be managed by the caller, mixed with other channels by this system. | |
| float | getMasterGain () const |
| Returns a value from 0 to 1, representing the factor by which the mixed sound is multiplied. | |
| void | setMasterGain (float newVolume) |
| Sets the volume of the mixed output sound. | |
Static Public Member Functions | |
| static std::string | getSystemTypeName () |
| The system type string associated with the SoundSystem. | |
Private Attributes | |
| std::unique_ptr< SoundMixer > | mMixer {} |
| The sound mixer managed by this system. | |
System responsible for servicing sound playback commands from the game and managing platform audio hardware.
@NOTE: Mainly just a simple wrapper over SDL_mixer, since I haven't fully worked out quite how I'd like to manage this
|
inlineexplicit |
Constructs a new SoundSystem object.
| world | The world this SoundSystem will belong to, which is always the prototype ECSWorld. |
| std::unique_ptr< SoundChannel > SoundSystem::createChannel | ( | ) |
Returns a single sound channel, to be managed by the caller, mixed with other channels by this system.
As a general rule, use this for sounds that play continuously.
| float SoundSystem::getMasterGain | ( | ) | const |
Returns a value from 0 to 1, representing the factor by which the mixed sound is multiplied.
0 means silence, while 1 means the mixed sound is left untouched.
|
inlinestatic |
The system type string associated with the SoundSystem.
|
inlineoverride |
Informs this System's ECSWorld that the SoundSystem is a singleton, i.e., there should not be more than one instance of it in the entire project, regardless of how many ECSWorlds are present.
| true | SoundSystem is a singleton System; |
@TODO: This is obviously stupid and I should do something about it.
| void SoundSystem::onApplicationEnd | ( | ) |
Called during the application shutdown procedure, destroying owned sound mixer device.
@TODO: Clarify relationship between singleton systems and ECS. Right now, this call is made manually by Application, explicitly once per singleton system.
| void SoundSystem::onApplicationInitialize | ( | ) |
Creates a sound mixer device object to be managed by this system.
@TODO: Clarify relationship between singleton systems and ECS. Right now, this call is made manually by Application, explicitly once per singleton system.
| void SoundSystem::setMasterGain | ( | float | newVolume | ) |
Sets the volume of the mixed output sound.
0 means silence, while 1 means the mixed sound is untouched.
|
private |
The sound mixer managed by this system.
Allocated once SoundSystem::onApplicationInitialize is called.