Create Delay with C#

vvvhatsup people,

for learning purposes and to simplify a part of my project, i want to recreate the monoflop within a template (c#).

So how would you create the delay?

i tried this

if ( FFirst[i](i) > FTwo[i](i)) {
FOneDelay[i](i) = 1;
HERE SOME KIND OF DELAY
FOneDelay[i](i) = 0;
}

I tried many different methods of delay inside of c#, but never got the result i wanted.

Thx for help.

first you have to think about how data is processed in vvvv. every evaluate method of every node is called once in every frame. if you would put in a delay in that spot, it would block all other nodes in vvvv until the end of the delay time.

so you have to work with time values here.

import the Host and call its FrameTime property to get the current time and check whether a certain amount of time has passed:

if ( FFirst[i](i) > FTwo[i](i)) 
{
//sample current time
FStartTime = FHost.FrameTime;
}

//assuming FOneDelay is a bool output
FOneDelay[i](i) = (FHost.FrameTime - FStartTime) < FDelayTime[i](i);

Could you Clarify it a little more, i’m a hard rookie with c# and it would help me much to see more of it written down. Google won’t spit out enough to create anything working.

thank you very much.

you could check the evaluate method of the TimerFlop (Animation) node: https://github.com/vvvv/vvvv-sdk/blob/develop/vvvv45/addonpack/src/nodes/plugins/Animation/TimerFlop/TimerFlopNode.cs#L221

woah i should’ve checked the addonpack in the sdk before writing here :D

Thanks tonfilm! It helps understanding the concept.

lets see if i can make something out of it.