0
0

I have a weird problem:

I evaluating fmod for my engine and want to play ambient sounds and 3d sounds.
When I press a button FMOD::System::playSound is called:

[code:3np3rgt3]m_pSystem->playSound(FMOD_CHANNEL_FREE, _pSfx->GetSound(), true, &c );
if (c)
{
c->set3DAttributes( &pos, &vel );
c->setVolume( _pSfx->GetVolume() );
c->setLoopCount( 0 );
c->setPaused(false);
}[/code:3np3rgt3]

At first the sound cannot be heard, but each consecutive call the sound is louder until it reaches the maximum volume (almost like a fade in)

I wait a while and when I press the button again it starts with silence again. This happens with both ambient sounds and 3d sounds.

I don’t make any volume changes or move the listener or sound position.

Maybe someone came across the same problem.
I have no idea what’s going on.
Can somebody help?

  • You must to post comments
0
0

Can you check the results back from each call? are they all FMOD_OK?

  • You must to post comments
0
0

If you are making multiple calls to playSound using FMOD_CHANNEL_FREE you can expect multiple instances of the sound to play. This might explain the ‘getting louder’ if your sound is something simple like white noise or a constant tone.

Can you confirm that the value of _pSfx->GetVolume() is always the same and in the range 0.0f – 1.0f?

Like a1psx mentioned it’s very important to check the FMOD_RESULT enum being returned from every FMOD function call. It’s useful to create a function like this:
[code:36v62xhb]ERRCHECK( FMOD_RESULT result )
{
if (result != FMOD_OK)
printf( FMOD_ErrorString( result ) );
}[/code:36v62xhb]

-Pete

  • You must to post comments
0
0

I get the same effect with FMOD_CHANNEL_REUSE. The sound effect is not looped and only 2 seconds long (a sheep baaing).
The function calls all return FMOD_OK, I just left out the error checking for clarity.
Music stream is also faded in each time it is started. The longer the music is stopped the longer it takes to fade in. 😕

We are developing for ps3. I didnt have access to the other forum yet when I posted. Maybe this post can be moved?

This is the complete code sample:
[code:d5bfh192] Channel *c = _pSfx->GetChannel();
result = m_pSystem->playSound( FMOD_CHANNEL_FREE, _pSfx->GetSound(), true, &c );
ErrorCheck("playSound", result);

        if ( c )
        {
            Vector3 v_pos = _pSfx->GetPosition();

            // if a node is assigned, use its position
            Node* _pNode = _pSfx->GetNode();
            if ( _pNode )
                v_pos = _pNode->m_matrix.getTranslation();

            v_pos *= DISTANCEFACTOR;

            FMOD_VECTOR pos = { v_pos.getX(), v_pos.getY(), v_pos.getZ() };
            FMOD_VECTOR vel = {  0.0f, 0.0f, 0.0f };

            result = c->set3DAttributes( &pos, &vel );
            ErrorCheck("set3DAttributes", result);

            result = c->setVolume( _pSfx->GetVolume() );
            ErrorCheck("setVolume", result);

            result = c->setLoopCount( 0 );
            ErrorCheck("setLoopCount", result);

            result = c->setPaused(false);
            ErrorCheck("setPaused", result);
        }[/code:d5bfh192]
  • You must to post comments
0
0

Just tried the play_sound sample that came with the fmod sdk.
Same thing.

  • You must to post comments
0
0

ahem…hee, hee…

it seems my Dell monitor takes the sound from the HDMI input, does some weird shit to it and then puts it out to the speakers ( with a fade in )

…because when running it on the ps3 connected to our tv set sound’s just fine

…so, uhm, sorry for wasting your time

Seriously, though, thank for your help!

  • You must to post comments
0
0

Some kinda of volume management (to cope with different sources having different volumes?) – like when you change channels on TV, sometimes one is 2000 times louder, or an advert comes :)

Glad you got it sorted.

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.