-
Notifications
You must be signed in to change notification settings - Fork 557
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
Load and unload music files as needed #1135
base: master
Are you sure you want to change the base?
Conversation
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.
Hi, sorry this wasn't reviewed sooner.
Immediately after this PR was open, concerns were brought up in the VVVVVV Discord about this being unnecessary if not harmful for PC, for both HDDs (load times every time a track is played) and SSDs (unnecessary writes to disk because of access times). Terry commented that this might be useful as a #ifdef
for platforms that need it.
So as it is right now, this won't be merged.
Yes, there's a small delay when the track changes, but even on a slow machine such as the Wii it's quite bearable. As for the access times, that should not be a concern for the game, but rather for the OS: files are opened all the time, and VVVVVV changes song much more rarely than other programs access the disk, so we shouldn't worry about that. I'll refactor the code so that the decision can be controlled by an |
I think it's not so much casual playing that would be affected by it, but:
|
If access times are enabled, they can. Access times being enabled means that even reading a file updates the access time, which is a write to disk. |
In theory we could make it so that if the RAM is sufficient, we don't discard the old song... |
When VVVVVV is run on devices (such as the Nintendo Wii) that are memory costrained, it's not possible to load all the music files at startup. Therefore, change the MusicTrack contructor to only save the RWops structure, and load the music data only when Play() gets called. Also, when a song start playing we do unload the previous one.
3ff3731
to
349ab39
Compare
Hi! I updated the branch. I'm not using an ifdef, but instead I'm activating the on-demand loading and unloading of music only if the music is loaded from loose files. I was told that the "loose files" option was added exactly for the purpose of lowering the memory pressure on RAM-limited machines, so it seems reasonable to bind the logic to that factor. |
When VVVVVV is run on devices (such as the Nintendo Wii) that are memory costrained, it's not possible to load all the music files at startup.
Therefore, change the MusicTrack contructor to only save the RWops structure, and load the music data only when Play() gets called. Also, when a song start playing we do unload the previous one.
I tested this on the Nintendo Wii and it works fine there, I got to change several songs and everything seems to work fine. But I don't know if there are some corner cases I should pay more attention to.
Legal Stuff:
By submitting this pull request, I confirm that...
CONTRIBUTORS
file and the "GitHub Friends"section of the credits for all of said releases, but will NOT be compensated
for these changes unless there is a prior written agreement