src/apu/apu.cc
/*
 * Updates the linear counter of the triangle channel.
 */
Updates the linear counter of the triangle channel.
Updates the linear counter of the triangle channel .
void Apu::UpdateTriangleLinear(void) {
  if (triangle_->linear_reload) {
    triangle_->linear = triangle_->control & LINEAR_MASK;
  } else if (triangle_->linear > 0) {
    triangle_->linear--;
  }
  if (!(triangle_->control & FLAG_LINEAR_CONTROL)) {
    triangle_->linear_reload = false;
  }
  return;
}
void Apu :: UpdateTriangleLinear ( void ) { if ( triangle_ -> linear_reload ) { triangle_ -> linear = triangle_ -> control & LINEAR_MASK ; } else if ( triangle_ -> linear > 0 ) { triangle_ -> linear -- ; } if ( ! ( triangle_ -> control & FLAG_LINEAR_CONTROL ) ) { triangle_ -> linear_reload = false ; } return ; }
Updates the linear counter of the triangle channel.
Updates the linear counter of the triangle channel .
// Reload the linear counter if the flag has been set. // Otherwise, decrement it until it reaches zero. // Clear the linear counter reload flag if the control bit is clear.