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

Use remainingBuffer() from XAudioJS to clock up emulator for audio buffering. #1

Open
ghost opened this issue Apr 21, 2012 · 1 comment

Comments

@ghost
Copy link

ghost commented Apr 21, 2012

Before you fully implement audio in jsSMS, I must warn you to not use timestamps to check how much you should buffer out. Rather, you should retrieve how many samples are left in the API's buffer and determine how much to clock your emulator more so than the "base clocks per setInterval iteration." Google Chrome, Firefox, and Opera all experience different setInterval accuracy, and using timestamps has accuracy issues and will cause issues (If someone puts their computer to sleep and re-opens it, you'll lock it up if clocking by timestamp.).

DynamicAudio does not support buffer checking, and this is the reason why I wrote XAudioJS (Besides also supporting the web audio api in addition to the moz audio api and flash fallback). I also support resampling in xaudiojs, so you can sample to the hardware APU's actual sample rate, and not hack around it. This is why JSNES has issues with audio (Because proper buffering of audio in it does not exist).

@ghost
Copy link
Author

ghost commented Apr 21, 2012

See how I implemented clocking in GameBoy Online, as in it the code checks to see the # of samples left in buffer and tries to maintain a buffer target, and if below that amount, adds additional clocks to a base clock amount to "catch-up."

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

0 participants