Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed problems on high refresh rate monitors #335

Open
grechucia opened this issue May 6, 2020 · 1 comment
Open

Speed problems on high refresh rate monitors #335

grechucia opened this issue May 6, 2020 · 1 comment

Comments

@grechucia
Copy link

grechucia commented May 6, 2020

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
Copy link

navgg commented Oct 11, 2020

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 });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants