Speed problems on high refresh rate monitors
grechucia opened this issue · 1 comments
grechucia commented
There are speed problems on high refresh rate monitors (in my case 144hz). On 60Hz monitor running just fine.
In example file "nes-embed.js" quick fix is to delete line 'nes.frame();' from onAnimationFrame()
function onAnimationFrame(){
window.requestAnimationFrame(onAnimationFrame);
image.data.set(framebuffer_u8);
canvas_ctx.putImageData(image, 0, 0);
//nes.frame();
}
I'm not an expert, can someone confirm it's the right way?
navgg commented
It's wrong way, you may need to implement a frame skip. But I'm not sure if requestanimationframe working faster than 60Hz, so the problem may be in wrong sound sample rate or small sound buffer size. Try to initialize audio context like this
var audio_ctx = new window.AudioContext({ sampleRate: nes.papu.sampleRate });