Closed AllEternalsDeck closed 6 years ago
Encountered this same problem earlier and it's not a problem with sound files, it's a problem with the file system and the way godot handles the file paths within an export build. The problem here is that Godot does not export any imported files (sounds, images, ...) inside any of your created directories e.g. res://audio/sound.wav
, but rather uses only the files inside the .import
folder. This means that files don't get exported twice (nice), but also some broken paths and stuff (not so nice). If you search through your music folder from inside your export you will only see all the *.import
files but not the files themselves.
See #17607, #15801 and #16798
You could, theoretically, access all the binaries inside your .import
folder, instead of pointing at the original path, but that's a real pain since the files don't have the same name - they get appended their MD5 Hash (I guess it's MD5?).
@Phoenix1747 did you find any workaround for this?
Unfortunately, no. I'm waiting for 3.1 to come around and then have a look at it again, hoping this is fixed.
Oh, I tagged this way too quickly. It's not an issue with the audio system. Check #14562 for a workaround.
This is also not exactly a bug, it works as @Phoenix1747 stated. The File API does not look at the path remapping.
This essentially a duplicate of #15380, so I'll close this.
@vnen Problem with #14562 is that you also have to append the hash to get the real filename in .import
but how to get the hash if the original files don't exist anymore?
@Phoenix1747 you can call load()
with the original path and it'll automatically load the on from the import folder. The problem is only when checking with file_exists()
(the workaround is simply checking if the file_name + ".import"
file exists instead).
If you really need the file from the .import
folder (don't know why you would) you can either calculate the file name (it's simply a MD5 hash of the path) or load the .import
file with ConfigFile and read the remapped path.
Oh, that makes so much sense, thanks! Am 24.04.18, 20:53, George Marques notifications@github.com schrieb: @Phoenix1747 you can call load() with the original path and it'll automatically load the on from the import folder. The problem is only when checking with file_exists() (the workaround is simply checking if the file_name + ".import" file exists instead). If you really need the file from the .import folder (don't know why you would) you can either calculate the file name (it's simply a MD5 hash of the path) or load the .import file with ConfigFile and read the remapped path.
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.
{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/godotengine/godot","title":"godotengine/godot","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/godotengine/godot"}},"updates":{"snippets":[{"icon":"PERSON","message":"@vnen in #18390: @Phoenix1747 you can call load()
with the original path and it'll automatically load the on from the import folder. The problem is only when checking with file_exists()
(the workaround is simply checking if the file_name + \".import\"
file exists instead).\r\n\r\nIf you really need the file from the .import
folder (don't know why you would) you can either calculate the file name (it's simply a MD5 hash of the path) or load the .import
file with ConfigFile and read the remapped path."}],"action":{"name":"View Issue","url":"https://github.com/godotengine/godot/issues/18390#issuecomment-384041374"}}}
Godot version: 3.0.2.stable.official
OS/device including version: "Windows 10
Issue description: When exporting a game that loads .wav files procedurally into an audio stream player, the files aren't loaded and played properly in the exported game (as in, they're silent). The size of the resource package suggests that they might still have been exported, just not loading properly.
adding "*.wav" to the list of non-resources that get exported doesn't change this
putting the "Music" folder of my project, with the uncompressed files, in the same location as the .exe, makes the audio work in-game
If it is any help this is the code through which i load the sounds `func _loadSounds(sounds, time): players = [] soundlist = sounds
Sounds that are in-built in other audiostreamplayer, which are not loaded through code, work normally