wavelength 1.0.0
Loading...
Searching...
No Matches
muselooper.h
Go to the documentation of this file.
1#pragma once
2
3#include "gs/muse.h"
4#include "os/command.h"
5#include "os/ptr.h"
6#include "os/scheduler.h"
7
15public:
21 class RepeatCmd : public Command {
22 public:
29 ~RepeatCmd() override = default;
30
36 explicit RepeatCmd(MuseLooper *pLooper) : mLooper(pLooper) {
37 }
38
45 void Execute() override;
46
47 private:
48 MuseLooper *mLooper;
49 };
50
59 MuseLooper(Muse *pMuse, int nLength);
60
68
77 void Play(Scheduler *pScheduler, int nPosition);
78
85 void Stop();
86
94 bool IsPlaying() const;
95
103 int GetLength() const;
104
112 int GetPosition() const;
113
114private:
115 Ptr<Command> mRepeatCmd;
116 Ptr<Muse> mMuse;
117 int mLength;
118 int mStartTick;
119 Scheduler *mScheduler;
120};
Unit of work a Scheduler runs at a set time.
Definition command.h:13
~RepeatCmd() override=default
Destroy the object.
void Execute() override
Restart the piece and schedule the end of the new loop.
RepeatCmd(MuseLooper *pLooper)
Construct the command of a looper.
Definition muselooper.h:36
bool IsPlaying() const
Report whether the piece plays.
void Stop()
Stop the piece and withdraw the repeat.
int GetPosition() const
Report the position of the scheduler in the current loop.
~MuseLooper()
Stop the piece and release it.
int GetLength() const
Report the ticks of one loop.
void Play(Scheduler *pScheduler, int nPosition)
Start the piece at a position of the loop on a scheduler, stopping it first.
MuseLooper(Muse *pMuse, int nLength)
Construct a stopped looper.
Piece of MIDI performance that a Scheduler plays.
Definition muse.h:12
Owner of one reference to an Attachment.
Definition ptr.h:16
Queue of commands that run when the song clock reaches their tick.
Definition scheduler.h:20