Home › Forums › Logelloop 6 (English spoken) › Matrix Macros
- This topic has 6 replies, 2 voices, and was last updated 3 weeks, 6 days ago by Pacocreative.
-
AuthorPosts
-
15 December 2024 at 22 h 19 min #6687PacocreativeParticipant
Hey,
Getting into programming Matrix, and totally love the idea.
Thanks for recommending me these modules.However, I’m a bit lost reverse engineering how to do it.
Dug through examples, haven’t found much in the manual.I got stuck with something simple – I’d love to add labels to buttons.
From examples:
SendData item dial $itemID$ name $itemID$
I get it.
Trying to repeat the same, but assigning strings as names:
SendData item dial 1 name "Vol 1" SendData item dial 2 name "Vol 2" SendData item button 9 name "ResetSpeeds" SendData item button 32 name "StopAll"
What happens is weird:
All items get the name displayed.
Dials stop working properly, but no error thrown in console.
Buttons stop working properly and I get error in the console:
dict: no dictionary named StopAll, cannot get value
I tried addressing CaseBranch both by ID or name String.
CaseBranch 32 // Your code here
CaseBranch "StopAll" // Your code here
What is it that I’m missing?
Next, in the examples there’s code like:
If { $firstTime$ } $firstTime$ = false // Guess this tells how many items we want? SendData itemamount 32 // This loop iterates over the first 8 dials - all clear DoRepeat SendData itemtype $itemID$ dial SendData item dial $itemID$ name $itemID$ $itemID$ = {$itemID$ + 1} WaitDuration 10 While {$itemID$ < 8} // This seems to address item of id = 0 but for some reason, automagically this populates across all other buttons? SendData item button 0 fontface regular SendData item button 0 bgcolor 0. 0. 0. 1.; SendData item button 0 bgoncolor 0.773 0.145 0.196 1.; // ... // Mind explaining the following? SendData item dial defaultSettings SendData item button defaultSettings SendData basicdisposition SendData MacroInitialized
Thanks
26 December 2024 at 19 h 20 min #6725PacocreativeParticipantAny ideas on why the text labels fail for me?
26 December 2024 at 23 h 20 min #6728PhilippeKeymasterCan you please send me your whole macro code ?
27 December 2024 at 9 h 05 min #6729PacocreativeParticipantSure. I don’t think it’s a problem of my specific macros.
Here’s a template where I only added labels.
They show up, but the code breaks – i.e. when button is pressed or dial moved, the action stops working.
If labels are removed, they work fine (see dial 1&2 vs 3)The code is one of your templates:
Declare Local Once boolean $firstTime$ = true Declare Local int $itemID$ = 1 Declare Local int $itemSize$ = 56 Declare Local int $verticalPosition$ = 1 If { $firstTime$ } $firstTime$ = false //SendData midiMapping clearAll SendData itemamount 32 WaitDuration 300 DoRepeat SendData itemtype $itemID$ dial SendData item dial $itemID$ name $itemID$ $itemID$ = {$itemID$ + 1} WaitDuration 10 While {$itemID$ < 9} SendData mainWindow setsize 463 {30 + ($itemSize$ * 4)} SendData item button 0 fontface regular //SendData button 0 fontsize 40 SendData item button 0 bgcolor 0. 0. 0. 1.; SendData item button 0 bgoncolor 0.773 0.145 0.196 1.; SendData item button 0 bordercolor 0.2 0.2 0.2 1.; SendData item button 0 borderoncolor 0.2 0.2 0.2 1.; SendData item button 0 textcolor 0.827 0.827 0.824 1. SendData item button 0 textoncolor 0.827 0.827 0.824 1.; // Labels, for some reason they don't work SendData item 1 name "Vol 1" SendData item 2 name "Vol 2" SendData item 30 name "Button 30" SendData item 31 name "Button 31" SendData item 32 name "Button 32" SendData item dial defaultSettings SendData basicdisposition SendData MacroInitialized MacroStop EndIf // Which Case is it ? Message { "Button or Dial number " + currentCaseValueString() + " : " + currentCaseOptionValueFloat(0)} CaseBranch 1 MessageMain { "Dial " + (currentCaseValueString()) + " value is : " + currentCaseOptionValueFloat(0)} TrackVolume trk1 = {scale(currentCaseOptionValueFloat(0), 0, 127, -76, 0)} BreakCaseBranch CaseBranch 2 MessageMain { "Dial " + (currentCaseValueString()) + " value is : " + currentCaseOptionValueFloat(0)} TrackVolume trk2 = {scale(currentCaseOptionValueFloat(0), 0, 127, -76, 0)} BreakCaseBranch CaseBranch 3 MessageMain { "Dial " + (currentCaseValueString()) + " value is : " + currentCaseOptionValueFloat(0)} TrackVolume trk3 = {scale(currentCaseOptionValueFloat(0), 0, 127, -76, 0)} BreakCaseBranch CaseBranch 4 MessageMain { "Dial " + (currentCaseValueString()) + " value is : " + currentCaseOptionValueFloat(0)} BreakCaseBranch CaseBranch 9_toggleOn // Your code here MessageMain { "Dial " + (currentCaseValueString()) + " value is : " + currentCaseOptionValueFloat(0)} Message "The button number 9 is On" BreakCaseBranch CaseBranch 9_toggleOff // Your code here Message "The button number " + (currentCaseValueString()) + " is Off" BreakCaseBranch CaseBranch 10_toggleOn // Your code here Message "The button number " + (currentCaseValueString()) + " is On" BreakCaseBranch CaseBranch 10_toggleOff // Your code here Message "The button number " + (currentCaseValueString()) + " is Off" BreakCaseBranch CaseBranch 11_toggleOn // Your code here Message "The button number " + (currentCaseValueString()) + " is On" BreakCaseBranch CaseBranch 11_toggleOff // Your code here Message "The button number " + (currentCaseValueString()) + " is Off" BreakCaseBranch CaseBranch 9 // Your code here Message "The button number 9 was pushed" BreakCaseBranch CaseBranch 9_up // Your code here Message "The button number 9 was released" BreakCaseBranch CaseBranch 10 // Your code here Message "The button number 10 was pushed" BreakCaseBranch CaseBranch 11 // Your code here Message "The button number 11 was pushed" BreakCaseBranch CaseBranch 12 // Your code here Message "The button number 12 was pushed" BreakCaseBranch CaseBranch 30 // Your code here Message "The button number 30 was pushed" BreakCaseBranch CaseBranch 31 // Your code here Message "The button number 31 was pushed" BreakCaseBranch CaseBranch 32 // Your code here Message "The button number 32 was pushed" BreakCaseBranch EndCaseBranches // Put here some code that will be interpreted after each CaseBranch
27 December 2024 at 10 h 09 min #6732PhilippeKeymasterHi,
I don’t want to say that the problem is in your macro, but I need to see how you connect things to make it work. And by giving me the whole macro from the beginning, you’re saving us time, because I don’t have to ask you a lot of questions… -)In this case, I see that you’ve changed the name displayed in the dial or button, but you haven’t changed the name of the corresponding CaseBranch. This may not be clear in the provided templates, in which case I’ll have to add some documentation in them, but the method is that the button or dial transmits its name to the macro, which first looks if this name corresponds to a CaseBranch, and them the action of that CaseBranch is made.
Intuitively, you probably thought we’d base it on the number of the button or dial, but at some point it seemed better to me to base it on the name. That way, when you edit your macro, you easily know which UI the CaseBranch corresponds to. I think it makes sense.
I don’t think the errors displayed in the console are that serious.
I will have to check, and fix the issue if it is needed or hide the errors if they’re not necessary.Below, the simplified macro with the corrections.
I hope I’ve answered correctly and I haven’t missed the issue you reported.
PhilippeDeclare Local Once boolean $firstTime$ = true Declare Local int $itemID$ = 1 Declare Local int $itemSize$ = 56 Declare Local int $verticalPosition$ = 1 If { $firstTime$ } $firstTime$ = false //SendData midiMapping clearAll SendData itemamount 32 WaitDuration 300 DoRepeat SendData itemtype $itemID$ dial SendData item dial $itemID$ name $itemID$ $itemID$ = {$itemID$ + 1} WaitDuration 10 While {$itemID$ < 9} SendData mainWindow setsize 463 {30 + ($itemSize$ * 4)} SendData item button 0 fontface regular //SendData button 0 fontsize 40 SendData item button 0 bgcolor 0. 0. 0. 1.; SendData item button 0 bgoncolor 0.773 0.145 0.196 1.; SendData item button 0 bordercolor 0.2 0.2 0.2 1.; SendData item button 0 borderoncolor 0.2 0.2 0.2 1.; SendData item button 0 textcolor 0.827 0.827 0.824 1. SendData item button 0 textoncolor 0.827 0.827 0.824 1.; //Labels, for some reason they don't work SendData item 1 name "Vol 1" SendData item 2 name "Vol 2" SendData item 30 name "Button 30" SendData item 31 name "Button 31" SendData item 32 name "Button 32" SendData item dial defaultSettings SendData basicdisposition SendData MacroInitialized MacroStop EndIf // Which Case is it ? Message { "Button or Dial number " + currentCaseValueString() + " : " + currentCaseOptionValueFloat(0)} CaseBranch "Vol 1" MessageMain { "Dial " + (currentCaseValueString()) + " value is : " + currentCaseOptionValueFloat(0)} TrackVolume trk1 = {scale(currentCaseOptionValueFloat(0), 0, 127, -76, 0)} BreakCaseBranch CaseBranch "Vol 2" MessageMain { "Dial " + (currentCaseValueString()) + " value is : " + currentCaseOptionValueFloat(0)} TrackVolume trk2 = {scale(currentCaseOptionValueFloat(0), 0, 127, -76, 0)} BreakCaseBranch CaseBranch 3 MessageMain { "Dial " + (currentCaseValueString()) + " value is : " + currentCaseOptionValueFloat(0)} TrackVolume trk3 = {scale(currentCaseOptionValueFloat(0), 0, 127, -76, 0)} BreakCaseBranch CaseBranch "Button 30" // Your code here MessageMain "The button number 30 was pushed" BreakCaseBranch CaseBranch "Button 31" // Your code here MessageMain "The button number 31 was pushed" BreakCaseBranch CaseBranch "Button 32" // Your code here MessageMain "The button number 32 was pushed" BreakCaseBranch EndCaseBranches
27 December 2024 at 13 h 39 min #6739PacocreativeParticipantWell, I think I’ve investigated changing case branches to identify the buttons by string label.
That’s exactly what I wrote in my initial post, and as I remember it did not solve the problem.Trying to repeat the same, but assigning strings as names:
SendData item dial 1 name “Vol 1”
SendData item dial 2 name “Vol 2”
SendData item button 9 name “ResetSpeeds”
SendData item button 32 name “StopAll”I tried addressing CaseBranch both by ID or name String.
CaseBranch 32
// Your code here
CaseBranch “StopAll”
// Your code hereDials stop working properly, but no error thrown in console.
Buttons stop working properly and I get error in the console:
dict: no dictionary named StopAll, cannot get valueUnless I made another mistake somewhere else.
28 December 2024 at 18 h 11 min #6740PacocreativeParticipantI can confirm this worked.Not sure why it didn’t the first time.
Thanks for your help, Philippe. 🥂 -
AuthorPosts
- You must be logged in to reply to this topic.