src/apu/apu.cc
/*
 * Updates the output of the triangle channel.
 */
Updates the output of the triangle channel.
Updates the output of the triangle channel .
void Apu::UpdateTriangle(void) {
  triangle_->output = (triangle_->timer > 1) ? triangle_wave[triangle_->pos]
                                             : 0U;
  if (triangle_->clock > 0) {
    triangle_->clock--;
  } else {
    triangle_->clock = triangle_->timer;
    if ((triangle_->linear > 0) && (triangle_->length > 0)) {
      triangle_->pos = (triangle_->pos + 1) & 0x1FU;
    }
  }
  return;
}
void Apu :: UpdateTriangle ( void ) { triangle_ -> output = ( triangle_ -> timer > 1 ) ? triangle_wave [ triangle_ -> pos ] : 0U ; if ( triangle_ -> clock > 0 ) { triangle_ -> clock -- ; } else { triangle_ -> clock = triangle_ -> timer ; if ( ( triangle_ -> linear > 0 ) && ( triangle_ -> length > 0 ) ) { triangle_ -> pos = ( triangle_ -> pos + 1 ) & 0x1FU ; } } return ; }
Updates the output of the triangle channel.
Updates the output of the triangle channel .
// Update the triangle waves output for this cycle. The triangle wave cannot // be silenced, it simply stops updating its position. However, the wave can // be given a frequency outside the human range of hearing, in which case we // force it to zero. // Update the triangle clock and output wave form using the timer period. // Determine if the position should be updated.