system/apu/index.js
function() {
		var tndOut = 0, // triangle, noise, dmc
			pulseOut = 0;

		this.pulse1.doTimer();
		this.pulse2.doTimer();
		this.triangle.doTimer();
		this.noise.doTimer();
		this.dmc.doTimer();

		if ( this.output.enabled ) {
			// no need to do calculations if output is disabled
			if ( this.sampleCounter >= this.sampleCounterMax ) {
				pulseOut =  pulseTable[ this.pulse1.sample + this.pulse2.sample ];
				tndOut = tndTable[ 3 * this.triangle.sample + 2 * this.noise.sample + this.dmc.sample ];

				this.output.writeSample( pulseOut + tndOut );

				this.sampleCounter -= this.sampleCounterMax;
			}

			this.sampleCounter += 1;
		}
	}
function() {
		var tndOut = 0, // triangle, noise, dmc
			pulseOut = 0;

		this.pulse1.doTimer();
		this.pulse2.doTimer();
		this.triangle.doTimer();
		this.noise.doTimer();
		this.dmc.doTimer();

		if ( this.output.enabled ) {
			// no need to do calculations if output is disabled
			if ( this.sampleCounter >= this.sampleCounterMax ) {
				pulseOut =  pulseTable[ this.pulse1.sample + this.pulse2.sample ];
				tndOut = tndTable[ 3 * this.triangle.sample + 2 * this.noise.sample + this.dmc.sample ];

				this.output.writeSample( pulseOut + tndOut );

				this.sampleCounter -= this.sampleCounterMax;
			}

			this.sampleCounter += 1;
		}
	}
function ( ) { var tndOut = 0 , // triangle, noise, dmc pulseOut = 0 ; this . pulse1 . doTimer ( ) ; this . pulse2 . doTimer ( ) ; this . triangle . doTimer ( ) ; this . noise . doTimer ( ) ; this . dmc . doTimer ( ) ; if ( this . output . enabled ) { // no need to do calculations if output is disabled if ( this . sampleCounter >= this . sampleCounterMax ) { pulseOut = pulseTable [ this . pulse1 . sample + this . pulse2 . sample ] ; tndOut = tndTable [ 3 * this . triangle . sample + 2 * this . noise . sample + this . dmc . sample ] ; this . output . writeSample ( pulseOut + tndOut ) ; this . sampleCounter -= this . sampleCounterMax ; } this . sampleCounter += 1 ; } }
Update output sample.
Update output sample .