src/apu/apu.cc
/*
 * Sends a sample to the audio system every 40.5 APU cycles.
 */
Sends a sample to the audio system every 40.5 APU cycles.
Sends a sample to the audio system every 40 . 5 APU cycles .
void Apu::PlaySample(void) {
  if (sample_clock_ < 37) {
    sample_clock_++;
    return;
  }
  float pulse_output = GetPulseOutput();
  float tnd_output = GetTndOutput();
  float sample = FilterNextSample(pulse_output + tnd_output);
  audio_->AddSample(sample);
  sample_clock_ -= 36.2869375;
  return;
}
void Apu :: PlaySample ( void ) { if ( sample_clock_ < 37 ) { sample_clock_ ++ ; return ; } float pulse_output = GetPulseOutput ( ) ; float tnd_output = GetTndOutput ( ) ; float sample = FilterNextSample ( pulse_output + tnd_output ) ; audio_ -> AddSample ( sample ) ; sample_clock_ -= 36.2869375 ; return ; }
Sends a sample to the audio system every 40.5 APU cycles.
Sends a sample to the audio system every 40 . 5 APU cycles .
// Increment the sample clock if a sample is not to be played this cycle. // Calculate the outputs of the audio channels from their current levels. // Apply the NES's audio filters to the sample. // Add the output to the sample buffer. // Reset the sample clock.