Delaying reactiv actions question

Bonjour !
I m using a foreach(Reactive) Region to treat on each midi impulse from my midi device specific automations. inside the for each region i m checking the ID of the midi and executing the desired automations affected by GUI.

A typical example is i have some objects to move, dampered for smooth moves when being manipulated.

To move them on place i need to do on one trigger :
1-set damper at 0 ( to enable an instantenly move)
2-set object to place
3-set damper at its initial state

So, my question is how to implement a delayed event ( here the 3rd one) inside my Foreach Reactiv Region ?
Is there any way in reactive to schehulde the setvalue or ensurevalue as a schehulded task ?

thank you for your help !


I wrote you a long reply, but lost it while writing.

In short.

  1. Delays are possible, but it would be good to understand the Observable architecture in general and its implementation in VVVV in particular. Refer to neural networks, they write code that can be repeated.
  2. If you need delays in your observable tree, then you most likely have problems in the architecture, and in order not to increase technical debt, I would advise you to consider refactoring.


observable_delay.vl (12.3 KB)

@yar , thank you very much for your reply ! Arf damned, i would have prefer to read your long long reply ;_)
i m completly ok to refactor.
especially as i hate using if and not switch in my patch conditions.

But If you can just give me a hint on what would be the best approach to my problem in terms of logics, that would be great.

im not really understanding the way to deal with your reply, and previously, despite some tries, i didnt find my way there with help files.

I think this is something very valuable for community, to have an help patch on that topic, especially for people like me coming from VVVV beta.

So to be simple, what would be the way to do in this case :

  1. Midi event incoming
  2. checking assignation
  3. doing specific delayed action (and not only for code convenience, it can be also for artistic needs)

How would you do it ?
:)

The observables have a concept of handlers, basically a small classes that abstractify observable logic, There is two main interfaces in observables is IObservable (Subscribable) and ISubject (Settable), the Channel is composition of both, so you can subscribe to it and emit changes on it.

So as a most basic concept is “Filtering”, e.g. run handler only on condition:


observable filtering.vl (24.3 KB)

The key here is separation of concerns, instead of switch, pipe event to certain handler.

The second valuable concept is data transformation:

This basically shows how to use Observable natively vs ForEach (Channel)
observable transformation.vl (18.0 KB)

And there you go an observable Banger:


observable banger.vl (35.0 KB)

There might be a better realization, but that’s just one way how you can program the trigger…

1 Like

thankyou @antokhio this is very clear, very pedagogic !
i will work on it ! thats great !!!

@karistouf You just need to understand how Observable works. This concept does not belong to VVVV; it is a design pattern implemented in C# / .NET. You can read about it on the internet or ask neural networks. It will be a thousand times more useful if I do NOT repeat knowledge that is available outside of VVVV.

As for VVVV, Antokhio has outlined some concepts. Others can be found in the documentation (which is good and extensive). If you are missing a specific topic, please describe what exactly.

Try to make a ‘demo stand’, try some approaches, stumble upon errors and send them here — then it will be easier to create a thread that will be useful and will contain a dialogue based on patches. My advice: always make demo stands, 20-30% of all questions at this stage resolve themselves, and if the question is unresolved or complex, it will be interesting to answer it with a patch in hand.

@yar
thank you ! thats very clear and thats a real good idea about demo stand. the right thing, i like it. I m coming back to you with this, and with observable undterstanding.

About resources:

2 Likes

Thank you @antokhio ! your sample is very clear and understandable for me. I will work on a demo to make me clear those concepts.

@yar I know those libraries are not VVVV original, agregation of external concepts is not easy for me.
I fondamentally appreciate the clear synthesis you have made for me, and the time passed on it. It may be frustrating somehow or time loose feeling for you, but fundamentally it helps really to go on the track. You meet someone who tells you thing and you understand suddendly the approach.

thank you !

@antokhio ok, i m trying to understand and see how i can translate your example in my structure.

To be completely honnest, i m quite lost and wondering also how i will then affect all variables in my app from banger. Anyway, this will be after…

Im actually blocked with a red node, i presume it is from channeling ?
Midi_Banger_Understanding.vl (102.6 KB)

Let’s first evaluate few additional concepts:

First one, how the trigger is produced, e.g. is it a one channel that receives some message, or is it multiple channels (e.g. midi bound to one of the public channels)

E.g. we clearly need to understand how we distinguish between keys, and how we intersect key and its animation.

Second one, we need to understand, how we receive triggers. The problem here is if you need to receive trigger in update it should be processed. Like, in example above I created a task array, but to receive bangs, this task array should be connected to holdlatest witch would work only in update.

The problem is i don’t really understand how your application structure is layed down, for instance if you have multiple different things to control e.g. multiple patches, you produce message globally and then you route it down to certain property and handle there inside update.

If you want some sort of global handling, you would need then to create some sort of dictionary that would allow you to distinguish between handlers… But then, should handlers update called manually? or they should produce observables witch can be subscribed to?

I will have some free time after 2 pm GMT +3, we can do some call maybe, reach me on element or vvvv discord…

1 Like

thank you Antokhio ! really clear ! i have to get my son from school at 2.45 PM GMT+3, so it may be a quick talking, with pleasure !

i tried to synthetise in a simple patch the process. But the all app is already a model, with many many different things in it, to wich i need to access.

maybe a quick look at the structure itself will help to define the good strategy. I have the impression it needs to write a time based queueing execution out of the For Each reactive reading of the midi, using for each only to place a banger in an execution motor in the mailoop with a kind of millis work to do executions time based