-
Notifications
You must be signed in to change notification settings - Fork 4
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
[BUGFIX] Fixed Polymod and Mods Support in FlxPartialSound Using OpenFL Assets #2
[BUGFIX] Fixed Polymod and Mods Support in FlxPartialSound Using OpenFL Assets #2
Conversation
this looks yummy! I will mark this for myself for testing since it doesn't seem like it's too verbose of a workaround/fix! thanks! |
@KarimAkra I'm not sure if your testing suggests otherwise, but it seems to me like this code is loading the whole file before cutting out a portion? As opposed to the old code, where I believe the intent was to use the filesystem to read only a portion of the file directly from disk, this saving memory by never having the full file loaded at once. |
@EliteMasterEric Both seemed to be using the same amount of memory that's varying between 220-230 mb So i think it's safe to say this dosent have any impact on the memory usage & optimization! |
Turns out Bytes don't get cached or allocated to memory unless they're pushed to the openfl cache map or something like that |
hmmm it doesn't save the full audio file to memory that does seem to be correct, but one thing about this is that it does at least try to load the whole audio file right? like i havent used fileinput and file reading too much to be honest! my implementation could be doing the same thing! but the intention is to get it to read ONLY the slice of bytes it needs/wants for a preview |
That is actually true now that you mentioned it here are the results Given these results, the impact on speed when using |
if you're wondering what's the audio file i used in here it's the 2hot instrument (1.50 mb) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After testing it on my own laptop, the impact isnt really that big, even spamming to load an hour long podcast audio file doesnt impact performance. Results, laptop specs, and the audio file are all below.
Mod testing seems to go well though.
@KarimAkra Can you revert your most recent change? Assets.loadBytes is SUPPOSED to work here, I need to fix things on the Polymod side. |
I looked deep into how It uses
https://github.com/openfl/lime/blob/develop/src%2Flime%2Futils%2FBytes.hx#L94-L98 |
Before it reaches that call, Lime calls |
Reverted it I think Polymod needs to use a complete alternative method for loadBytes instead of calling the one from the lime AssetLibrary I don't really know much abt how Polymod functions so I guess you'll have figure this out |
I got it working on the latest |
we load the aseet's bytes with
Assets.loadBytes
(which works asynchronously) then create ahaxe.io.BytesInput
instance with the bytes retrieved instead of directly reading the file withFileSystem.read
to get aFileInput
for itThis should be merged with the change in this pr on Funkin