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

WIP: avm2,audio: Implement SampleDataEvent #14203

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

torokati44
Copy link
Member

@torokati44 torokati44 commented Nov 28, 2023

Fixes: #14156
Also fixes z0r.de loops: 5885, 7024 (issue #7879), 7312
Probably fixes (to be tested): #9171, #13655

It's quite rough (full of unwrap()s for example, and overall unfinished) but it "just started working".

Mostly pushing to show that it's in progress - any ideas on how to improve the architecture are welcome.

An unexpected (to me at least) problem is that sound synthesis in AS3 needs to do quite a lot of math really fast, so on my machine, even in release mode, the content linked above could barely keep up with real time sound generation, or not at all. Profiling and optimization is yet to be done (probably related: #7920).

@torokati44 torokati44 force-pushed the sample-data-event branch 2 times, most recently from 27be9ab to 8e7465b Compare November 29, 2023 07:46
@SN902
Copy link

SN902 commented Nov 30, 2023

Most NSFW video games depend on this commit, here still no any SFX, but now they panics after the end of the first loop (need to wait for the issue reproduction)

Twi_Armor.zip

thread 'main' panicked at 'not too many sounds: TooManySounds', core\src\avm2\globals\flash\media\sound.rs:179:14 note: run with RUST_BACKTRACE=1environment variable to display a backtrace AVM2 stack trace: at flash.media::Sound/flash::media::Sound::play() at mp3pl::MP3Player/play() at appleblitz_fla::MainTimeline/playsounds() at appleblitz_fla::MainTimeline/loopend() at appleblitz_fla::MainTimeline/frame1() error: process didn't exit successfully:target\release\ruffle_desktop.exe (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

upd: here one my favorite chiptune site, music is playing http://zxtunes.com/author.php?id=446&sort=playing :D

@Lord-McSweeney Lord-McSweeney added audio Issues relating to audio playback avm2 AVM2 (ActionScript 3.0) issues labels Dec 14, 2023
@torokati44
Copy link
Member Author

torokati44 commented Dec 23, 2023

TBD:

  • verify that the architecture is correct - the load_called method, how AudioManager and AudioBackend and Mixer keep track of what, the new stream types, etc.
  • test all the games/animations mentioned above, and actually make them work properly
  • some kind of regression test
  • see if any more events need to be dispatched


ba.set_position(0);
for _ in 0..ba.len() / 4 {
ns.push_back(ba.read_float().expect("float can be read"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't failing to read a float result in the read loop terminating early?

Copy link
Member Author

Choose a reason for hiding this comment

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

that is to be tested :|

@danielhjacobs danielhjacobs added the waiting-on-author Waiting on the PR author to make the requested changes label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audio Issues relating to audio playback avm2 AVM2 (ActionScript 3.0) issues waiting-on-author Waiting on the PR author to make the requested changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sion Soundobject Quartet - no sound!
4 participants