//If E is clear, the accumulator is forced to zero until E is again set.
_accumulator=0;
//"The phase of the saw generator can be mostly reset by clearing and immediately setting E. Clearing E does not reset the frequency divider, however."
_step=0;
}
break;
}
}
voidSetFrequencyShift(uint8_tshift)
{
_frequencyShift=shift;
}
voidClock()
{
if(_enabled){
_timer--;
if(_timer==0){
_step=(_step+1)%14;
_timer=(_frequency>>_frequencyShift)+1;
if(_step==0){
_accumulator=0;
}elseif((_step&0x01)==0x00){
_accumulator+=_accumulatorRate;
}
}
}
}
uint8_tGetVolume()
{
if(!_enabled){
return0;
}else{
//"The high 5 bits of the accumulator are then output (provided the channel is enabled by having the E bit set)."