Hi all!
I am building a small sequence player that sends a new index value each time a certain time has passed and updates the index of a switch. I am using the time from a stop watch connected to a file player. I am then using global channels to pass the values on in this sketch. I am using a sample and hold in order to store the index number for each waypoint. This all works fine the first time the patch is running but the second time it breaks. It seems like the sample and hold does not want to work since the value that it holds is the same (The index). I have looked around the forum and it seems like it could have something to do with the frametime? Though a frame delay does not help. Is there a better way of doing this? I have built a reset function that resets the stopwatch, could this be the issue?
You don’t want to actually lay these things out like that, but want to make it so you use some sort of repetition like a ForEach loop.
You can use something like Where, which is a bit like a ForEach with Filtering:
I am sure there are even better ways, but this would be one solution to make it a little bit more easy to maintain.
time-slot-from-spread.vl (14.7 KB)
1 Like
In fact, you can just check if it is larger, since we are doing FirstOrDefault after the results. That makes it even simpler:
Thank you so much! I will check this one out. I was assuming there was a better way of doing it with looping, so thanks for showing a way to do it with loops!
This is what the BinarySearch node is for:
There are also versions for KeyValuePair that are like key frames. The Lerp version can interpolate between values if there is a Lerp node defined for the data type you want to interpolate.
5 Likes
The binary search node was very neat!
Woh, did not know about BinarySearch. Neat! Goes to show that even after many years using vvvv you can still find new nodes.