From 148326b32ad57d18dbe07bedb37552c761927f18 Mon Sep 17 00:00:00 2001 From: anzz1 Date: Tue, 26 Mar 2024 10:32:57 +0200 Subject: [PATCH] 44.1 -> 48 --- example/nes-embed.js | 5 ++++- src/papu.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/example/nes-embed.js b/example/nes-embed.js index 3c5533c..88030be 100644 --- a/example/nes-embed.js +++ b/example/nes-embed.js @@ -89,7 +89,10 @@ function nes_init(canvas_id){ framebuffer_u32 = new Uint32Array(buffer); // Setup audio. - var audio_ctx = new window.AudioContext(); + var audio_ctx = new window.AudioContext({ + latencyHint: "interactive", + sampleRate: 48000, + }); var script_processor = audio_ctx.createScriptProcessor(AUDIO_BUFFERING, 0, 2); script_processor.onaudioprocess = audio_callback; script_processor.connect(audio_ctx.destination); diff --git a/src/papu.js b/src/papu.js index 8cbcefc..d6551dd 100644 --- a/src/papu.js +++ b/src/papu.js @@ -19,7 +19,7 @@ var PAPU = function (nes) { this.initCounter = 2048; this.channelEnableValue = null; - this.sampleRate = 44100; // 22050*2 + this.sampleRate = 48000; this.lengthLookup = null; this.dmcFreqLookup = null;