tLb.BindTo abstractions


These abstractions are part of the core functionality of tLb, because they are used to establish the communication between the effect model and its view and controller.
You will use them in two flavors:
  • tLb.BindToPattr, and
  • tLb.BindPattr
The difference between them is, that the first version can be used only in the slot and edit views of an effect as long as the model core itself contains the abstraction tLb.InitFXEnvironment. Then tLb.BindToPattr can be used just with the obligatory ID as first argument and the name of the pattr it should bind to.
Stacks Image 587
+
Stacks Image 588
Stacks Image 589
allows
In all other cases use tLb.BindTo and give the ID, which can be the number of a slot or the global ID gl, and the path to the destination pattr, e.g. CueSequencer::currentStep. Note that the leading "::" is not set at the beginning of the path argument, this is done inside tLb.BindTo.

Why tLb.BindTo and tLb.BindToPattr ?


There is a problem caused by the dynamic nature of LSD and LVD. Effect plugins are loading at runtime, and they consist of at least three modules: the effect itself, its slot view and its edit view. Especially if you load a new session folder it could happen, that the slot view is already loaded but the core not. In this case, a normal bindto argument to pattr would fail, because the destination does not yet exist. This problem is solved with the two abstractions. They use the object pattrexist (not yet part of the standard distribution, download it here) to determine if the partner is already in memory or not. If not, they will try again after 100 ms, and after 160 tries in this implementation, they give up and send a message to the Max window.
Stacks Image 590
Inside the patch a little bug is mentioned: from time to time, during binding to a remote pattr, it happens that the local pattr sends some sort of empty string, which can cause trouble. You can catch it by appending it to a string, like shown in the patch. If the test is passed, the data from pattr is let thru. For the insiders, I suspect something like an empty atom causes this.
Since the tLb.BindTo mechanism is used so very often in LSD and LVD it is planned to put the whole functionality into a custom Max external, to increase efficiency.