[PD] timing
Mathieu Bouchard
matju at artengine.ca
Thu Dec 23 18:17:39 CET 2010
On Thu, 23 Dec 2010, Roman Haefeli wrote:
> As Dietrich already pointed out, for some reason it stops working as
> expected when using a blocksize < 64. I don't why this is and I suspect
> it to be a bug.
I tried to fix it by introducing a x_yourmom property in [vline~] that
holds the value of clock_getlogicaltime to see whether it was the same,
and fudge the clock values according to how many times the same time has
been used. But it's a little bit off and this isn't the place where the
problem ought to be fixed.
And the way it is now, it only works if you send a triplet to [vline~],
so, I inserted a messagebox in your test patch, that is «$1 0 10».
Index: d_ctl.c
===================================================================
--- d_ctl.c (révision 14667)
+++ d_ctl.c (copie de travail)
@@ -249,6 +249,8 @@
t_float x_inlet1;
t_float x_inlet2;
t_vseg *x_list;
+ double x_yourmom; // because blocksize messes up logicaltime
+ int x_fudge;
} t_vline;
static t_int *vline_tilde_perform(t_int *w)
@@ -260,7 +262,10 @@
double inc = x->x_inc;
double msecpersamp = x->x_msecpersamp;
double samppermsec = x->x_samppermsec;
- double timenow = clock_gettimesince(x->x_referencetime) - n * msecpersamp;
+ double timenow = clock_gettimesince(x->x_referencetime) - n*msecpersamp;
+ if (clock_getlogicaltime() == x->x_yourmom) x->x_fudge++; else x->x_fudge=0;
+ x->x_yourmom = clock_getlogicaltime();
+ timenow += x->x_fudge*n*msecpersamp;
t_vseg *s = x->x_list;
for (i = 0; i < n; i++)
{
@@ -395,6 +400,8 @@
x->x_list = 0;
x->x_samppermsec = 0;
x->x_targettime = 1e20;
+ x->x_yourmom = -1;
+ x->x_fudge = 0;
return (x);
}
_______________________________________________________________________
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC
More information about the Pd-list
mailing list