Hi. I am trying to create a click triggered line~ whose variables can be changed at a signal rate (for interfacing with wave~ or play~ in an audio rate sequencer). I am in the process of debugging and have encountered a bizarre problem.
If you look at the while loop of my perform method, you'll see that every time a click is received (a 0 to 1 transition), the variable int 'count' is set to 0 (count = 0) and the short 'counting' is set to 1 (counting = 1; acts as a boolean variable). When count exceeds the value given to the second inlet (the variable lengthms, which is converted to lengthsr in the perform method), count is set to 0 again, and counting is set to 0 as well. In my output, I have the value of the boolean count.
Sounds like COMP101, and yet....
Take a look at my example patch, a metro is sending a click every 1000 ms. My counter counts for 5000 ms (the value given to the second inlet). Therefore, the output should stay at 1, because the count is constantly reset before it ever reaches its destination value. But if you look at the scope connected to the outlet, you'll see that brief clicks are showing up rather than a continuous 1. This deeply confuses and bewilders me.
Any help is very much appreciated. A zip of my XCode project (including a compiled mxo) and example patch can be found here:
Much thanks for your input!