libsidplayfp  2.0.2
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
reSID::EnvelopeGenerator Class Reference

Public Types

enum  State { ATTACK, DECAY_SUSTAIN, RELEASE, FREEZED }
 

Public Member Functions

void set_chip_model (chip_model model)
 
void clock ()
 
void clock (cycle_count delta_t)
 
void reset ()
 
void writeCONTROL_REG (reg8)
 
void writeATTACK_DECAY (reg8)
 
void writeSUSTAIN_RELEASE (reg8)
 
reg8 readENV ()
 
short output ()
 

Protected Member Functions

void set_exponential_counter ()
 
void state_change ()
 

Protected Attributes

reg16 rate_counter
 
reg16 rate_period
 
reg8 exponential_counter
 
reg8 exponential_counter_period
 
reg8 new_exponential_counter_period
 
reg8 envelope_counter
 
reg8 env3
 
cycle_count envelope_pipeline
 
cycle_count exponential_pipeline
 
cycle_count state_pipeline
 
bool hold_zero
 
bool reset_rate_counter
 
reg4 attack
 
reg4 decay
 
reg4 sustain
 
reg4 release
 
reg8 gate
 
State state
 
State next_state
 
chip_model sid_model
 

Static Protected Attributes

static reg16 rate_counter_period []
 
static reg8 sustain_level []
 
static unsigned short model_dac [2][1<< 8]
 

Friends

class SID
 

Member Function Documentation

◆ state_change()

RESID_INLINE void reSID::EnvelopeGenerator::state_change ( )
protected

This is what happens on chip during state switching, based on die reverse engineering and transistor level emulation.

Attack

0 - Gate on 1 - Counting direction changes During this cycle the decay rate is "accidentally" activated 2 - Counter is being inverted Now the attack rate is correctly activated Counter is enabled 3 - Counter will be counting upward from now on

Decay

0 - Counter == $ff 1 - Counting direction changes The attack state is still active 2 - Counter is being inverted During this cycle the decay state is activated 3 - Counter will be counting downward from now on

Release

0 - Gate off 1 - During this cycle the release state is activated if coming from sustain/decay *2 - Counter is being inverted, the release state is activated *3 - Counter will be counting downward from now on

(* only if coming directly from Attack state)

Freeze

0 - Counter == $00 1 - Nothing 2 - Counter is disabled

Member Data Documentation

◆ model_dac

unsigned short reSID::EnvelopeGenerator::model_dac
staticprotected
Initial value:
= {
{0},
{0},
}

◆ rate_counter_period

reg16 reSID::EnvelopeGenerator::rate_counter_period
staticprotected
Initial value:
= {
8,
31,
62,
94,
148,
219,
266,
312,
391,
976,
1953,
3125,
3906,
11719,
19531,
31250
}

◆ sustain_level

reg8 reSID::EnvelopeGenerator::sustain_level
staticprotected
Initial value:
= {
0x00,
0x11,
0x22,
0x33,
0x44,
0x55,
0x66,
0x77,
0x88,
0x99,
0xaa,
0xbb,
0xcc,
0xdd,
0xee,
0xff,
}

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