src/apu/apu.cc
/*
 * Updates a pulse channels period if the sweep counter is 0 and the channel
 * is not muted.
 */
Updates a pulse channels period if the sweep counter is 0 and the channel
is not muted.
Updates a pulse channels period if the sweep counter is 0 and the channel is not muted .
void Apu::UpdateSweep(ApuPulse *pulse) {
  DoubleWord target_period = GetPulseTarget(pulse);
  if ((pulse->sweep_counter == 0) && (pulse->sweep & PULSE_SWEEP_ENABLE)
                                  && (pulse->timer >= 8)
                                  && (pulse->length > 0)
                                  && (target_period <= PULSE_TIMER_MASK)
                                  && (pulse->sweep & PULSE_SWEEP_SHIFT_MASK)) {
    pulse->timer = target_period;
  }
  if ((pulse->sweep_counter == 0) || pulse->sweep_reload) {
    pulse->sweep_reload = false;
    pulse->sweep_counter = (pulse->sweep & PULSE_SWEEP_COUNTER_MASK)
                         >> PULSE_SWEEP_COUNTER_SHIFT;
  } else {
    pulse->sweep_counter--;
  }
  return;
}
void Apu :: UpdateSweep ( ApuPulse * pulse ) { DoubleWord target_period = GetPulseTarget ( pulse ) ; if ( ( pulse -> sweep_counter == 0 ) && ( pulse -> sweep & PULSE_SWEEP_ENABLE ) && ( pulse -> timer >= 8 ) && ( pulse -> length > 0 ) && ( target_period <= PULSE_TIMER_MASK ) && ( pulse -> sweep & PULSE_SWEEP_SHIFT_MASK ) ) { pulse -> timer = target_period ; } if ( ( pulse -> sweep_counter == 0 ) || pulse -> sweep_reload ) { pulse -> sweep_reload = false ; pulse -> sweep_counter = ( pulse -> sweep & PULSE_SWEEP_COUNTER_MASK ) >> PULSE_SWEEP_COUNTER_SHIFT ; } else { pulse -> sweep_counter -- ; } return ; }
Updates a pulse channels period if the sweep counter is 0 and the channel
 is not muted.
Updates a pulse channels period if the sweep counter is 0 and the channel is not muted .
// Update the pulses period, if able. // Update the sweep counter for the pulse.