In my game I’m attaching 3D looping ambient sounds (engine noises) to AI vehicles. When I setup the enemy vehicle I create the sound and set it to paused. The problem is I do not update or unpause the sound until that AI vehicle is awoken and when this happens a chirp / beep sound distortion is heard before the engine sound begins looping.
I have tried not playing the sound until it’s awoken as well as the pause/unpause thing, yet neither seem to get rid of this problem of mine. I have tested many different sounds so it’s not the sound effect, and it seems to happen on at least 4 different computer hardware setups.
Any help would be greatly appreciated.
Keep up the good work FMOD owns
- ValheruOrden asked 13 years ago
Not necessarily Graduate Bruce…
He may have tried many different samples, using his method of triggering
the sound effect, but has not tested the sound effect that is making the
noise in an external program to see if it is the actual sample causing
It’s very unlikely that every last one of the sound effects he’s tried have the same noise in the actual sample. Didn’t he just say he tried “many different sound effects?” [b:3kkvbysn]The sound effect that is making the noise[/b:3kkvbysn], in your words bushido, is in fact multiple sound effects, not just one. I thought I just got finished saying that.
The sounds are ok, I’ve tested them in 2D and outside the program so it’s something I’m doing wrong for sure.
Basically the sound works perfectly as the enemy moves except that the right as it turns on “enemy is triggered” a beep happens. It reminds me of the windows beep sound. I do not play this sound until the enemy is activated nor do I update it until then, however it is created upon start of the program.
Here is where I play the sound (when unit is activated for first time)
void CAudio::Play3DAudio(float min = 25.0f, float max = 10000.0f, int volume = 128)
FSOUND_Sample_SetMinMaxDistance(m_Sound, min, max);
m_Channel = FSOUND_PlaySoundEx(FSOUND_FREE, m_Sound, 0, true);
Here is where I update the sound of the enemy engine every frame when the enemy is activated. Cur and Last pos are = to enemys start pos, and are updated every frame it’s activated through GetPosition.
// Update the engine sound GetPosition(&m_CurPosition, 0); Velocity.x = (m_CurPosition.x - m_LastPosition.x) / g_FrameTime; Velocity.y = (m_CurPosition.y - m_LastPosition.y) / g_FrameTime; Velocity.z = (m_CurPosition.z - m_LastPosition.z) / g_FrameTime; m_pEngineSFX->UpdateSound(m_CurPosition, Velocity); m_LastPosition = m_CurPosition;
Here is my actual UpdateSound function
void CAudio::UpdateSound(CVector3f pos, CVector3f vel)
float distancesquare = ((camerapos.x – pos.x) * (camerapos.x – pos.x)) + ((camerapos.y – pos.y) * (camerapos.y – pos.y)) +
((camerapos.z – pos.z) * (camerapos.z – pos.z));
if(distancesquare >= MAX_DISTANCE)
posvec = pos.x;
posvec = pos.y;
posvec = -pos.z;
velvec = vel.x;
velvec = vel.y;
velvec = -vel.z;
FSOUND_3D_SetAttributes(m_Channel, posvec, velvec);
So when a unit is activated I here is what I do basically. Play the sound (starts paused). Then when it reaches that units update it then Updates that sound and unpauses it. It then continues to update the sound every frame until the unit dies.
Thanks for your help
- ValheruOrden answered 13 years ago
Please login first to submit.