0
0

Hey all, I have some problem with 3d sounds using FMOD.
(sound definately isnt 3d =P )

At the end of every game loop I do this :

float listernerpos[3]= {0, 0, 0};
listernerpos[0]= world->player->position.x;
listernerpos[1]= world->player->position.y;
listernerpos[2]= world->player->position.z;
FSOUND_3D_Listener_SetAttributes(&listernerpos[0], NULL, 0, 0, 1.0f, 0, 1.0f, 0);
FSOUND_3D_Update();

my sound comes from when I fire a gun.
in my FireWeapon function I have this :

float gunPosition[3] = {0, 0, 0};
gunPosition[0]= 200.0f;
gunPosition[1]= 200.0f;
gunPosition[2]= 200.0f;

FSOUND_Sample_SetMinMaxDistance(pistolFire, 4.0f, 1000.0f);
FSOUND_3D_Listener_SetRolloffFactor(1000.0f);
FSOUND_3D_SetAttributes(10, &gunPosition[0], NULL);
FSOUND_PlaySound(10 ,pistolFire);

I know some of this code prolly isnt right like the Rolloff factor and min max distance, but it was just to test, and no matter what i do with those it doesnt change that my gunshot sound is exactly like it was before I started adding 3d stuff.

any help is appreciated thx

(oh and ya, i am loading the sound with the HW3D flag)

  • You must to post comments
0
0

hmm your right, heres my FireWeapon() function now:

float gunPosition[3] = {0, 0, 0};
gunPosition[0]= 200.0f;
gunPosition[1]= 200.0f;
gunPosition[2]= 200.0f;

FSOUND_Sample_SetMinMaxDistance(pistolFire, 400.0f, 3000.0f);
FSOUND_3D_Listener_SetRolloffFactor(100.0f);

int channel= FSOUND_PlaySound(FSOUND_FREE ,pistolFire);
FSOUND_3D_SetAttributes(channel, &gunPosition[0], NULL);

still, doesnt work, later on the gunPosition will be the position of the player obviously, but for testing purpose I always set it at the same place so I can see if 3d sound is working when im moving around my listener.

Well the pistolFire sounds 2D, and all other sounds that I try to play are distorted if I try using 3d….weird =P

  • You must to post comments
0
0

Call FSOUND_3D_Update per loop.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.