i am using one sound file and trying to play it at different locations in my game. problem is that when i play the sound once( its a gun fire sound ) while my AI is shooting, the sound sort of echos at the wrong location.
i should also point out i am running some sort of LOD on the audio, as in it only plays the closest X number of sounds (in this case 13) and am letting FMOD play on a free channel. I am not using any priorities yet as all gunshots are as important as each other. the way the LOD works is:
– every sound gets added to a list
then once a frame i :
– i sort the list based on distance to the listener
– i stop any sounds that are too far down the list (index 13 to end)
– i play any sounds in the first 13 that are not alreay playing. (play them paused)
– i set the attributes( as these are only gun shot sounds it only needs to be set once )
-i unpause the sound
So my questions are:
Does Set 3d attributes check the sample’s address , as this would explain why i get the echo
am i getting FMOD to do too much per frame? should i be looking at this problem for a different angle?
How does FSOUND_FREE work? does it lok for a NULL channel first( a channel with nothing playing) before stealing channels?
i can paste code if that woould help any
- Stubbz_nzl asked 11 years ago
Sorry, i dont understand this. FSOUND_3D_SetAttributes just stores the vectors you pass to it inside the channel structure.
I think your problem is that i remember somewhere you were linking channels to sounds, as i said before, you shouldnt be doing this. One sound can play many times, and it sounds like you have this logic wrong where you are simply just setting the position on a wrong channel handle.
i read it the docs that
This means the only sound you can change the attributes (ie volume/pan/frequency/3d position) for are the
one you specifically called playsound for. If another sound steals that channel, and you keep trying to
change its attributes (ie volume/pan/frequency/3d position), it will do nothing.
This is great if you have sounds being updated from tasks and you just forget about it.
You can keep updating the sound attributes and if another task steals that channel, your original task
wont change the attributes of the new sound!!!
so does this mean that even if i was to play only one sound file, but in different locations, that the returned channel with reference would be different everytime??
just thought i should metion the struct i have is just a way of packaging info i need for everything. i still only load each sound file in once and pass the pointer around
is there any way of say having a callback function that when a sound stops playing i can set variables. i have a bool in the struct that indicates if the sound is playing or not( to save me querying FMOD all the time). or do you think it’s better if i do?
if i have 2 sounds, both using the same sound file; i play one of the sounds on channel 0. after a bit i play the other sound on the same channel then do a FSOUND_GetCurrentSample for that channel, will it return a different FSOUND_Sapmle pointer? or will they both have the same pointer? This is all in regards to my LOD of the audio.
also how stable is the new FMODEx? we are going to be entering an independant games compitition and we are also getting graded on this project, so i was wondering if it might be better if i used that instead. If i do, how hard ( or easy ) would it be to swap everything over?
Please login first to submit.