First time here? Check out the FAQ!
x

How do I create a reliable event driven Tool?

0 votes
443 views

In the Kata we're writing a Tool that's collecting data from a running Sound. The Tool and Sound communicate through !EventValues. The Sound will fire off a data capture event fairly sparsely. Maybe 20 events per second with events not usually closer than 20ms apart.

The !Write event would go high for a single Capytalk cycle (ie 1ms) and then we'd read off the values of 2 other !EventValues.

We tried to write the Tool in an event driven paradigm, with StepIntervalInMilliseconds set to 1000, and StepWhenChanged enabled for our key !EventValues.

At the moment we're doing very little in the Tool - putting the values into an OrderedCollection and displaying them once the Sound has finished it's process - and we're missing most of the events.

If the !Write event is 1ms long then we will often miss all of the events or just capture 1 or 2 out of about 40.
Using turnOnFor: we've extended the length of the !Write event. We've tried values around 20ms up to 200ms. We capture more events, to some extent, as we increase the gate time, but not reliably and the sampled values of the other !EventValues we save are never the same.

Have we forgotten to configure the Tool in some basic way? Is there a good pattern for writing event driven Tools?

The tool - work in progress.

asked Jul 2, 2021 in Capytalk & Smalltalk by alan-jackson (Virtuoso) (15,840 points)
edited Jul 6, 2021 by alan-jackson
Hi Alan,
Could you please upload the Tool for us to try here?
Thanks!
I've added the files to the original question.
BTW in the example that Alan has sent, you may need to know that you should use sound "MTapRecorder v4" found on the top left and you need to press "Reset" button on the VCS to get it started without the tool.

Please log in or register to answer this question.

...