Skip to content

Commit 82e6781

Browse files
authored
Add files via upload
1 parent 893c5a5 commit 82e6781

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/papu.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ var utils = require("./utils");
22

33
var CPU_FREQ_NTSC = 1789772.5; //1789772.72727272d;
44
// var CPU_FREQ_PAL = 1773447.4;
5-
var APU_TO_CPU_CYCLE = 14915;
5+
var APU_TO_CPU_CYCLE_NTSC = 14915;
6+
// var APU_TO_CPU_CYCLE_PAL = 16627;
67

78
var PAPU = function (nes) {
89
this.nes = nes;
@@ -59,7 +60,7 @@ var PAPU = function (nes) {
5960
this.dcValue = 0;
6061

6162
// Master volume:
62-
this.masterVolume = 0;
63+
this.masterVolume = 256;
6364

6465
// Stereo positioning:
6566
this.stereoPosLSquare1 = null;
@@ -107,7 +108,7 @@ PAPU.prototype = {
107108
(1024.0 * CPU_FREQ_NTSC) / this.sampleRate
108109
);
109110

110-
this.frameTime = APU_TO_CPU_CYCLE;
111+
this.frameTime = APU_TO_CPU_CYCLE_NTSC;
111112

112113
this.sampleTimer = 0;
113114

@@ -381,7 +382,7 @@ PAPU.prototype = {
381382
// Clock frame counter at double CPU speed:
382383
this.masterFrameCounter += nCycles << 1;
383384
if (this.masterFrameCounter >= this.frameTime) {
384-
// 240Hz tick:
385+
// 240Hz (NTSC) tick:
385386
this.masterFrameCounter -= this.frameTime;
386387
this.frameCounterTick();
387388
}
@@ -466,7 +467,7 @@ PAPU.prototype = {
466467
this.frameIrqActive = true;
467468
}
468469

469-
// End of 240Hz tick
470+
// End of 240Hz (NSTC) tick
470471
},
471472

472473
// Samples the channels, mixes the output together, then writes to buffer.

0 commit comments

Comments
 (0)