diablodiab / libretro-scummvm-backend

libretro backend for scummvm
6 stars 8 forks source link

Audio buffer option for low power devices. #20

Open schmurtzm opened 2 years ago

schmurtzm commented 2 years ago

Hi, this core option implemented here avoir a lot of audio stuttering on low power devices like Miyoo Mini for example : https://github.com/diablodiab/libretro-scummvm-backend/commit/6c3954f916bf430e7756afd8ca74618d48b56744

It seems to have a big impact on OGG. For example Borken Sword 2.5 was totally unplayable due to intense sound stuttering, with an audio buffer of 2048 it runs well and playable :)

I could be improved by adding an option to select the size of the audio buffer. Edit : I've made this here which improve a lot the result and allows to play the previous mentioned games on the Miyoo Mini (which is an achievement!) but I think that the core deserve a new sound stack which is a bit beyond my area of expertise 😅

mrmatteastwood commented 1 year ago

I'm guessing this would also be the reason for the audio issues I'm experiencing on Legend of Kyrandia, even on my fairly powerful machines (RTX 2070 laptop with i7-9700, GTX 1080 Ti desktop with i7-4090k, both SSD and 32 GB RAM, Linux Mint 21). Issue #27.

A core option would be awesome, yes!

schmurtzm commented 1 year ago

Surprised that it's happen on strong cpu but interesting !

Did you try on ScummVM standalone too ? It could be useful to compare !

I have compiled the standalone version for the Miyoo Mini but I'm not able to run it correctly for now 😅

I think that you'll probably have the same problem on the official libretro core so you can create the issue on both repo (as RA team doesn't seem hurry to take this new version as the official one).

My fix is inspired from the work of stupidhoroscope,I think that it's more a workaround than a definitive solution but it gives impressive results on the Miyoo Mini. I could compile a windows or linux version so you could test the magic option on Legend of Kyranda ...

mrmatteastwood commented 1 year ago

Haven't tried standalone ScummVM yet, no. Gonna try and report back. But I can say for sure that it's not happening with the version of ScummVM that's currently available in RetroArch through the Online Updater (2.1). The game runs flawlessly in that one.

From what I hear, the RA team has been working to integrate the brand new version of ScummVM, but progress has been more difficult than with other cores because it's more complex. I think they'll get there in time and look forward to it :-)

Meanwhile, yeah, if you could compile a Linux and Windows version, that would be awesome! I'd love to test it out and will give feedback here. I have Linux Mint 21 on both my PCs and Windows 10 on the laptop. If possible, would you also be able to package the necessary system files (the themes/extras package)?

mrmatteastwood commented 1 year ago

No problems with ScummVM standalone, stable build 2.6.0.

schmurtzm commented 1 year ago

Hi again,

Here my builds for Linux_64-bit, Linux_aarch64 and windows. I have tested it on Ubuntu 22.04 (so it should be OK on Linux mint 21) and Windows : https://github.com/schmurtzm/libretro_builds/releases

I've added the corresponding theme and extra - auxiliary data for these 3 builds.

The mouse cursor move is broken because these builds are for the D-Pad of the Miyoo Mini but it should be OK if you use it with any gamepad (or the arrow keys of your keyboard 😅 ). I could change that but for a quick test for the sound it's OK.

Very interesting to know that you don't have sound problem on the standalone version, it means that a RA dev have to take a look on the sound part of this core to improve it.

For now these builds include a new core option : "Target FPS for stutter reduction" from my repo.

Inspired from this commit made by StupidHoroscope :

It allows to run some heavy games with less audio stuttering on the Miyoo Mini.

Default value is 55fps and correspond to an audio buffer of about 800 set it to 20 or 30 fps to obtain a buffer of 2000 which helps with heavy games in low power devices like Grim Fandango or Borken Sword 2.5.


From what I hear, the RA team has been working to integrate the brand new version of ScummVM, but progress has been more difficult than with other cores because it's more complex. I think they'll get there in time and look forward to it :-)

I don't know what problem they encountered... Where did you see their conversation on their progress on it ? On the main issue from 2021 ?

mrmatteastwood commented 1 year ago

Yeah, I was referring to hizzlekizzle's explanation from yesterday: https://github.com/libretro/scummvm/issues/179#issuecomment-1292675672

Apparently, this core is more complex to build than others...? I don't understand the specifics, but that's how I read his comment.

Thanks for your builds! Your added core option does have an effect, though it's not the desired one :-( The dropouts remain exactly the same, but the game runs slower overall when I pick a lower target frame rate. I tried 30 and 20. Sound, animations, everything runs slower, though completely in sync. And the dropouts are just like in my video from yesterday (https://youtu.be/Esje0_IlCAs).

One interesting thing: in your build, sound effects work better! When the tree speaks from the wall in Brandon's home, the creaking sound when the face appears plays correctly, so do the bird sounds outside the house and the tear drops in the pool of sorrow. These don't work on the build I recorded the above video with.

(EDIT: actually the sound effects do seem to work properly either way. The game just seems to play different sound effects. I'm guessing it must be some sound setting somewhere.

With your build (and standalone ScummVM), the game has these sound effects: https://www.youtube.com/watch?v=_c5QrnYYk3Y

With the build I downloaded 6 days ago (https://github.com/libretro/scummvm/issues/179#issuecomment-1287901681), the game has these sound effects: https://www.youtube.com/watch?v=PQuBkU3SzxY

It's strange, because I did nothing to scummvm.ini. Anyway, it's not really important either. :-))