Potential Bug regarding MIDI Clock Executed Scripts
Posted: 20 Jun 2015 21:19
I have a script in my Traktor template that listens for midi clock, and refuses to let the user proceed past setup without proper midi clock...
This by far is the most common hang up people have (although trouble shooting this is easier than explaning why other parts of the template that rely on clock are not working)
Many times the users fail to wire everything together correctly.
However I had noticed that sometimes I was not detecting clock in the template, even though i was receiving it (checked in different templates).
I had some free time today and decided to re investigate.
The jist of the logic was:
Script A: Listen for clock
Script B: Flag whether clock is active
This worked most of the time, but sometimes just refused to acknowledge the clock; and I would end up doing a hard restart on all software compnents and template reload a few times to get it to click...
I am now monitoring the step variable on a step switch object slaved to clock 0, instead of an actual Clock script; but this is beside the point.
You may or may not be aware that scripts retain the attributes of their execution type even if you change them. So, if I initially made Script A to execute on the change of variable "xyz" from 0 to 1, and then later decided to change it to fire on MIDI clock, it will retain the attributes of executing on variable "xyz" from 0 to 1... Even if I come back 6 months later (the actual XML attributes are stored in the file).
This is of course, exactly what I did. I cannot help but wonder whether some of these retained attributes were causing occasional conflict with the execution of the on midi clock script.
This by far is the most common hang up people have (although trouble shooting this is easier than explaning why other parts of the template that rely on clock are not working)
Many times the users fail to wire everything together correctly.
However I had noticed that sometimes I was not detecting clock in the template, even though i was receiving it (checked in different templates).
I had some free time today and decided to re investigate.
The jist of the logic was:
Script A: Listen for clock
Code: Select all
On Midi Clock 0, for every 1/64th beat:
Set the variable "step_time" to the current time
Code: Select all
On Frame Execution
If variable "step_time" plus 2 seconds is greater than current time:
Clock is working
Else
Clock is not working
I am now monitoring the step variable on a step switch object slaved to clock 0, instead of an actual Clock script; but this is beside the point.
You may or may not be aware that scripts retain the attributes of their execution type even if you change them. So, if I initially made Script A to execute on the change of variable "xyz" from 0 to 1, and then later decided to change it to fire on MIDI clock, it will retain the attributes of executing on variable "xyz" from 0 to 1... Even if I come back 6 months later (the actual XML attributes are stored in the file).
This is of course, exactly what I did. I cannot help but wonder whether some of these retained attributes were causing occasional conflict with the execution of the on midi clock script.