0
0

heyy everybody

i m designin a game based on skating.. I want to play regular skating souond whenever my player does skating animation..

nw the probllem is skating animation is called everyframe.. so skating sound doesn’t get any chance to play at all…

here’s my code (skating animation callback function)[code:3rrufskf]

void AnimationBlender::setSkating(bool b)
{
skating=b;

//calling sound every frame
//GameSound::Instance()->_fmodSystem->playSound(FMOD_CHANNEL_REUSE, GameSound::Instance()->_fmodGameSkateSound, false, &GameSound::Instance()->_fmodGameSkateChannel);

if(skating==true)
{
    blend("Skate");


}
else
{
    blend("Idle");    

}

}

[/code:3rrufskf]

the animation blender function is called every frame and hence the sound inside it…. so at the end i dont get any sound at all…

can i some how keep it playing once it is calle ( irrespective of frame).. i mean once the animation is started i want to play the sound and do not stop until the sound file is over…. not dependent on frame…

  • You must to post comments
0
0

i mean is there any way i can check ( if the sound is playing ?? ) and if its playing keep it playing until its over and just make it independent of the frame..

  • You must to post comments
0
0

A method a lot of people use is to add triggers to animations, that call sounds at specified points. That way, you can sync the sound to the animation very precisely.

If that is not an option, add a channel variable, that is initially set to NULL, fill it in with the sound->play if it is, if it’s not NULL, do a getstate on the channel, to see if its finished.

Getstate returns a bit pattern, not a number, & the bits out to check that it has stopped playing.

  • You must to post comments
0
0

thanks for your reply

I will definately try this thing and will let you know wat’s happening .. :-)

  • You must to post comments
0
0

for the moment i did this change in my code and i solved the problem i was facing previously…[code:2dijww99]

void AnimationBlender::setSkating(bool b)
{
skating=b;

if(skating==true)
{
    bool isPlayingSkateSound;

        GameSound::Instance()->_fmodGameSkateChannel->isPlaying(&isPlayingSkateSound);
        blend("Skate");
    if (!isPlayingSkateSound)
    {
    GameSound::Instance()->_fmodSystem->playSound(FMOD_CHANNEL_REUSE, GameSound::Instance()->_fmodGameSkateSound, false, &GameSound::Instance()->_fmodGameSkateChannel);    

    }
}
else
{
    blend("Idle");    


}

}[/code:2dijww99]

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.