Krotos Modules 3
Loading...
Searching...
No Matches
MuteStateMachine.h
Go to the documentation of this file.
1#pragma once
2
3namespace krotos
4{
6 {
7 public:
15
16 inline void nextState(bool targetMuteState) // Calculate what to do next
17 {
18 if (targetMuteState) // If the user wants mute
19 {
20 switch (m_currentState)
21 {
25 break;
28 break;
30 default: // If aready muted, state doesn't change
31 break;
32 }
33 }
34 else // If the user wants un-mute
35 {
36 switch (m_currentState)
37 {
41 break;
44 break;
46 default: // If aready playing, state doesn't change
47 break;
48 }
49 }
50 }
51
52 inline bool isMuted() { return m_currentState == MuteState::Muted; }
53
55
56 inline bool isNotRamping()
57 {
59 }
60
62
63 inline bool isMuted(bool targetMuteState)
64 {
65 nextState(targetMuteState);
66 return isMuted();
67 }
68
69 inline bool isPlaying() { return m_currentState != MuteState::Muted; }
70
71 private:
73 };
74} // namespace krotos
Definition MuteStateMachine.h:6
bool isRampingDown()
Definition MuteStateMachine.h:61
bool isPlaying()
Definition MuteStateMachine.h:69
MuteState m_currentState
Definition MuteStateMachine.h:72
bool isNotRamping()
Definition MuteStateMachine.h:56
bool isPlayingWithNoRamp()
Definition MuteStateMachine.h:54
MuteState
Definition MuteStateMachine.h:9
@ Muted
Definition MuteStateMachine.h:10
@ RampUp
Definition MuteStateMachine.h:11
@ RampDown
Definition MuteStateMachine.h:12
@ Playing
Definition MuteStateMachine.h:13
bool isMuted()
Definition MuteStateMachine.h:52
void nextState(bool targetMuteState)
Definition MuteStateMachine.h:16
bool isMuted(bool targetMuteState)
Definition MuteStateMachine.h:63
Definition AirAbsorptionFilter.cpp:2