ToyMaker Game Engine 0.0.2
ToyMaker is a game engine developed and maintained by Zoheb Shujauddin.
Loading...
Searching...
No Matches
system.hpp
1#ifndef TOYMAKER_SOUNDSYSTEM_H
2#define TOYMAKER_SOUNDSYSTEM_H
3
5
6#include "types.hpp"
7
13
14namespace ToyMaker {
15
26 class SoundSystem: public System<SoundSystem, std::tuple<>, std::tuple<>> {
27 public:
28
35 inline explicit SoundSystem(std::weak_ptr<ECSWorld> world):
36 System<SoundSystem, std::tuple<>, std::tuple<>> { world }
37 {}
38
45 static std::string getSystemTypeName() { return "SoundSystem"; }
46
57 bool isSingleton() const override { return true; }
58
67
75 void onApplicationEnd();
76
84 std::unique_ptr<SoundChannel> createChannel();
85
92 float getMasterGain() const;
93
100 void setMasterGain(float newVolume);
101
102 private:
109 std::unique_ptr<SoundMixer> mMixer {};
110 };
111}
112
113#endif
void onApplicationEnd()
Called during the application shutdown procedure, destroying owned sound mixer device.
Definition system.cpp:8
SoundSystem(std::weak_ptr< ECSWorld > world)
Constructs a new SoundSystem object.
Definition system.hpp:35
bool isSingleton() const override
Informs this System's ECSWorld that the SoundSystem is a singleton, i.e., there should not be more th...
Definition system.hpp:57
static std::string getSystemTypeName()
The system type string associated with the SoundSystem.
Definition system.hpp:45
std::unique_ptr< SoundMixer > mMixer
The sound mixer managed by this system.
Definition system.hpp:109
float getMasterGain() const
Returns a value from 0 to 1, representing the factor by which the mixed sound is multiplied.
Definition system.cpp:16
void onApplicationInitialize()
Creates a sound mixer device object to be managed by this system.
Definition system.cpp:5
void setMasterGain(float newVolume)
Sets the volume of the mixed output sound.
Definition system.cpp:20
std::unique_ptr< SoundChannel > createChannel()
Returns a single sound channel, to be managed by the caller, mixed with other channels by this system...
Definition system.cpp:12
A system template that disables systems with this form of declaration.
Definition ecs_world.hpp:1085
ToyMaker Engine's implementation of an ECS system.
Namespace containing all class definitions and functions related to the ToyMaker engine.
Definition application.hpp:26
STL namespace.