0
0

Hi, I’m new to FMOD so go easy on me :)

I’m doing a game and want to play a sound when I move my car so I run the code beneath, but what I want to know is if there is a way to determine if the sound has completed. Right now the if-statement is (keyPressedDown), i.e. Im accelerating my car.

[code:19m6ttkc]
if( /HERE I NEED TO KNOW IF THE SOUND HAVE STOPPED OR NOT/){
m_gameSound->m_sound2->m_gameSound->m_result = m_gameSound->m_system->playSound(
FMOD_CHANNEL_FREE, m_gameSound->m_sound2, false, &g_gameSound->m_channel2);
m_gameSound->ErrorCheck(m_gameSound->m_result);
}
[/code:19m6ttkc]

  • You must to post comments
0
0

Use a variable pointing to a channel to store your sound channel? Rough code btw

FMOD::Channel *channel = NULL;

bool isPlaying = false;

if (Channel)
{
result = Channel->isPlaying(&isPlaying);
error_check(result);
}

if (!isPlaying)
{
result = playSound(sound, &channel);
error_check(result);
}

  • You must to post comments
0
0

Excellent! thank you very much :)
I got stuck in thinking about the sound itself and looked for methods for it hehe.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.