I’m curious when writing audio nodes is there a way to save audio data (sounds) with the node ? Everything in my GUI save files save directly to a .j3o it would be very convenient to save some short audio files with them.
Its not a good idea, also not for textures because each instance will take up memory, if a sound file or texture in the assets folder is referenced instead it can be reused and loaded only once.
Memory isn’t a concern in this case. These are very small .ogg files which are just simple clicks and other sound that play when you click a button. Most of these files don’t even top 1kb.
If I where to pack them separately I also need a way to locate them with knowing the specific folder they end up in. I’m taking files which are created with a GUI editor saved as .j3o then loaded into a project. Loading the .j3o is easy as you need to specify it’s location. I’m drawing a blank when thinking of the best way to find the associated audio files when I don’t really know what folder they will be placed in.
Don’t people loading those j3o files still need your library? Just include the assets in your library as resources.
I’m thinking for user assets. My goal was to have a one line load.
However at some point I’m going to have to sacrifice convenience for conventionality. What I was think is since both the GUI editor and game manager share the same default file directory I could add a GUI folder to the interface directory then register the folder.
Of course then the user would need to specifically place all of the GUI assests in that directory but I don’t think that is asking much especially since you get the handy visual tool that makes everything else for you.
Audio is decompressed in memory. And yeah, just store the assets in some jar the user imports as well, then you can define the folder structure - and also avoid the issue with double textures and sounds in memory.
I’m curious about doubles ? As long as I use the assetManager I shouldn’t have this issue correct ?
For example if the player loads two images called common_axe.png in the same node it shouldn’t cause a conflict. I’ve tested multiple image copies in a one GUI node and so far I haven’t had any issues.
My current method is to have the user specify a folder for resources then I use the resourceLocator to register said folder. Each GUI layer would have it’s own folder for resources unless of course you set them all to the same folder.
You will get doubles when you store stuff in j3o files, not if you reference single images from the asset folder/jar whatever. This is because images (or audio) stored in a j3o has no asset path, which is the defining thing for the asset manager for saying “this is the same image / audio file etc.”.