wavelength 1.0.0
Loading...
Searching...
No Matches
Lfo Class Reference

Low-frequency oscillator that runs on the EE cycle counter. More...

#include <lfo.h>

Public Types

enum  Waveform { kWaveformSine = 0 , kWaveformTriangle = 1 , kWaveformSquare = 2 , kWaveformConstant = 3 }
 Shapes of the oscillation, the values of mWaveform. More...

Public Member Functions

 Lfo ()
 Construct a stopped sine oscillator with a period of one second.
void Start ()
 Start the clock of the oscillator.
void Stop ()
 Stop the clock of the oscillator.
float Tick ()
 Add the time since the last call to the elapsed time and restart the clock.
float Evaluate ()
 Advance the clock and report the value of the oscillation.
float GetCycles (float fSeconds) const
 Convert a time to cycles of the oscillation.
float ValueAt (float fSeconds) const
 Report the value of the oscillation at a time.
int GetWaveform () const
void SetWaveform (int nWaveform)
float GetPhase () const
void SetPhase (float fPhase)
float GetPeriod () const
void SetPeriod (float fPeriod)

Detailed Description

Low-frequency oscillator that runs on the EE cycle counter.

The class has no RTTI and is not polymorphic, and the name is inferred. The object is 0x24 bytes. SynthPS2 modulates the delay of each tap of the chorus of the software effect with one.

Member Enumeration Documentation

◆ Waveform

Shapes of the oscillation, the values of mWaveform.

Enumerator
kWaveformSine 

A sine wave from -1 to 1.

kWaveformTriangle 

A triangle wave from -1 to 1 that starts at 0 rising.

kWaveformSquare 

1 for the first half of each cycle and -1 for the second.

kWaveformConstant 

A constant 1.

Constructor & Destructor Documentation

◆ Lfo()

Lfo::Lfo ( )

Construct a stopped sine oscillator with a period of one second.

mElapsedMs is not initialised.

Ghidra address:
NTSC-U/C: 0x00251e20
Ghidra address:
PAL: 0x0025a7c8

Member Function Documentation

◆ Start()

void Lfo::Start ( )

Start the clock of the oscillator.

Ghidra address:
NTSC-U/C: 0x00251e48
Ghidra address:
PAL: 0x0025a7f0

◆ Stop()

void Lfo::Stop ( )

Stop the clock of the oscillator.

The time already accumulated in mElapsedMs is unchanged.

Ghidra address:
NTSC-U/C: 0x00251e78
Ghidra address:
PAL: 0x0025a820

◆ Tick()

float Lfo::Tick ( )

Add the time since the last call to the elapsed time and restart the clock.

The elapsed time wraps to stay within one period.

Returns
The elapsed time in milliseconds.
Ghidra address:
NTSC-U/C: 0x00251ef8
Ghidra address:
PAL: 0x0025a8a0

◆ Evaluate()

float Lfo::Evaluate ( )

Advance the clock and report the value of the oscillation.

Returns
The value, from -1 to 1.
Ghidra address:
NTSC-U/C: 0x00252020
Ghidra address:
PAL: 0x0025a9c8

◆ GetCycles()

float Lfo::GetCycles ( float fSeconds) const

Convert a time to cycles of the oscillation.

Parameters
fSecondsThe time in seconds.
Returns
The number of cycles.
Ghidra address:
NTSC-U/C: 0x00252060
Ghidra address:
PAL: 0x0025aa08

◆ ValueAt()

float Lfo::ValueAt ( float fSeconds) const

Report the value of the oscillation at a time.

Parameters
fSecondsThe time in seconds.
Returns
The value, from -1 to 1, or 0 for an unknown waveform.
Ghidra address:
NTSC-U/C: 0x00252078
Ghidra address:
PAL: 0x0025aa20

◆ GetWaveform()

int Lfo::GetWaveform ( ) const
inline
Returns
One of Waveform.

◆ SetWaveform()

void Lfo::SetWaveform ( int nWaveform)
inline
Parameters
nWaveformOne of Waveform.

◆ GetPhase()

float Lfo::GetPhase ( ) const
inline
Returns
The offset of the start in whole cycles.

◆ SetPhase()

void Lfo::SetPhase ( float fPhase)
inline
Parameters
fPhaseThe offset of the start in whole cycles.

◆ GetPeriod()

float Lfo::GetPeriod ( ) const
inline
Returns
The period in seconds.

◆ SetPeriod()

void Lfo::SetPeriod ( float fPeriod)
inline
Parameters
fPeriodThe period in seconds.

The documentation for this class was generated from the following file: