wavelength 1.0.0
Loading...
Searching...
No Matches
worldbeat.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "game/worldtrack.h"
6#include "os/command.h"
7#include "os/ptr.h"
8#include "os/scheduler.h"
9
16class WorldBeat {
17public:
26 class WorldBeatCmd : public Command {
27 public:
34 ~WorldBeatCmd() override = default;
35
45 int nLengthTicks,
46 std::vector<int> *pEvents,
47 char cLetter);
48
55 void Execute() override;
56
57 private:
58 Scheduler *mScheduler; // The scheduler the events run on.
59 int mLengthTicks; // The length of the song in ticks.
60 std::vector<int> *mEvents; // The ticks of the events.
61 char mLetter; // The letter.
62 int mFirst; // The first event at or after tick 0, or -1 for none.
63 int mIndex; // The event that ran last.
64 int mLoop; // The number of times the events have repeated.
65 };
66
76 WorldBeat(Scheduler *pScheduler, WorldTrack *pTrack, int nLengthTicks);
77
85
92 void Start();
93
100 void Stop();
101
102private:
103 Scheduler *mScheduler;
104 WorldTrack *mTrack;
105 std::vector<Ptr<Command>> mCommands;
106};
Unit of work a Scheduler runs at a set time.
Definition command.h:13
Queue of commands that run when the song clock reaches their tick.
Definition scheduler.h:20
~WorldBeatCmd() override=default
Destroy the object.
void Execute() override
Report the event and schedule the next one.
WorldBeatCmd(Scheduler *pScheduler, int nLengthTicks, std::vector< int > *pEvents, char cLetter)
Construct the command of a letter.
~WorldBeat()
Release the player.
WorldBeat(Scheduler *pScheduler, WorldTrack *pTrack, int nLengthTicks)
Construct the player of a track.
void Start()
Schedule the first event.
void Stop()
Withdraw the scheduled event.
The events of the track of a song named "WORLD", sorted by tick.
Definition worldtrack.h:11