resonance 1.0.1
Loading...
Searching...
No Matches
waheffector.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
25class WahEffector : public TickTask, public Effector {
26public:
39 WahEffector(Sch::TickClock *pClock, unsigned char nChannel, int nDepth, int nPeriod)
40 : TickTask(pClock, Sch::Tick(kPeriodTicks).mTick, 0), mChannel(nChannel), mDepth(nDepth),
41 mOscillator(Source::AllocateTriSource(static_cast<float>(nPeriod), kStartPhase)),
42 mEnabled(0), mPending(0) {
43 }
44
51 virtual ~WahEffector();
52
60 virtual int Type();
61
71 virtual void SetEnabled(int bEnabled);
72
81 virtual int Tick(int nElapsedTicks);
82
83private:
84 static constexpr int kPeriodTicks = 60;
85 static constexpr float kStartPhase = 0.5f;
86
87 unsigned char mChannel; // +0x34
88 int mDepth; // +0x38
89 Source *mOscillator; // +0x3c, a triangle wave
90 int mEnabled; // +0x40
91 int mPending; // +0x44, set once the first request has been sent
92};
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
TickTask(Sch::TickClock *pClock, int nPeriod, int bAligned)
WahEffector(Sch::TickClock *pClock, unsigned char nChannel, int nDepth, int nPeriod)
Build the effect with a triangle oscillator starting half way through its period.
Definition waheffector.h:39
virtual void SetEnabled(int bEnabled)
Send controller 0x51 with 0x7f to apply the effect or zero to release it.
virtual int Tick(int nElapsedTicks)
Send controller 0x4a with mDepth times the oscillator's value at the elapsed count.
virtual ~WahEffector()
Switch the effect off through this class's own SetEnabled(), then release the oscillator.
virtual int Type()
Report which effect this object applies.
Scheduling of timed commands.
Definition activefilter.h:9