From ac3260ec0aa03d91f7cb2a8f47eca044ab8337ae Mon Sep 17 00:00:00 2001 From: Yonathan Randolph Date: Wed, 23 Apr 2014 11:02:22 -0700 Subject: [PATCH] Send time of point within stroke. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, only the time of the first point in the stroke was given to handle_point. Send a more specific time for each point within the stroke based on the point’s index within the stroke. For Livescribe pens, the time between each sample is 1000/75ms = 13.3ms. --- parsestf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parsestf.py b/parsestf.py index 867b337..18c9e98 100644 --- a/parsestf.py +++ b/parsestf.py @@ -195,6 +195,7 @@ def parse(self): xa=0 ya=0 + sample_in_stroke = 0 while True: header = self.get_header() if header==0 or header==1: @@ -213,6 +214,8 @@ def parse(self): if time==0: self.handle_stroke_end(time) break + sample_in_stroke += time + point_time = start_time + sample_in_stroke * 1000 // self.speed do_delta = True if header > 0: @@ -244,7 +247,7 @@ def parse(self): ya *= 256 / time f0 += deltaf - self.handle_point(x0, y0, f0, start_time) + self.handle_point(x0, y0, f0, point_time) pass except Exception, e: print e