src/apu/apu.cc
/*
 * Performs an APU frame step action according to the current step and mode
 * of the frame counter.
 */
Performs an APU frame step action according to the current step and mode
of the frame counter.
Performs an APU frame step action according to the current step and mode of the frame counter .
void Apu::RunFrameStep(void) {
  if (!((frame_step_ == 3) && (frame_control_ & FLAG_MODE))) {
    UpdatePulseEnvelope(pulse_a_);
    UpdatePulseEnvelope(pulse_b_);
    UpdateNoiseEnvelope();
    UpdateTriangleLinear();
  }
  if ((frame_step_ == 1) || ((frame_step_ == 3)
                         && !(frame_control_ & FLAG_MODE))
                         || ((frame_step_ == 4)
                         && (frame_control_ & FLAG_MODE))) {
    UpdateLength();
    UpdateSweep(pulse_a_);
    UpdateSweep(pulse_b_);
  }
  if ((frame_step_ == 3) && !(frame_control_ & (FLAG_MODE | FLAG_IRQ_DISABLE))
                         && !frame_irq_) {
    frame_irq_ = true;
    (*irq_line_)++;
  }
  return;
}
void Apu :: RunFrameStep ( void ) { if ( ! ( ( frame_step_ == 3 ) && ( frame_control_ & FLAG_MODE ) ) ) { UpdatePulseEnvelope ( pulse_a_ ) ; UpdatePulseEnvelope ( pulse_b_ ) ; UpdateNoiseEnvelope ( ) ; UpdateTriangleLinear ( ) ; } if ( ( frame_step_ == 1 ) || ( ( frame_step_ == 3 ) && ! ( frame_control_ & FLAG_MODE ) ) || ( ( frame_step_ == 4 ) && ( frame_control_ & FLAG_MODE ) ) ) { UpdateLength ( ) ; UpdateSweep ( pulse_a_ ) ; UpdateSweep ( pulse_b_ ) ; } if ( ( frame_step_ == 3 ) && ! ( frame_control_ & ( FLAG_MODE | FLAG_IRQ_DISABLE ) ) && ! frame_irq_ ) { frame_irq_ = true ; ( * irq_line_ ) ++ ; } return ; }
Performs an APU frame step action according to the current step and mode
 of the frame counter.
Performs an APU frame step action according to the current step and mode of the frame counter .
// Clock envelopes. // Clock length counters and pulse sweep. // Send the frame IRQ. The IRQ should only be added to the line if it is not // already there.