src/apu/apu.cc
/*
 * Runs a cycle of the APU emulation.
 *
 * Assumes Connect() has been called.
 */
Runs a cycle of the APU emulation.
Assumes Connect() has been called.
Runs a cycle of the APU emulation . Assumes Connect () has been called .
void Apu::RunCycle(void) {
  if (!cycle_even_) {
    UpdateTriangle();
    PlaySample();
    cycle_even_ = !cycle_even_;
    return;
  }
  IncFrame();
  if (frame_clock_ == 0) { RunFrameStep(); }
  UpdatePulse(pulse_a_);
  UpdatePulse(pulse_b_);
  UpdateTriangle();
  UpdateNoise();
  UpdateDmc();
  PlaySample();
  cycle_even_ = !cycle_even_;
  return;
}
void Apu :: RunCycle ( void ) { if ( ! cycle_even_ ) { UpdateTriangle ( ) ; PlaySample ( ) ; cycle_even_ = ! cycle_even_ ; return ; } IncFrame ( ) ; if ( frame_clock_ == 0 ) { RunFrameStep ( ) ; } UpdatePulse ( pulse_a_ ) ; UpdatePulse ( pulse_b_ ) ; UpdateTriangle ( ) ; UpdateNoise ( ) ; UpdateDmc ( ) ; PlaySample ( ) ; cycle_even_ = ! cycle_even_ ; return ; }
Runs a cycle of the APU emulation.
Runs a cycle of the APU emulation .
// Only the triangle wave updates on odd cycles. // Update the frame counter. Must be done in this order to prevent // issues with frame counter resets. // Update the channels for this cycle. // Play a sample, if it is time to do so. // Toggle the cycle evenness.