I’m building a game which reads various words. Right now, I have a 630 wav files and my game sometimes playing the wrong sounds file. It only happens for certain words. For instance, “map” is always playing the “cheese” file. It’s most like “map” and “cheese” are sharing a hash key.
I’ve already increased the “Max Sound Data”, “Max Sound Buffers”, “Max Sound Sources” and “Max Sound Instances” to 1024.
Does anyone have any ideas why or how to debug this?
Would separating the sound files into different game objects help?
This sounds a bit strange to be honest. Can you please double check those two sound components and ensure that they reference two different wav/ogg files and that these two wav/ogg files actually aren’t the same?
No. It makes sense to have all sound components on one game object since it simplifies sound gating and other sound control operations.
I did some debugging and it definitely seems like there is a max of 256.
I created an array of all my words and started playing each of them. As expected, I’m seeing that when I it hits 257 is starts over again. So word[257] = word[1], word[258] = word[2]…
Does anyone know of a workaround? Right now, I’m considering trying…
splitting the sounds into multiple game objects. The idea is that the limit is actually per game object and not per project.
try OpenAL
See if there is a way to play only part of an audio file. for instance, merge all sounds into one long wav and instead, play seek to a position then play for X seconds. (e.g. similar to sprites but for audio).
Anyone have any thoughts on these?
As a mentioned before, I bumped all the project settings to 1024.
It indeed seems we had a place where the component id’s (numbers) got clamped to [0:255]. It seems like an easy fix (we’ll discuss it tomorrow), and if so, it should land in the next release scheduled for monday. I added ticket DEF-2979 for this.
Creating separate game objects also fixes the problem. I wrote a bash script to generate sound_{a … z}.go files. For my game, the IDs match the word so it was easy route the message to the correct game object based upon the word I want to say.