0
0

hi,

i am new to fmod and want to add 3D osunds to our game. i already looked at the 3D sample and studied this forum and the docs but i can’t seem to find a solution to my answer. i really hope i find help here.
my problems are the following two:

  1. when i want to play a 3D sound i need to call Sleep() so that the sound is actually played, else it would just start to play and then stop immediately, resulting in a VERY short hearable play of the sound and stop immediately.

  2. when i position a sound to the exact same position of my listener the sound gets played correctly most of the time but suddenly the sound gets played very quiet only on the left speakers a few times, then it plays normal again.

here is my code:

[code:paulu1fj]
FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND);
FSOUND_SetDriver(0);
FSOUND_SetMixer(FSOUND_MIXER_AUTODETECT);
FSOUND_Init(44100, 32, FSOUND_INIT_GLOBALFOCUS);
FSOUND_SetVolume(FSOUND_ALL, 255);
FSOUND_SetSurround(FSOUND_ALL, TRUE);
FSOUND_3D_SetMinMaxDistance(FSOUND_ALL, 10000, 10000000);
[/code:paulu1fj]

[code:paulu1fj]
GameBreaks = FSOUND_Sample_Load(FSOUND_FREE, FILENAME_SOUND_GAME_BREAKS, FSOUND_NORMAL | FSOUND_HW3D | FSOUND_LOOP_OFF | FSOUND_FORCEMONO, 0, 0);
if (GameBreaks == NULL)
{
char buffer[1000];
sprintf(buffer, "ERROR: loading sound file ‘FILENAME_SOUND_GAME_BREAKS’ failed!");
CError::throwError(buffer);
}

[/code:paulu1fj]

[code:paulu1fj]
while ( (isGameRunning) )
{
...
...
Players[0]->get3DPosition(HumanPlayerPosition, HumanPlayerUp, HumanPlayerView);

    if (KeyboardHandle->isKeyPressed(KB_SC_LEFT))
    {
        // play breaks sound
        float position[3] = {HumanPlayerPosition._x, HumanPlayerPosition._y, HumanPlayerPosition._z};
        //float position[3] = {0, 0, 0};
        int channel = FSOUND_PlaySoundEx(FSOUND_FREE, GameBreaks, NULL, TRUE);
        //int channel = FSOUND_PlaySound(FSOUND_FREE, m_SoundBreaks);
        FSOUND_3D_SetAttributes(channel, position, NULL);       
        FSOUND_SetPaused(channel, FALSE);
        Sleep(1000);
    }

    // set listener's position for sound api
    float position[3] = {HumanPlayerPosition._x, HumanPlayerPosition._y, HumanPlayerPosition._z};
    float front[3] = {HumanPlayerView._x, HumanPlayerView._y, HumanPlayerView._z};
    float top[3] = {HumanPlayerUp._x, HumanPlayerUp._y, HumanPlayerUp._z};
    FSOUND_3D_Listener_SetAttributes(position, NULL, front[0], front[1], front[2], top[0], top[1], top[2]);
    FSOUND_Update();

...
...
}
[/code:paulu1fj]

do you see anything wrong here? did i miss something?
the 3D sound sample works well for me. no such problems there :-(

EDIT
oh, btw: i have a soundblaster audigy, the newest drivers, winxp, … so there shouldn’t be any problems though?

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.