Search code examples
javaeventstimesimulationmultimedia

Time manipulation/simulation and event scheduling in java


I'm currently prototyping a multimedia editing application in Java (pretty much like Sony Vegas or Adobe After Effects) geared towards a slightly different end.

Now, before reinventing the wheel, I'd like to ask if there's any library out there geared towards time simulation/manipulation.

What I mean specifically, , an ideal solution would be a library that can:

  • Schedule and generate events based on an elastic time factor. For example, real time would have a factor of 1.0, and slow motion would be any lower value; a higher value for time speedups.

  • Provide configurable granularity. In other words, a way to specify how frequently will time based events fire (30 frames per second, 60 fps, etc.)

  • An event execution mechanism of course. A way to define that an events starts and terminates at a certain point in time and get notified accordingly.

Is there any Java framework out there that can do this?

Thank you for your time and help!


Solution

  • Well, it seems that no such thing exists for Java. However, I found out that this is a specific case of a more general problem.

    http://gafferongames.com/game-physics/fix-your-timestep/

    Using fixed time stepping my application can have frame skip for free (i.e. when doing live preview rendering) and render with no time constraints when in off-line mode, pretty much what Vegas and other multimedia programs do.

    Also, by using a delta factor between each frame, the whole simulation can be sped up or slowed down at will. So yeah, fixed time stepping pretty much nails it for me.