[PD] How does vline~ work under the hood?

Matt Barber brbrofsvl at gmail.com
Sat Sep 26 07:19:42 CEST 2015


Very quickly:

1) vline~ stores a linked list of events with start times and target times
(the end point of the linear movement) using the t_vseg struct; events are
scheduled in the vline_tilde_float routine.

2) vline_tilde_new sets all of the relevant struct members. You'll want to
see how the x_referencetime member works because it's used to measure time
everywhere else. There are lots of

3) As vline_tilde_perform runs, it checks every sample to see if the start
time of the next event(s) have elapsed (it's possible to have two events at
the same logical time, where one leaps to a value and the other ramps from
that value). It calculates the increment based on a linear interpolation
from the start time to the target time, and from there it can increment
until the target time has elapsed. The interpolation is how it gets
subsample accuracy. Checking every sample to see if a new event should
start is more expensive than checking every block (obviously).

4) A lot of the clock objects and functions are in m_sched.c; there are
others in the system interface file s_inter.c

Hopefully this is all correct. If not, someone else please chime in.

On Fri, Sep 25, 2015 at 3:21 AM, i go bananas <hard.off at gmail.com> wrote:

> I want to recreate the timing accuracy of vline~ in a c++ project, and
> there's something that i can't figure out exactly - how does it act,
> seemingly outside of the block construct, to get its accuracy?
>
> in the source code, there is a calculation for elapsed logical time, and i
> assume that has something to do with it?
>
> if i make a vline~ from 0 to 1, over 10ms, does this mean that it actually
> doesn't START right on 0, but rather starts at a slightly offset value to
> compensate for the block boundary?
>
> any help would be appreciated!
>
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20150926/2abb122f/attachment.html>


More information about the Pd-list mailing list