フォーラム: 開発者 (スレッド #32670)

Simple Tip on synchronize motion and music (2012-08-18 08:28 by urz9999 #65109)

Hi, just want to share a tip that can be useful to those who want to play music with motion in xna regardless of FPS loss.

First we must create a new class variable of type TimeStamp:

TimeStamp oldTime = new TimeStamp();

than in the update method we update the MMDXCore.Instance like this:

TimeSpan up = MediaPlayer.PlayPosition.Subtract(oldTime);
oldTime = MediaPlayer.PlayPosition;
MMDXCore.Instance.Update((float)up.TotalSeconds);

This way the motion remains always on synch as the music progresses.

Hope this could be useful for others as well.
As always thanks for you work.

Alessandro

RE: Simple Tip on synchronize motion and music (2012-08-23 11:27 by wilfrem #65214)

GameTime.TotalGameTime property do not tell us wall clock time when xna-Game running with fixed-step clock.
I think this is the best way to know wall clock time too.

http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.gametime.totalgametime.aspx
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.gametime.elapsedgametime.aspx
#65109 への返信

RE: Simple Tip on synchronize motion and music (2012-08-23 18:28 by urz9999 #65222)

Thx, yes you're absolutely right, it could be used in that way too.
BTW any news on the legs motion problem? I've run several tests trying to figure it out and i notice that the error usually occurs when legs are near each other or when they are near to other body parts like stomach or chest. I've also tried to disable physics but that didn't help so i don't think physics is the problem.

Regards,
Alessandro
#65109 への返信

RE: Simple Tip on synchronize motion and music (2012-08-23 18:42 by wilfrem #65223)

Leg motion problem is not fixed yet.
I think CCDSolver can't solve IK because of limits. So, I trying to fix IK solver. but not yet.

#65222 への返信

RE: Simple Tip on synchronize motion and music (2012-08-23 18:53 by urz9999 #65224)

Ok, np don't push yourself too much :) let me know if i can help someway.

Alessandro
#65109 への返信