-
Notifications
You must be signed in to change notification settings - Fork 172
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
Various fixes and improvements to the APU #716
base: main
Are you sure you want to change the base?
Commits on Apr 30, 2024
-
Fix a bug where tones can cut out if the end of a tick comes in late
This bug can be recreated by running `tone(345, 1, 50, 4)` as well as a big time-wasting spin-loop every `update()`.
Configuration menu - View commit details
-
Copy full SHA for cea37cc - Browse repository at this point
Copy the full SHA cea37ccView commit details -
Fix a bug where a tone's phase can be reset during a long tick
This bug can be recreated by running `tone(345, 2, 50, 4)` as well as a big time-wasting spin-loop every `update()`.
Configuration menu - View commit details
-
Copy full SHA for 0bc7e1a - Browse repository at this point
Copy the full SHA 0bc7e1aView commit details -
Simplify logic around tones ending
The old logic could cause sound glitches if a tick comes in earlier than expected.
Configuration menu - View commit details
-
Copy full SHA for 4e50857 - Browse repository at this point
Copy the full SHA 4e50857View commit details -
Only update the APU at the end of every update()
This means that tone() calls that are made at different times within a frame all start at the same time.
Configuration menu - View commit details
-
Copy full SHA for eb6e58f - Browse repository at this point
Copy the full SHA eb6e58fView commit details -
Pause Audio when the menu is open
Also fixes up the code that pauses audio, which was buggy and some of which was dead code.
Configuration menu - View commit details
-
Copy full SHA for 6514a54 - Browse repository at this point
Copy the full SHA 6514a54View commit details
Commits on May 1, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 414421a - Browse repository at this point
Copy the full SHA 414421aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 336596d - Browse repository at this point
Copy the full SHA 336596dView commit details
Commits on Jul 14, 2024
-
APU: Make all four ADSR sections tick based
Each tone call is split into sections, each of which has a start volume and frequency, and an end volume and frequency. Each section is played continuously until either its end *tick* is reached, ending the section and starting the next, or its end *time* is reached, which holds the tone there and stretches it out until its end tick is reached.
Configuration menu - View commit details
-
Copy full SHA for 4f6570f - Browse repository at this point
Copy the full SHA 4f6570fView commit details -
APU: Add fade out to reduce popping sounds
Add a short fade-out period to the end of all tones to prevent audio clicks and pops.
Configuration menu - View commit details
-
Copy full SHA for 319bf46 - Browse repository at this point
Copy the full SHA 319bf46View commit details -
Remove node types from web runtime
The web runtime doesn't run on NodeJS, but was using node types. This was causing issues because some node types override the DOM types, like setTimeout(). Adding `"types": []` to tsconfig.json prevents types in node_modules/@types from being used, including node_modules/@types/node, which is installed because it is a dependency of our dependencies.
Configuration menu - View commit details
-
Copy full SHA for 1eb964e - Browse repository at this point
Copy the full SHA 1eb964eView commit details -
Rework update() pacing to be regular and work in background
This commit reworks the frame timing of the runtime ensuring a regular update every frame on 60 fps monitors, while still supporting other framerates both higher and lower. It achieves this by measuring the framerate continuously, and updating in a requestAnimationFrame() callback when the framerate is close to 60, but switching to a setTimer() timing scheme otherwise. This keeps animation smooth on a 60 fps screen, but keeps updates both full-speed and at regular 16ms intervals on a 30 fps screen, important for making tick-based audio timings accurate. This also has the effect of allowing you to run the runtime in a minimised or background browser window. This is really improves the audio experience, allows you to run games or demos in the background, and also makes it much easier to test netplay without having to keep many windows on screen at once.
Configuration menu - View commit details
-
Copy full SHA for 065956c - Browse repository at this point
Copy the full SHA 065956cView commit details -
Configuration menu - View commit details
-
Copy full SHA for b31723c - Browse repository at this point
Copy the full SHA b31723cView commit details -
Serve favicon.ico locally for w4 run
Previously favicon.ico was being requested from wasm4.org when developing locally. This won't work if the user is offline, the website goes down etc. It also doesn't work well with the new CORS headers I'll introduce in the next commit.
Configuration menu - View commit details
-
Copy full SHA for 85e7680 - Browse repository at this point
Copy the full SHA 85e7680View commit details -
Serve web runtime with headers for improved time accuracy
Setting these security headers grants us access to higher precision time. This improves our ability to pace frame timings and make accurate performance measurements. I hope to take advantage of this to improve the devtools in the future.
Configuration menu - View commit details
-
Copy full SHA for 297f8d5 - Browse repository at this point
Copy the full SHA 297f8d5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 35ee003 - Browse repository at this point
Copy the full SHA 35ee003View commit details
Commits on Jul 16, 2024
-
Configuration menu - View commit details
-
Copy full SHA for b5edcff - Browse repository at this point
Copy the full SHA b5edcffView commit details -
Configuration menu - View commit details
-
Copy full SHA for d3fd6f7 - Browse repository at this point
Copy the full SHA d3fd6f7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2f2d179 - Browse repository at this point
Copy the full SHA 2f2d179View commit details