Home › Forums › Logelloop 6 (English spoken) › Matrix Macro Template
Tagged: "Matrix template"
- This topic has 5 replies, 2 voices, and was last updated 3 weeks ago by Pacocreative.
-
AuthorPosts
-
28 December 2024 at 21 h 09 min #6741PacocreativeParticipant
Hey,
I played a bit with layouts for Matrix, and below I share a template that includes arbitrary number of rows and columns, as well as custom sizing with auto layout. I also left some comments for usage/extending
// ----------------------------------------------------- Customization ----------------------------------------------------- // Layout - alter rows & columns as desired // Dials will be distributed on top Declare Local int $rows$ = 6 // how many rows you want Declare Local int $cols$ = 8 // how many columns we want Declare Local int $dials$ = 32 // how many dials Declare Local int $itemSize$ = 72 // what size we want // ----------------------------------------------------- Internal vars ----------------------------------------------------- // Internal Declare Local Once boolean $firstTime$ = true Declare Local int $itemID$ = 1 Declare Local int $r$ = 1 Declare Local int $c$ = 1 // ----------------------------------------------------- Layout & Initialization ----------------------------------------------------- If { $firstTime$ } $firstTime$ = false SendData itemamount {$cols$ * $rows$} WaitDuration 300 // Set initial rows of dials // Set the output type (0 = int, 1 = float) // SendData dial 0 type 0 // Set all dials to -76 // SendData dial 0 -76 // Toggle mode on // SendData item 0 mode 1 // Toggle mode off // SendData button 0 mode 0 DoRepeat SendData itemtype $itemID$ dial $itemID$ = {$itemID$ + 1} WaitDuration 10 While {$itemID$ <= $dials$} // Layout SendData mainWindow setsize {($itemSize$ * $cols$) + 4} {($itemSize$ * $rows$)+ 4 + 30} $itemID$ = 0 DoRepeat $c$ = {($itemID$ - 1) % $cols$} $r$ = {(($itemID$ - 1) / $cols$) % $rows$} SendData item $itemID$ name $itemID$ SendData itemsize {$itemID$ } {($itemSize$ * $c$)+2} {($itemSize$ * $r$)+2} $itemSize$ $itemSize$ $itemID$ = {$itemID$ + 1} While {$itemID$ <= ($rows$ * $cols$)} SendData item button 0 fontface regular SendData item button 0 fontsize 12 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.; SendData item dial 0 bordercolor 0.2 0.2 0.2 1.; SendData item dial 0 min 0 SendData item dial 0 max 127 SendData item dial 0 midimode 0 //SendData item dial defaultSettings //SendData item button defaultSettings // SendData basicdisposition // default size and positioning // Namings - alter these as you need, make sure to appropriately name the case branches later SendData item 1 name "Dial 1" SendData item 2 name "Dial 2" SendData item 3 name "Dial 3" SendData item 4 name "Dial 4" SendData item 33 name "But 1" SendData item 34 name "But 2" SendData item 35 name "But 3" // Midi mappings // It is possible to set the midi mappings by list // arguments are itemID midiInputType midiNote midiChannel // SendData midiMappingByList 3 cc 16 11 6 cc 2 11 8 cc 3 11 // SendData midiMappingByList 11 cc 16 11 12 cc 2 11 13 cc 3 11 // SendData midiMapping clearAll SendData midiMappingByList 33 cc 105 16 SendData midiMappingByList 34 cc 106 16 SendData midiMappingByList 35 cc 107 16 SendData MacroInitialized MacroStop EndIf // ----------------------------------------------------- Case usage guide ----------------------------------------------------- // Which Case is it ? // CaseBranch 1 // CaseBranch 1_up // CaseBranch 1_toggleOff // CaseBranch 1_toggleOn // Using custom names // CaseBranch "My Dial 1" // CaseBranch "My Button" // CaseBranch "My Button_up" // CaseBranch "My Button_toggleOff" // CaseBranch "My Button_toggleOn" // ----------------------------------------------------- Case Branches ----------------------------------------------------- Message { "Button or Dial number " + currentCaseValueString() + " : " + currentCaseOptionValueFloat(0)} // Custom named dial CaseBranch "Dial 1" MessageMain { "Dial " + (currentCaseValueString()) + " value is : " + currentCaseOptionValueFloat(0)} // Your code here BreakCaseBranch CaseBranch "Dial 2" MessageMain { "Dial " + (currentCaseValueString()) + " value is : " + currentCaseOptionValueFloat(0)} // Your code here BreakCaseBranch CaseBranch "Dial 3" MessageMain { "Dial " + (currentCaseValueString()) + " value is : " + currentCaseOptionValueFloat(0)} // Your code here BreakCaseBranch CaseBranch "Dial 4" MessageMain { "Dial " + (currentCaseValueString()) + " value is : " + currentCaseOptionValueFloat(0)} // Your code here BreakCaseBranch // Default unnamed dial CaseBranch 5 MessageMain { "Dial " + (currentCaseValueString()) + " value is : " + currentCaseOptionValueFloat(0)} // Your code here BreakCaseBranch // Custom named button press CaseBranch "But 1" Message "Button 1 down" BreakCaseBranch // Custom named button release CaseBranch "But 1_up" Message "Button 1 up" BreakCaseBranch // Regular buttons CaseBranch 36 Message "The button number " + (currentCaseValueString()) + " is down" // Your code here BreakCaseBranch CaseBranch 36_up Message "The button number " + (currentCaseValueString()) + " is up" // Your code here BreakCaseBranch EndCaseBranches WaitDuration 20 // Put here some code that will be interpreted after each CaseBranch
31 December 2024 at 18 h 47 min #6745PhilippeKeymasterHi Patrick,
Thank you so much for this great contribution !
While trying it, I see that the midi learn buttons aren’t well set, and it seems that removing the “WaitDuration” line after the “itemamount” fixe the issue.
I am not sure the that the WaitDuration is still needed in my templates either…
I will look at it.
Best !
Philippe31 December 2024 at 23 h 45 min #6776PacocreativeParticipantYou are right, and I arrived at the same issues while programming a 150-buttons Matrix (!).
Playing currently with a layout for Novation Launchpad X, and setting up most of my workflows there.If you choose to spend a New Year programming Logelloop, I guess you’re a freak… LOL
Happy New Year!1 January 2025 at 8 h 01 min #6795PhilippeKeymasterHi,
You are right, and I arrived at the same issues while programming a 150-buttons Matrix (!).
Playing currently with a layout for Novation Launchpad X, and setting up most of my workflows there.This is great to read !
Programming Matrix was a big work, so I am very happy to see that some users like it.If you choose to spend a New Year programming Logelloop, I guess you’re a freak… LOL
Happy New Year!haha, I took a short break to celebrate !
And now again at work…Happy new Year !
Best,
Philippe1 January 2025 at 21 h 23 min #6800PacocreativeParticipantSince you mentioned Matrix and I took a look, it’s currently my go-to tool to setup all macros and midi.
Frankly, I do prefer Matrix + Macros vs setting up midi assignments in preferences.
The reason for that is a bit more flexibility and control, but also having everything in one place.
I’m also a visual guy, and seeing my workflow in front of me is a huge benefit.I do get the logics behind how the preferences and midi assignments are designed, but it did not steal my heart.
Maybe I’m just spoiled with ‘click>learn>assign’ approach that has become a standard in established softwares.Thanks for making it available.
3 January 2025 at 17 h 54 min #6849PacocreativeParticipantCurrently Matrix “case” and “case_longpress” can be programmed separately and are useful if you want to execute one action on short press down AND another one afterwards on longpress. However, this does not handle the case where you want to execute EITHER short press or longpress, but not both.
Here’s a small routine I use for programming single press vs longpress functionalities on Matrix macros so that when you longpress, the short press code is not executed. It’s usable for non time-critical actions of course, because the short press action is deferred to “case_up” event.
// in the head Declare Local Once int $m_press_flag$ = 0 // Flag for detecting short/long // in case branches CaseBranch "K" $m_press_flag$ = 1 BreakCaseBranch CaseBranch "K_longpress" $m_press_flag$ = 0 // put long press action here BreakCaseBranch CaseBranch "K_up" // exec deferred short press action If {$m_press_flag$ == 1} // put deferred short press action here $m_press_flag$ = 0 EndIf BreakCaseBranch
-
AuthorPosts
- You must be logged in to reply to this topic.