Mesh with animations state and sound

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
kubatp
Gnome
Posts: 368
Joined: Tue Jan 06, 2009 1:12 pm
x 43

Mesh with animations state and sound

Post by kubatp »

Hi,
can somebody give me a simple answer, please?
Is it possible to have a mesh with animation state(s) and sound(s) for this animation state?
I.e. when I start the animation, it plays the sound as well?
Thank you very much.
User avatar
tod
Troll
Posts: 1394
Joined: Wed Aug 02, 2006 9:41 am
Location: Bucharest
x 94
Contact:

Re: Mesh with animations state and sound

Post by tod »

Ogre is a Graphics Rendering Engine, it doesn't do sounds. And besides, when you start the animation, why don't you play your sound also?
User avatar
Faranwath
Halfling
Posts: 93
Joined: Mon Jul 09, 2012 2:19 pm
Location: Cuba
x 7

Re: Mesh with animations state and sound

Post by Faranwath »

kubatp wrote:Is it possible to have a mesh with animation state(s) and sound(s) for this animation state?
I.e. when I start the animation, it plays the sound as well?
Not out of the box, but, as tod said, you could simply play the sound right after starting the animation.

Code: Select all

// ...
// code for starting the animation
// ...

play_sound("my_sound.mp3");
kubatp
Gnome
Posts: 368
Joined: Tue Jan 06, 2009 1:12 pm
x 43

Re: Mesh with animations state and sound

Post by kubatp »

Hi,
thank you for reply. There are number of reasons:
  • The sound has a latency when I play it separately.
  • It is a "waste" to have the sound as long as the animation when you just want to add sound (for example) for "march step".
  • When you have looping animation, you have to be careful to correctly reset both together.
  • You need to sync these things in code. It is much cleaner to have animation which already includes sound and the work can be done purely by 3D modeller.
From your replies I suppose there is no solution for this except of using 3rd party library, correct?
User avatar
Faranwath
Halfling
Posts: 93
Joined: Mon Jul 09, 2012 2:19 pm
Location: Cuba
x 7

Re: Mesh with animations state and sound

Post by Faranwath »

kubatp wrote:The sound has a latency when I play it separately.
Are you streaming it? That should prove faster.
kubatp wrote:You need to sync these things in code. It is much cleaner to have animation which already includes sound and the work can be done purely by 3D modeller.
You have a point. But even so, this can be abstracted.
kubatp wrote:From your replies I suppose there is no solution for this except of using 3rd party library, correct?
Quoting tod once more, Ogre is only concerned with graphics.
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56
Contact:

Re: Mesh with animations state and sound

Post by Klaim »

For steps and other sounds triggered by, for example, collision and related to animations, one way to do it is to have tag points on the skeleton, which in some cases (when playing some animations for example) you "check" (whatever that mean) to trigger the sound.
Ogre can only give you the tag points, the rest you'll have to do yourself. Also, some of these triggers, if related to collisions, might be implemented using the physics engine instead or your implementation of collision system.
kubatp
Gnome
Posts: 368
Joined: Tue Jan 06, 2009 1:12 pm
x 43

Re: Mesh with animations state and sound

Post by kubatp »

Thank you very much for your replies and opinions.
I understand from your replies that I have to find a solution how to sync animations and sounds on my own.
Happy coding:)
Post Reply