Tagged: "Execute external macro action"
- This topic has 5 replies, 2 voices, and was last updated 4 months, 1 week ago by
Pacocreative.
-
AuthorPosts
-
11 February 2025 at 10 h 36 min #7155
Pacocreative
ParticipantHey Philippe,
I inquired about the equivalent of defining functions in macros to tighten the code, avoid redundancies and facilitate maintenance.
Haven’t got a reply or workaround, but this feature would make a huge difference to me.Perhaps you could add a “ExecuteCaseBranch” command, accepting a single or multiple parameters?
That would allow to use casebranches as functions, at least within a single macro.
If this can be made to talk across 2 different matrix macros – even better.My macros are currently ~2500 lines each and I have several of them.
Often times, I need to repeat code unnecessarily – like stopping metronome and similar things…
I also recently programmed LaunchpadX and Launch Control XL controls for 8 modular loopers on FX tracks, each of tracks being essentially the same page of code, except for the track number. My programmer heart cries doing so 🙂If you can suggest any other workarounds – please do.
Thank you!
11 February 2025 at 13 h 15 min #7167Philippe
KeymasterHi,
I think you can do it with the SetCurrentCaseValue functionnality.
Please look at the script below where I use SetCurrentCaseValue to redirect to a specific caseBranch.
Is that ok in your situation ?
PhilippeCaseBranch "My song one" Post "My song one..." EndCaseBranches CaseBranch "My song four" Post "My song four..." SetCurrentCaseValue "My song one" WaitDuration 10 MacroRestart EndCaseBranches
11 February 2025 at 20 h 36 min #7174Pacocreative
ParticipantI was going through the docs, but I wasn’t able to figure out this could do the job. Now this makes sense and could work.
How can I pass the last value coming from a midi trigger (like a CC value)?
I’m using it in the context of Matrix, and all cases are triggered with midi.
Many make use of the value provided from midi.
I mean I could use another variable to store that, but maybe I don’t have to?Thanks
11 February 2025 at 21 h 10 min #7177Pacocreative
ParticipantOne thing I’m seeing already is that I can use it only once from a case branch.
So, unless you suggest another workaround I can’t achieve something like this:CaseBranch "Do this" ExecuteCase "DoThat1" ExecuteCase "DoThat2" ExecuteCase "DoThat3" EndCaseBranch
11 February 2025 at 23 h 04 min #7179Philippe
KeymasterOK, there is another way to do this and this is the way I do it ! -)
Inside the matrix, you put this :
// You need to declare the variable in every macro you use it Declare Once int $externalActionCount$ = 10 // Here is the macro initialization // Here is a case branch CaseBranch "My song two" Post "Begin of the second song" // inside the casebranch, you can set a global variable that will be used in another macro $externalActionCount$ = 5 // Here you start the second macro which is loaded in a standart macro slot MacroStartIfNeededByName "External Action" // With WaitSignalNotification, the matrix macro will wait the signal from the other macro saying the action is finished // WaitSignalNotification is optional WaitSignalNotification ExternalActionIsFinished Post "Back to Case Branch 2" EndCaseBranches
In the external macro called “External Action”, you put this code :
// You need to declare the variable in every macro you use it Declare Once int $externalActionCount$ = 10 Declare int $currentCount$ = 0 // This macro execute an external action and send a signal when it is finnished. Post "This macro is doing an external action" DoRepeat $currentCount$ = {$currentCount$ + 1} Post {"count " + $currentCount$} Sleep 30 While {$currentCount$ < $externalActionCount$} // When the doRepeat loop is finished, the macro send the notification with NotifySignal // NotifySignal is optionnal NotifySignal ExternalActionIsFinished
12 February 2025 at 9 h 11 min #7183Pacocreative
ParticipantThat makes sense.
Or similarly, I could restrict myself to using a single CaseBranch extension, but put a lot of features there and use flags to execute them selectively.
Thanks! -
AuthorPosts
- You must be logged in to reply to this topic.