0
0

I can’t figure out why my 3D sound is not working…

It for a top down view game where the listener is at x,y,0 and the sounds channels are at various x,y,0 positions with different MinMaxDistance settings. Normal settings are Min 100 meters, max 1000 meters where one movement unit (pixel) is one meter.

At first the channel was cutting out when the player moved to the right of the channels x position. I manage to fix this but my sound does not fade at all and when close to the channel, the sound ramps up, then ramps down quickly to half volume (moving a few meters) then never fades again. And it’s not playing to the left/right speakers properly. It does not matter what min max settings I use, it’s always acts the same.

Using lower right Cartesian grid

X 0 to +n to the right (west to east)
Y 0 to +n to the bottom (north to south)
Z is not used

OK here is my setup (pcode)

Sound = AddSound(FileName) creates a sound
SetSoundMinMax(Sound, 100,1000) sets up the sound min max distance (it sets the Sounds’s Min and Max distance properties)
LoopSound3D(Sound,1000,1000,0); Plays the sound at 100,100,0 (it starts the sound in 3d mode, sets the channel minmax (setting only the sound’s min max did not work), sets the channel xyz position.
XX = 100;
YY = 100;
Main loop
{
ChangeXXANDYYUsingKeyboard(&XX,&YY);
DiplayWorld();
SetListenerPosition(XX,YY,0); Set listener 0 to x,y,0
UpdatePosition() ; Updates to system
}

I can’t make heads or tails of the examples… Sorry, not my code and no comments. If someone can take a look at the actual code… It too is not well commented 😉 but a FMOD expert should have no problem.

I think the problem is in the SetLintenerPosition or in the way I set up the channels

I’m in my 12th hours using FMOD now and I really need help on this one. Please look at the code before telling me to check out the tutorial… I think I’m beyond the tutorial now. Don’t mind the way I reference sounds (cheap ID system) it’s a limitation of the calling application. Also, I haven’t worked out the memory management either.

All referencing system, sound effects and volume controls work perfectly. The only trouble is 3D sounds not fading right.

[url=http://host-a.net/icuurd12b42/dllmain.cpp:2cw27gt1][img:2cw27gt1]http://host-a.net/icuurd12b42/dllmain.cpp/link.png[/img:2cw27gt1][/url:2cw27gt1]

  • You must to post comments
0
0

What are you passing as the oriientation vectors. You have to pass perpendicular vectors – fmodexL will find this problem if you check the return codes.

  • You must to post comments
0
0

[quote="brett":3uaoxdqy]What are you passing as the oriientation vectors. You have to pass perpendicular vectors – fmodexL will find this problem if you check the return codes.[/quote:3uaoxdqy]

using fmodexL, this function never returns and deadlocks my application
[code:3uaoxdqy]
result = FMOD_System_CreateSound(mainsystem, soundfile, FMOD_LOOP_OFF | FMOD_3D | FMOD_HARDWARE, 0, &sound);
[/code:3uaoxdqy]

This is my set listenner pos code, to answer you vector question
number is 1 to 4 and x,y,z are the listener position.
The listener’s face is always pointing north (see first post)
left hear is at x- right hear is at x+
forhead is at y- back of head is at y+
feet is as z-, top of head at z+
[code:3uaoxdqy]
export double FMODSetListenerPosition(double number, double x, double y, double z)
{
if(number <1 or number > 4) return 0;
FMOD_RESULT result;
FMOD_VECTOR pos;
pos.x = x;
pos.y = y;
pos.z = z;
// FMOD_VECTOR forward;
// forward.x=0;
// forward.y = -1;
// forward.z=0;

FMOD_VECTOR forward        = { 0.0f, -1.0f, 0.0f };
//FMOD_VECTOR up             = { 0.0f, 0.0f, 1.0f };

result = FMOD_System_Set3DListenerAttributes(mainsystem, (int)number-1,&amp;pos,0,&amp;forward,0);
if (result != FMOD_OK)
{
    msg(FMOD_ErrorString(result),&quot;FMODSetListenerPosition Error1&quot;,MB_ICONWARNING);
    return 0;
}
return 1;

}
[/code:3uaoxdqy]

  • You must to post comments
0
0

Turns out, like many before me, I misread the description of MinMaxDistance… That is I only read the descripions of the parameters and not the whole function description…

Combined with the unit scaling set to 1 unit = 10 centemeters confusion is abound…

Though I have not figured out why i dont have the paning effect. I do have it in the 3d example so it’s not my headphones set to mono. I checked 😉

  • You must to post comments
0
0

You can’t just pass one vector, thats not a perpendicular vector as I just said.

  • You must to post comments
0
0

[quote="brett":3oj5qc2k]You can’t just pass one vector, thats not a perpendicular vector as I just said.[/quote:3oj5qc2k]

I dont have to tell you I have no clue what you are saying… You are way too deep in this stuff to make sense to a poor newbie like me.

Here is my latest dll code
[url=http://host-a.net/icuurd12b42/dllmain.cpp:3oj5qc2k][img:3oj5qc2k]http://host-a.net/icuurd12b42/dllmain.cpp/link.png[/img:3oj5qc2k][/url:3oj5qc2k]

here is my set listener code if you dont want to look at all that other stuff.
As it is right now, I get the fading I want because I use the non logarithmic fading system (thank god it’s there) but the left and right fading is not working. I already explained the setup in my other post.
[code:3oj5qc2k]
export double FMODSetListenerPosition(double number, double x, double y, double z)
{
if(number <1 || number > 4) return 0;
FMOD_VECTOR pos;
pos.x = x;//* worldscale;
pos.y = y;//* worldscale;
pos.z = z;//* worldscale;

FMOD_VECTOR forward        = { 0.0f, -1.0f, 0.0f };
FMOD_VECTOR up             = { 0.0f, 0.0f, 0.0f };
FMOD_VECTOR vel = {  0.0f, 0.0f, 0.0f };

FMODASSERT(FMOD_System_Set3DListenerAttributes(mainsystem, (int)number-1,&amp;pos,&amp;vel,&amp;forward,&amp;up));
return 1;

}
[/code:3oj5qc2k]

here is my sound instance placement code
[code:3oj5qc2k]
export double FMODLoopSound3d(double sound, double x, double y, double z)
{
if(!inited) return 0;
if(!(sound>0)) return 0;

FMOD_CHANNEL * channel = (FMOD_CHANNEL *)(DWORD) FMODInstanciateSound(sound);
if(channel == NULL) return 0;

FMODASSERT(FMOD_Channel_SetLoopCount(channel,-1));
FMODASSERT(FMOD_Channel_SetMode(channel,FMOD_3D_WORLDRELATIVE | FMOD_LOOP_NORMAL));

FMOD_VECTOR pos;
pos.x = x;//* worldscale;
pos.y = y;//* worldscale;
pos.z = z;//* worldscale;
FMOD_VECTOR vel = {  0.0f, 0.0f, 0.0f };
FMODASSERT(FMOD_Channel_Set3DAttributes(channel,&amp;pos,&amp;vel));
FMODASSERT(FMOD_Channel_SetPaused(channel,false));
return (DWORD) channel;

}
[/code:3oj5qc2k]

If you could simply tell me the values I should use… Trial and error is difficult when you dont have a clue…

…Later
Never mind
FMOD_VECTOR up = { 0.0f, 0.0f, 0.0f };
to
FMOD_VECTOR up = { 0.0f, 0.0f, 1.0f };

..later still
That setting works but when listener y = music y and listener x> music x, the sound flips left right speakers, causing a blurb actifact everytime you cross the y axis

  • You must to post comments
0
0

… To demonstrate the quirk, here is the test program.

[url=http://host-a.net/icuurd12b42/testdll.zip:124picm2][img:124picm2]http://host-a.net/icuurd12b42/testdll.zip/link.png[/img:124picm2][/url:124picm2]

move using asdw

Start moving left or right from the start you will note the sound is full on left or full on right instead of 100% on both when exatly on the sound or right next to it.

If you move up or down a little the quirk disapears. when you cross the y axis, the full on left or right happen…

  • You must to post comments
0
0

[url=http://host-a.net/icuurd12b42/testdll2.zip:fk7ivzf8][img:fk7ivzf8]http://host-a.net/icuurd12b42/testdll2.zip/link.png[/img:fk7ivzf8][/url:fk7ivzf8]

And this one adds a moving channel and doppler effects

The moving sound only plays on the right speaker and the doppler is not relative to the listener. Mayhaps it will help give a clue on the core of the problem.

asdw to move listener
space to mute moving channel.

The new dll code is included.

Am I getting anoying? 😉

  • You must to post comments
0
0

OK. I pretty much reolved everything to my satisfaction…

Turns out I was moving a head relative sound (by mistake) which caused the bad dobbler effect on it.

Which made me discover that 3d head relative souds dont like it if you move the listener and call FMOD_System_Update…

So I modified my add sound function so it will decide if the sound will be a 3d or a 2d sound instead of having them all 3d and faking 2d by setting the head relative flags as the documenttion suggested.

Cheers Gang!

  • You must to post comments
Showing 8 results
Your Answer

Please first to submit.