Trevliga Spel forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Script working but unstable when replicated in several buttons

2 posters

Go down

Script working but unstable when replicated in several buttons Empty Script working but unstable when replicated in several buttons

Post by thx538 Wed Nov 22, 2023 1:28 pm

I have difficulties with the following script :
Code:
[(config){TriggerOnLocalMidiEvents:Yes}{TriggerOnUnchangedVariables:No}]
[(init)(@l_upd:0){cc:14,1,0}]
[(cc:14,0,0-127){cc:14,1,#@e_ccvalue#}] Global = dispatch to local who will do the rest
[(cc:14,1,0-127){@l_bp:#@e_ccvalue#}] 1 Local = Parameter only
[(@l_bp:0){image:%trevligaspel%/Icons/ParamB1.png}]
[(@l_bp:127){image:%trevligaspel%/Icons/ParamB2.png}]
[(press){@l_p:#127 - @l_bp#}{cc:14,0,#@l_p#}]
[(cc:15,0,0-127){@l_pc1:#@e_ccvalue#}]
[(cc:15,1,0-127){@l_pc2:#@e_ccvalue#}]
[(cc:15,2,0-127){@l_pc3:#@e_ccvalue#}]
[(cc:15,3,0-127){@l_pc4:#@e_ccvalue#}]
[(cc:15,4,0-127){@l_pc5:#@e_ccvalue#}]
[(cc:15,5,0-127){@l_pc6:#@e_ccvalue#}]
[(cc:15,6,0-127){@l_pc7:#@e_ccvalue#}]
[(cc:15,7,0-127){@l_pc8:#@e_ccvalue#}]
[(init)(cc:15,0,0-127){@l_pc1:#@e_ccvalue#}]
[(init)(cc:15,1,0-127){@l_pc2:#@e_ccvalue#}]
[(init)(cc:15,2,0-127){@l_pc3:#@e_ccvalue#}]
[(init)(cc:15,3,0-127){@l_pc4:#@e_ccvalue#}]
[(init)(cc:15,4,0-127){@l_pc5:#@e_ccvalue#}]
[(init)(cc:15,5,0-127){@l_pc6:#@e_ccvalue#}]
[(init)(cc:15,6,0-127){@l_pc7:#@e_ccvalue#}]
[(init)(cc:15,7,0-127){@l_pc8:#@e_ccvalue#}]
[(cc:15,64,0-127){@l_pc1p:#@e_ccvalue#}]
[(cc:15,65,0-127){@l_pc2p:#@e_ccvalue#}]
[(cc:15,66,0-127){@l_pc3p:#@e_ccvalue#}]
[(cc:15,67,0-127){@l_pc4p:#@e_ccvalue#}]
[(cc:15,68,0-127){@l_pc5p:#@e_ccvalue#}]
[(cc:15,69,0-127){@l_pc6p:#@e_ccvalue#}]
[(cc:15,70,0-127){@l_pc7p:#@e_ccvalue#}]
[(cc:15,71,0-127){@l_pc8p:#@e_ccvalue#}{@l_pc8p:#@e_ccvalue#}{wait:100}{@l_upd:1}]
[(init)(cc:15,64,0-127){@l_pc1p:#@e_ccvalue#}]
[(init)(cc:15,65,0-127){@l_pc2p:#@e_ccvalue#}]
[(init)(cc:15,66,0-127){@l_pc3p:#@e_ccvalue#}]
[(init)(cc:15,67,0-127){@l_pc4p:#@e_ccvalue#}]
[(init)(cc:15,68,0-127){@l_pc5p:#@e_ccvalue#}]
[(init)(cc:15,69,0-127){@l_pc6p:#@e_ccvalue#}]
[(init)(cc:15,70,0-127){@l_pc7p:#@e_ccvalue#}]
[(init)(cc:15,71,0-127){@l_pc8p:#@e_ccvalue#}{@l_pc8p:#@e_ccvalue#}{wait:100}{@l_upd:1}]
[(@l_upd:1){@l_upd:0}{text:#CONCAT(CHAR(@l_pc1 ),CHAR(@l_pc2 ),CHAR(@l_pc3 ),CHAR(@l_pc4 ),CHAR(@l_pc5 ),CHAR(@l_pc6 ),CHAR(@l_pc7 ),CHAR(@l_pc8 ),CHAR(10) ,CHAR(@l_pc1p ),CHAR(@l_pc2p ),CHAR(@l_pc3p ),CHAR(@l_pc4p ),CHAR(@l_pc5p ),CHAR(@l_pc6p ),CHAR(@l_pc7p ),CHAR(@l_pc8p ))#}]

Basically it aims at receiving from The DAW two sets of eight ASCII encoded characters (0-7) and (64-71) from ch.15 and displaying them on two lines in the button.

On top of that it will switch images when pressed and send a cc on ch. 14, which can also trigger and image switch when received from another control.
The state of the button is in the variable @l_bp.

This script has been working but proves to be unstable when replicated in several buttons.
On some instances, values are not refreshed properly, while the image switch is working.

I have 16 different names to manage and thus would like to have 8 instances running in parallel, operating on different ranges  (0-7,8-15,16,23 etc. ...) of channel 15.

May be ... or probably I'm doing something wrong.
The code could be optimized or refactored.
Thank you for your support.

thx538

Posts : 128
Join date : 2023-10-23

Back to top Go down

Script working but unstable when replicated in several buttons Empty Re: Script working but unstable when replicated in several buttons

Post by Admin Wed Nov 22, 2023 3:51 pm

Interesting script.  Very Happy

What is the reason for the command for l_pc8p?
  • The variable is set twice, which I can't see any reason for.
  • What is the wait meant to do?

I can imagine that the thing that causes trouble is the wait. When the Midi driver receives a Midi command, a thread starts to handle the received command, and the script is executed in that thread. I don't know if that wait (where the thread is inactive) is blocking the Midi driver from handling additional incoming MIDI messages and if that is the cause of why things go wrong.

I suggest you remove the wait action and the duplicate l_pc8p action to see if that solves the problem.
Admin
Admin
Admin

Posts : 1235
Join date : 2020-03-26

https://trevligaspel.forumotion.eu

Back to top Go down

Script working but unstable when replicated in several buttons Empty Re: Script working but unstable when replicated in several buttons

Post by thx538 Wed Nov 22, 2023 6:15 pm

Thank you for your comments.
I introduced the wait to see if it was more stable, so yes I've removed it, as well as the duplicate action.

l_pc8p is fed with the last character received for the button.
The purpose of the  l_pc8p special command is to make sure we get the last character form the series of 16, and then trigger the text update (Variable l_upd, which initialized to 0 if understood well).

Maybe it's not the best way to proceed. I'm afraid 8 of these buttons is too much traffic. Any thoughts?

I have this last version more or less working.
Code:
[(config){TriggerOnLocalMidiEvents:Yes}{TriggerOnUnchangedVariables:No}]
[(cc:14,0,0-127){cc:14,1,#@e_ccvalue#}] Global = dispatch to local who will do the rest
[(cc:14,1,0-127){@l_bp:#@e_ccvalue#}] 1 Local = Parameter only
[(init)(cc:14,1,0-127){@l_bp:#@e_ccvalue#}] 1 Local = Parameter only
[(@l_bp:0){image:%trevligaspel%/Icons/ParamB1.png}]
[(@l_bp:127){image:%trevligaspel%/Icons/ParamB2.png}]
[(press){@l_p:#127 - @l_bp#}{cc:14,0,#@l_p#}]
[(cc:15,0,0-127){@l_pc1:#@e_ccvalue#}]
[(cc:15,1,0-127){@l_pc2:#@e_ccvalue#}]
[(cc:15,2,0-127){@l_pc3:#@e_ccvalue#}]
[(cc:15,3,0-127){@l_pc4:#@e_ccvalue#}]
[(cc:15,4,0-127){@l_pc5:#@e_ccvalue#}]
[(cc:15,5,0-127){@l_pc6:#@e_ccvalue#}]
[(cc:15,6,0-127){@l_pc7:#@e_ccvalue#}]
[(cc:15,7,0-127){@l_pc8:#@e_ccvalue#}]
[(init)(cc:15,0,0-127){@l_pc1:#@e_ccvalue#}]
[(init)(cc:15,1,0-127){@l_pc2:#@e_ccvalue#}]
[(init)(cc:15,2,0-127){@l_pc3:#@e_ccvalue#}]
[(init)(cc:15,3,0-127){@l_pc4:#@e_ccvalue#}]
[(init)(cc:15,4,0-127){@l_pc5:#@e_ccvalue#}]
[(init)(cc:15,5,0-127){@l_pc6:#@e_ccvalue#}]
[(init)(cc:15,6,0-127){@l_pc7:#@e_ccvalue#}]
[(init)(cc:15,7,0-127){@l_pc8:#@e_ccvalue#}]
[(cc:15,64,0-127){@l_pc1p:#@e_ccvalue#}]
[(cc:15,65,0-127){@l_pc2p:#@e_ccvalue#}]
[(cc:15,66,0-127){@l_pc3p:#@e_ccvalue#}]
[(cc:15,67,0-127){@l_pc4p:#@e_ccvalue#}]
[(cc:15,68,0-127){@l_pc5p:#@e_ccvalue#}]
[(cc:15,69,0-127){@l_pc6p:#@e_ccvalue#}]
[(cc:15,70,0-127){@l_pc7p:#@e_ccvalue#}]
[(cc:15,71,0-127){@l_pc8p:#@e_ccvalue#}{@l_upd:1}]
[(init)(cc:15,64,0-127){@l_pc1p:#@e_ccvalue#}]
[(init)(cc:15,65,0-127){@l_pc2p:#@e_ccvalue#}]
[(init)(cc:15,66,0-127){@l_pc3p:#@e_ccvalue#}]
[(init)(cc:15,67,0-127){@l_pc4p:#@e_ccvalue#}]
[(init)(cc:15,68,0-127){@l_pc5p:#@e_ccvalue#}]
[(init)(cc:15,69,0-127){@l_pc6p:#@e_ccvalue#}]
[(init)(cc:15,70,0-127){@l_pc7p:#@e_ccvalue#}]
[(init)(cc:15,71,0-127){@l_pc8p:#@e_ccvalue#}{@l_upd:1}]
[(@l_upd:1){@l_upd:0}{text:#CONCAT(CHAR(@l_pc1 ),CHAR(@l_pc2 ),CHAR(@l_pc3 ),CHAR(@l_pc4 ),CHAR(@l_pc5 ),CHAR(@l_pc6 ),CHAR(@l_pc7 ),CHAR(@l_pc8 ),CHAR(10) ,CHAR(@l_pc1p ),CHAR(@l_pc2p ),CHAR(@l_pc3p ),CHAR(@l_pc4p ),CHAR(@l_pc5p ),CHAR(@l_pc6p ),CHAR(@l_pc7p ),CHAR(@l_pc8p ))#}]

thx538

Posts : 128
Join date : 2023-10-23

Back to top Go down

Script working but unstable when replicated in several buttons Empty Re: Script working but unstable when replicated in several buttons

Post by Admin Wed Nov 22, 2023 7:19 pm

When using the Mackie Control protocol, the daw continuously sends 300-500 midi messages per second, and the plugin can handle that without any problems, so I cannot believe that the traffic for these 8 buttons would be a problem.

Please enable extended logging, replicate the problem, and then stop (to avoid getting a log file that is too large). Send the log file (all of it) to me, along with a description of what went wrong (which button, what info is missing).
Admin
Admin
Admin

Posts : 1235
Join date : 2020-03-26

https://trevligaspel.forumotion.eu

Back to top Go down

Script working but unstable when replicated in several buttons Empty Re: Script working but unstable when replicated in several buttons

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum