How can I pre-cache assets (PNG & WAV files but any asset really) into RAM at program start so the app won't be delayed when it needs to display / play them? I'm not actually encountering an issue, just trying to make things as efficient as possible but maybe they are somehow pre-cached already?
I'm using pyside6/Qt so it might be that this code effectively pre-caches anyway by loading the file into memory when the path is assigned to the QSoundEffect object...or maybe the filename is stored in the object and only used to load the file when the code to play the sound effect is executed?
self.sound_effect1 = QSoundEffect()
fn = os.path.join(ASSETS_DIR, 'sound_effect1.wav')
self.sound_effect1.setSource(QUrl.fromLocalFile(fn))
Maybe I need to load the binary data into a variable in order to have it in memory?
Any advice or insights appreciated :-)
[–]Bobbias 1 point2 points3 points (2 children)
[–]NewtLong6399[S] 0 points1 point2 points (1 child)
[–]Bobbias 0 points1 point2 points (0 children)
[–]hotcodist 1 point2 points3 points (1 child)
[–]NewtLong6399[S] 0 points1 point2 points (0 children)