Home Forums Logelloop 6 (English spoken) Matrix Macros Reply To: Matrix Macros

#6732
Philippe OllivierPhilippe
Keymaster

Hi,
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.
Philippe

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 "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