[gmpi] Re: Topic 6: Time representation

On Wed, 30 Apr 2003 RonKuper@xxxxxxxxxxxx wrote:

> >>>
> Sure... so you calculate where you think they should be based on your
> current knowledge of the future, and if in the mean time you get tempo
> events, you recalculate your assumptions.
> <<<
>
> This recalculation is very painful to do, and doesn't always work.  We ran
> into this exact problem developing Project5.

Sorry, can you elaborate? Provided the plug has an accurate knowledge of
tempo (in the form of tempo events), it is always able to calculate the
musical time elapsed from the initial note event to the time when the
secondary event is due. A simple algorithm:-

for (all elements in queue)
{
calculate (musical time elapsed from now to next tempo change or end of
current buffer, whichever is sooner)
if (musical_time_elapsed > element's remaining delta)
{
 calculate absolute time of element, and render it.
}
else
{
 subtract musical time elapsed in this calculation from element's
remaining delta
}
}

Obviously this is not the most efficient possible implementation, but it
really should work.


----------------------------------------------------------------------
Generalized Music Plugin Interface (GMPI) public discussion list
Participation in this list is contingent upon your abiding by the
following rules:  Please stay on topic.  You are responsible for your own
words.  Please respect your fellow subscribers.  Please do not
redistribute anyone else's words without their permission.

Archive: http://www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

Other related posts: