wavelength 1.0.0
Loading...
Searching...
No Matches
forcefeedbackmgrbeatcmd.h
Go to the documentation of this file.
1#pragma once
2
6#include "os/command.h"
7#include "os/scheduler.h"
8
15public:
22 ~BeatCmd() override = default;
23
25 BeatCmd() : mPeriod(0) {
26 }
27
35 void Execute() override {
36 for (const auto &pController : TheForceFeedbackMgr->GetControllers()) {
37 if (pController->GetEnabled() && !pController->IsPlayingEffect()) {
38 pController->GetBeatEffect()->Start();
39 }
40 }
41 TheSongScheduler.PostIn(this, mPeriod, false);
42 }
43
49 void SetPeriod(int nPeriod) {
50 mPeriod = nPeriod;
51 }
52
53private:
54 int mPeriod;
55};
Unit of work a Scheduler runs at a set time.
Definition command.h:13
Command that runs the beat pulse once a period.
Definition forcefeedbackmgrbeatcmd.h:14
~BeatCmd() override=default
Destroy the object.
void SetPeriod(int nPeriod)
Set the ticks between two pulses.
Definition forcefeedbackmgrbeatcmd.h:49
void Execute() override
Start the beat pulse of every enabled controller that plays no effect, and run again a period later.
Definition forcefeedbackmgrbeatcmd.h:35
BeatCmd()
Construct the command with no period.
Definition forcefeedbackmgrbeatcmd.h:25
ForceFeedbackMgr * TheForceFeedbackMgr
The vibration manager, ForceFeedbackMgr::shared() as the unit's static initialiser stored it.
Scheduler TheSongScheduler
The scheduler of the song clock.