Skip to content

avm1: Remove playback queue from Sound - #24176

Draft
ChrisCPI wants to merge 1 commit into
ruffle-rs:masterfrom
ChrisCPI:avm1-remove-sound-queue
Draft

avm1: Remove playback queue from Sound#24176
ChrisCPI wants to merge 1 commit into
ruffle-rs:masterfrom
ChrisCPI:avm1-remove-sound-queue

Conversation

@ChrisCPI

@ChrisCPI ChrisCPI commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Description

Undoes most of #21163. The inclusion of this feature was a misinterpretation of how loaded sounds behave on the desktop Flash Player projector. It actually loads sounds synchronously, meaning that anything immediately after loadSound() (such as start()) would work, giving the illusion that a queue exists.

However, remote files (a test for which has been added) do not load synchronously, and plays do not appear to be queued in that case. In addition, local files do not load synchronously when running the SWF in a Flash browser.

Note that this was manually undone since changes were made to Sound since that PR, so it's possible there's a mistake, though I'm pretty sure there isn't.

Testing

  • Added the avm1/sound_load_start_remote file to test loading remote MP3s.
  • The avm1/sound_load_start test has been marked as a known failure, and has also been modified to include traces for when onLoad is fired, to demonstrate how it is fired right after calling loadSound().
  • The avm1/sound_multiple_load test has been marked as a known failure.

I'm still a bit confused as to what is expected of the tests in this scenario, so let me know if anything else needs done.

Checklist

  • I, a human, have self-reviewed this PR and fully understand the changes within.
  • I have made or updated tests where possible.
  • All of my commits are properly scoped, compile successfully, and pass all tests.
  • This PR does not make sense to split up into smaller PRs.
  • An LLM was involved in the authoring of this code. (used in authoring server.py in the added test)

@ChrisCPI ChrisCPI added A-avm1 Area: AVM1 (ActionScript 1 & 2) T-compat Type: Compatibility with Flash Player labels Jul 10, 2026
@ChrisCPI
ChrisCPI force-pushed the avm1-remove-sound-queue branch 2 times, most recently from 29b7167 to 2ba7dad Compare July 10, 2026 19:41
The inclusion of this feature was a misinterpretation of how loaded sounds behave on the desktop Flash Player projector. It actually loads sounds synchronously, meaning that anything immediately after `loadSound()` (such as `start()`) would work, giving the illusion that a queue exists.
@ChrisCPI
ChrisCPI force-pushed the avm1-remove-sound-queue branch from 2ba7dad to 22216e0 Compare July 10, 2026 19:50
num_ticks = 100
# The FP projector loads local MP3s synchronously, which means
# that any start() calls immediately following loadSound()
# do succeed. This does not happen in a Flash browser.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that does happen in flashplayer when loading remote resources, we should implement this behavior as well. Running SWFs in standalone FP was also the thing in the past.

@ChrisCPI ChrisCPI Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when loading remote resources

Do you mean when loading local files? AFAIK with these changes, Ruffle should be matching FP when it comes to loading remote files.

Also, I'm open to ideas on how the synchronous behavior could be replicated, since that would seem tricky to do.

import os
from http.server import HTTPServer, BaseHTTPRequestHandler

class MyHandler(BaseHTTPRequestHandler):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anything special in this server that prevents us from just using python -m http.server?

@ChrisCPI
ChrisCPI marked this pull request as draft July 16, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-avm1 Area: AVM1 (ActionScript 1 & 2) T-compat Type: Compatibility with Flash Player

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants