I was running some tests and noticed some odd things with doppler.
I narrowed it down to the following test case:
When using the software 3d, the pitch of a sound moving directly away from you is increased instead of decreased.


include <stdlib.h>

include <stdio.h>

include "fmod.h"

include "Windows.h"

char* fileToLoad = "siren.wav"; //22K,16 bit mono, looping wav.

void Test3d(int flags)
int i;
float posVector[3]={0,0,5};
float velVector[3]={0,0,50};

FSOUND_SAMPLE *sample3d = FSOUND_Sample_Load(FSOUND_FREE, fileToLoad, flags, 0);
int channel = FSOUND_PlaySound(FSOUND_FREE, sample3d);

printf(&quot;Sound directly in front of listener, Velocity increasing away from listener,\n pitch should get lower...\n&quot;);
for (i=50; i&lt;200; i++){
    velVector[2] = i;
    FSOUND_3D_SetAttributes(channel, posVector, velVector ); 
    Sleep (50);  


int main(int argc, char* argv[])
float center[3] = {0};
FSOUND_Init(44100, 16, 0);

FSOUND_3D_Listener_SetAttributes(center, center, 0,0,1.0, 0,1.0,0);
//should be same as default - Z forward.

printf(&quot;Testing HW 3D \n&quot;);
Test3d(FSOUND_HW3D|FSOUND_LOOP_NORMAL);  //test sounds great.
printf(&quot;Testing SW 3d \n&quot;);
Test3d(FSOUND_LOOP_NORMAL);              //test not so great.



Notice that the software 3d and the hardware 3d have opposite effects.
You may have a bug in your 3d math. Or did I miss something important?

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.