0
0

i’m having some rather odd problems getting 3d sound functional…at first i thought it just plain didn’t work…but if i step through my program using the debugger, the sound will play when i unpause the channel to be used. however, when i’m just running the app, no sound plays at all. my call sequence looks something like this:

[code:1fnxhqkw]
// called during init:
FSOUND_SetOutput( FSOUND_OUTPUT_DSOUND );
FSOUND_SetMixer(FSOUND_MIXER_QUALITY_AUTODETECT);
FSOUND_Init(44100, 0, FSOUND_INIT_DSOUND_DEFERRED|FSOUND_INIT_DSOUND_HRTF_LIGHT|FSOUND_INIT_GLOBALFOCUS);
h = FSOUND_Sample_Load(FSOUND_FREE, "blah.wav", (FSOUND_NORMAL | FSOUND_FORCEMONO | FSOUND_HW3D), 0, 0);

// called to play the sound through a keystroke trigger
channel = FSOUND_PlaySoundEx(FSOUND_FREE, h, NULL, TRUE) & CHANNEL_MASK;
FSOUND_3D_SetMinMaxDistance(channel, fMinDist, fMaxDist);
FSOUND_3D_SetAttributes( channel, (FLOAT)&pos, (FLOAT)&vel );
FSOUND_SetPaused(channel, FALSE); //if i single step over this, the sound will play

// called at the end of every frame
FSOUND_3D_Listener_SetAttributes(...);
FSOUND_Update();
[/code:1fnxhqkw]

Also it would seem that there is no distance attenuation happening when i can hear the sound…also everything seems to be returning success codes…any thoughts?

thanks!

  • You must to post comments
0
0

the 3d sample works just fine, and my code mimics it pretty well, i’ve stripped it down so the call sequence looks like this now:

[code:vahw1x3m]
FSOUND_SetOutput( FSOUND_OUTPUT_DSOUND );
FSOUND_SetDriver(0);
FSOUND_SetMixer(FSOUND_MIXER_AUTODETECT);
FSOUND_INIT(44100, 0, FSOUND_INIT_GLOBALFOCUS);

FSOUND_SAMPLE* hSample = FSOUND_Sample_Load(FSOUND_FREE, "blah.wav", FSOUND_HW3D, 0, 0);
INT channel = FSOUND_PlaySoundEx(FSOUND_FREE, hSample, NULL, TRUE);
FSOUND_3D_SetMinMaxDistance(channel, 10.0f, 10000.0f);

FLOAT soundPos[3] = { 0.0f, 0.0f, 10.0f };
FLOAT soundVel[3] = { 0.0f, 0.0f, 0.0f };

FSOUND_3D_SetAttributes(channel, soundPos, soundVel);
FSOUND_SetPaused(channel, FALSE);

// listenPos is {0.0f, 0.0f, 0.0f}
// listenVel is {0.0f, 0.0f, 0.0f }
// listenDir is {0.0f, 0.0f, 1.0f }
// listenUp is {0.0f, 1.0f, 0.0f }

FSOUND_3D_Listener_SetAttributes( ... );
FSOUND_Update();
[/code:vahw1x3m]

it turns out the FSOUND_INIT_DSOUND_HRTF_* flag was causing it to play when i single stepped over the unpause call…now there’s just nothing. not quite sure where i’m going wrong here…

also i was masking the channel flags for some other data structures, though now i realize that i don’t need to, and shouldn’t change those values since they are reference counted by fmod. didn’t seem to change the behavior i’m experiencing though.

thanks again for the help brett!

  • You must to post comments
0
0

my sound is mono, doubled checked the behavior with a stereo sound with FSOUND_FORCEMONO enabled, same thing…everything is returning success, though curiously, FSOUND_3DSetMinMaxDistance() is returning FALSE, even though FSOUND_GetError() returns 0, which is no error….what gives?

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.