ScummVM API documentation
MADS::Dragonsphere::AdlibChannel Struct Reference

Public Member Functions

void reset ()
 
void load (byte *soundData)
 
void setPtr2 (byte *ptr)
 
void enable ()
 
void processChannelFade ()
 

Public Attributes

uint8 _activeCount = 0
 
uint8 _pitchBend = 0
 
uint8 _volumeFadeStep = 0
 
uint8 _vibratoDepth = 0
 
uint8 _note = 0
 
uint8 _sampleIndex = 0
 
uint8 _volume = 0
 
uint8 _noteOffset = 0
 
uint8 _durationOverride = 0
 
uint8 _keyOnDelay = 0
 
uint8 _fadePeriodCounter = 0
 
uint8 _fadePeriodReload = 0
 
uint8 _arpPeriodCounter = 0
 
uint8 _vibPeriodCounter = 0
 
uint8 _vibPeriodReload = 0
 
uint8 _patchAttenuation = 0
 
uint8 _velocity = 0
 
uint8 _writeVolumePending = 0
 
uint8 _arpPeriodReload = 0
 
uint8 _arpCounterReload = 0
 
byte * _loopStartPtr = nullptr
 
byte * _pSrc = nullptr
 
byte * _innerLoopPtr = nullptr
 
byte * _outerLoopPtr = nullptr
 
byte * _soundData = nullptr
 
byte * _branchTargetPtr = nullptr
 
uint16 _innerLoopCount = 0
 
uint16 _outerLoopCount = 0
 
uint16 _noiseFreqMask = 0
 
uint16 _freqAccum = 0
 
uint16 _freqStep = 0
 
uint8 _cachedCarrierTL = 0
 
uint8 _savedFreqSweep = 0
 
uint8 _freqSweepCounter = 0
 
uint8 _savedSweepCounter = 0
 
uint8 _transpose = 0
 
uint8 _octaveTranspose = 0
 
uint8 _pendingStop = 0
 
uint8 _vibratoMode = 0
 

Static Public Attributes

static bool _isDisabled
 

Member Function Documentation

◆ reset()

void MADS::Dragonsphere::AdlibChannel::reset ( )

Zeroes the "live" fields of one channel without touching the loop/sound-data pointers (those are handled separately by load).

◆ load()

void MADS::Dragonsphere::AdlibChannel::load ( byte *  soundData)

Clears the entire channel struct, then initialises all loop/source pointers to the supplied sound-data address, sets _patchAttenuation to 0x40 (maximum, silent), and marks the channel active (_activeCount = 1).

◆ setPtr2()

void MADS::Dragonsphere::AdlibChannel::setPtr2 ( byte *  ptr)

Redirects _loopStartPtr and _pSrc to the null/silence stream and arms a one-step volume fade (_volumeFadeStep = 0xFF, _fadePeriodReload/Counter = 1) so the channel fades out gracefully over the next tick.

◆ enable()

void MADS::Dragonsphere::AdlibChannel::enable ( )

Marks the channel pending-stop (_pendingStop = 0xFF) and redirects _soundData to the null/silence stream. Unlike setPtr2 this does not touch _volumeFadeStep; the channel fades naturally via processChannelFade.

◆ processChannelFade()

void MADS::Dragonsphere::AdlibChannel::processChannelFade ( )

Called every frame for each channel. When _pendingStop is set, waits until both _velocity and _volume are zero before marking the channel idle (_activeCount = 0); otherwise applies _volumeFadeStep to velocity/volume each _fadePeriodReload ticks and clamps the result to [0, 0x7F].


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