resonance 1.0.1
Loading...
Searching...
No Matches
stuttereffector.h
Go to the documentation of this file.
1#pragma once
2
3#include "app/ticktask.h"
4#include "gs/effector.h"
5#include "mid/tick.h"
6#include "synth/source.h"
7
8namespace Sch {
9class TickClock;
10} // namespace Sch
11
27class StutterEffector : public TickTask, public Effector {
28public:
41 StutterEffector(Sch::TickClock *pClock, unsigned char nChannel, int nPeriod, int nFloor)
42 : TickTask(pClock, Sch::Tick(nPeriod / 2).mTick, 1), mEnabled(0), mPending(0),
43 mChannel(nChannel), mFloor(nFloor),
44 mOscillator(Source::AllocateSquareSource(static_cast<float>(nPeriod))) {
45 }
46
54
62 virtual int Type();
63
73 virtual void SetEnabled(int bEnabled);
74
86 virtual int Tick(int nElapsedTicks);
87
88private:
89 int mEnabled; // +0x34
90 int mPending; // +0x38, set once the first request has been sent
91 unsigned char mChannel; // +0x3c
92 int mFloor; // +0x40
93 Source *mOscillator; // +0x44, a square wave
94};
Pausable view of scheduler time, together with the tempo that maps it to a song position.
Definition tickclock.h:40
Reference-counted control signal sampled against elapsed time.
Definition source.h:19
StutterEffector(Sch::TickClock *pClock, unsigned char nChannel, int nPeriod, int nFloor)
Build the effect with a square oscillator.
Definition stuttereffector.h:41
virtual ~StutterEffector()
Switch the effect off through this class's own SetEnabled(), then release the oscillator.
virtual int Tick(int nElapsedTicks)
Send controller 0x30 at the level the oscillator's value selects.
virtual int Type()
Report which effect this object applies.
virtual void SetEnabled(int bEnabled)
Apply or release the effect.
TickTask(Sch::TickClock *pClock, int nPeriod, int bAligned)
Scheduling of timed commands.
Definition activefilter.h:9