resonance 1.0.1
Loading...
Searching...
No Matches
Source Class Referenceabstract

Reference-counted control signal sampled against elapsed time. More...

#include <source.h>

Inheritance diagram for Source:
Collaboration diagram for Source:

Public Member Functions

virtual int GetValue (float flTime, float *pValue)=0
 Produce the signal's value at a time.
Public Member Functions inherited from Attachment
 Attachment ()
virtual ~Attachment ()
int Release ()
 Give back one reference and destroy the object once the last one is gone.
virtual void Destroy ()
 Destroy the object.

Static Public Member Functions

static Source * AllocateSineSource (float flPeriod, float flPhase)
 Build a sine wave between 0 and 1.
static Source * AllocateSquareSource (float flPeriod)
 Build a square wave.
static Source * AllocateTriSource (float flPeriod, float flPhase)
 Build a triangle wave that rises from 0 to 1 and falls back once per period.
static Source * AllocateRampSource (float flPeriod, float flPhase)
 Build a sawtooth that rises from 0 to 1 once per period.
static Source * AllocateFadeOutSource (int bStopAtEnd, float flDuration)
 Build a fade from 1 down to 0 that then holds 0.
static Source * AllocateFadeInSource (int bStopAtEnd, float flDuration)
 Build a fade from 0 up to 1 that then holds 1.
static Source * AllocateHoldAndFadeDownSource (int bStopAtEnd, float flHold, float flFade)
 Build a signal that holds 1, then fades down to 0 and holds 0.
Static Public Member Functions inherited from Attachment
static void ReleaseIfSet (Attachment *pAttachment)
 Give back one reference to an object that may be null.

Additional Inherited Members

Public Attributes inherited from Attachment
int mRefs

Detailed Description

Reference-counted control signal sampled against elapsed time.

Its RTTI descriptor is at 0x008ef3b0. It has Attachment as its only base at offset 0. The object is Attachment's eight bytes and adds GetValue() as slot 3 of the table it shares with Attachment. The six subclass tables all fill slot 3 and no factory builds a plain Source, and the slot is modelled as pure on that evidence.

source.cpp defines six subclasses in its anonymous namespace, which the RTTI records under the _GLOBAL_$N$source.cpp prefix: Sine, Square, Tri, Ramp, Fade, and HoldAndFadeDown. The static factories below are the only way the image builds any of them. Each allocates through the plain allocator and returns the object with one reference. The implicit destructors of the six subclasses and their type_info accessors are compiler-generated.

Member Function Documentation

◆ GetValue()

virtual int Source::GetValue ( float flTime,
float * pValue )
pure virtual

Produce the signal's value at a time.

Slot 3.

Parameters
flTimeThe time since the source started, in the unit its factory arguments use.
pValueReceives the value, between 0 and 1.
Returns
1 while the source continues, and 0 once a fade built to stop has finished.

◆ AllocateSineSource()

Source * Source::AllocateSineSource ( float flPeriod,
float flPhase )
static

Build a sine wave between 0 and 1.

Parameters
flPeriodThe period.
flPhaseThe starting phase, as a fraction of a whole turn.
Returns
The source.
Ghidra address:
NTSC-U/C: 0x00545e28
Ghidra address:
PAL: 0x00586358

◆ AllocateSquareSource()

Source * Source::AllocateSquareSource ( float flPeriod)
static

Build a square wave.

The value is 1 while the time modulo the period is below 0.5 and 0 otherwise, whatever the period.

Parameters
flPeriodThe period.
Returns
The source.
Ghidra address:
NTSC-U/C: 0x00545e98
Ghidra address:
PAL: 0x005863c8

◆ AllocateTriSource()

Source * Source::AllocateTriSource ( float flPeriod,
float flPhase )
static

Build a triangle wave that rises from 0 to 1 and falls back once per period.

Parameters
flPeriodThe period.
flPhaseThe starting phase, as a fraction of the period.
Returns
The source.
Ghidra address:
NTSC-U/C: 0x00545ee0
Ghidra address:
PAL: 0x00586410

◆ AllocateRampSource()

Source * Source::AllocateRampSource ( float flPeriod,
float flPhase )
static

Build a sawtooth that rises from 0 to 1 once per period.

Parameters
flPeriodThe period.
flPhaseThe starting phase, as a fraction of the period.
Returns
The source.
Ghidra address:
NTSC-U/C: 0x00545f50
Ghidra address:
PAL: 0x00586480

◆ AllocateFadeOutSource()

Source * Source::AllocateFadeOutSource ( int bStopAtEnd,
float flDuration )
static

Build a fade from 1 down to 0 that then holds 0.

The title is inferred. The Fade class is shared with AllocateFadeInSource().

Parameters
bStopAtEndNon-zero to report the source finished once the fade is over.
flDurationThe length of the fade.
Returns
The source.
Ghidra address:
NTSC-U/C: 0x00545fc0
Ghidra address:
PAL: 0x005864f0

◆ AllocateFadeInSource()

Source * Source::AllocateFadeInSource ( int bStopAtEnd,
float flDuration )
static

Build a fade from 0 up to 1 that then holds 1.

The title is inferred.

Parameters
bStopAtEndNon-zero to report the source finished once the fade is over.
flDurationThe length of the fade.
Returns
The source.
Ghidra address:
NTSC-U/C: 0x00546020
Ghidra address:
PAL: 0x00586550

◆ AllocateHoldAndFadeDownSource()

Source * Source::AllocateHoldAndFadeDownSource ( int bStopAtEnd,
float flHold,
float flFade )
static

Build a signal that holds 1, then fades down to 0 and holds 0.

Parameters
bStopAtEndNon-zero to report the source finished once the fade is over.
flHoldThe time the signal holds 1.
flFadeThe length of the fade after the hold.
Returns
The source.
Ghidra address:
NTSC-U/C: 0x00546088
Ghidra address:
PAL: 0x005865b8

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