Multiple Tab Toggle with 1 Button

Discuss problems and solutions.
Post Reply
Emerson
Newbie
Posts: 15
Joined: 08 Jul 2014 16:00

Multiple Tab Toggle with 1 Button

Post by Emerson »

Hello everyone. This is my first post. I am brand new to Lemur and am hoping some of you brilliant minded people can help me with a problem. Your help is most appreciated!

I am basically trying to emulate some functions of my M-Audio keyboard midi controller within a Lemur environment. I will be using it to control my DAW. This is all within the MIDI realm...I'm not using OSC for any of this. The problem is with the peculiar way my keyboard sends commands (and my DAW receives them) for the Solo, Mute, Rec Arm, and Track Select functions.

All of those functions (solo, mute, rec, sel) use the same button, and those different functions are cycled through by simply tapping a separate "toggle" button which cycles/scrolls through and changes them accordingly. To achieve the same effect in Lemur, my approach is to create a custom button that is linked to different tabs in a container. Each tab will have separate buttons labeled as S, M, Rec, and Sel...so I can visually see where I am along the function "cycle". With me so far?

I have been digging through this forum and the User Library for the last few days and have seen many examples of how to toggle between 2 different Container tabs and how to toggle to specific tabs, ect. However, I need to have a SINGLE button move to the NEXT Container Tab each time it is pressed (in a container that has 4 Tabs). Make sense?

In other words, If i have 4 tabs in a container object...and I'm starting out on Tab1...I can hit my toggle button and move to Tab2...Hit it again and move to Tab3...Hit it again and move to Tab4...Hit it again and move back to Tab1. Is this possible?

I am VERY new to the scripting aspects of Lemur and have been trying to follow the various tutorials and snippets of ideas I have come across...I can easily toggle between 2 tabs with a button or address specific Tabs via multiple buttons...but don't know the correct approach to have ONE button always toggle to the NEXT tab instead of back to the first one. The way my DAW interprets the commands for the functions and the way I would LIKE to lay out my template, using multiple buttons or a slider is not really an option. I have attached an example of what I am TRYING to do but at this point only toggles between two tabs instead of cycling through them. Thanks in advance!
Attachments
Toggle Cycle Button WIP.jzml
(5.62 KiB) Downloaded 55 times
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: Multiple Tab Toggle with 1 Button

Post by Softcore »

If your actual controller is ONE button, cycling the functions through with the help of ANOTHER togle button.....I think you are heading for headaches with the approach of seperate buttons emulating THAT one button (hidden in tabs).

Also shouldnt the "toggle" button behave like a pad (momentary button) and not like a switch?

Here's what you asked anyway......Post here again when you reach to the headaches I predict!

;)
Attachments
Toggle Cycle Button WIPPED.jzml
(5.95 KiB) Downloaded 78 times
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: Multiple Tab Toggle with 1 Button

Post by Softcore »

And I will be out for the night, so this might come in handy if you do reach.......headaches
Attachments
Toggle Cycle Button SINGLEBUTTON.jzml
(2.81 KiB) Downloaded 100 times
Emerson
Newbie
Posts: 15
Joined: 08 Jul 2014 16:00

Re: Multiple Tab Toggle with 1 Button

Post by Emerson »

Wow, thanks Softcore! This is exactly what I was after!

Your right...the second one you posted probably makes more sense for what I'm trying to accomplish. I will admit that while I don't fully understand how the script works yet, it is gradually making more sense the more I work with Lemur. I've already learned a lot from many of your posts!

Thanks again!
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: Multiple Tab Toggle with 1 Button

Post by Softcore »

No worries....for the second one.....keep this in mind

This script:

Code: Select all

t ++;
if (t==4) t=0;
decl i, lbl={'label_on','label_off'};
for (i=0;i<2;i++){
if (t==0)
 {
setattribute(CustomButton, lbl[i], 'S');
}
else if (t==1) {
setattribute(CustomButton, lbl[i], 'M');
}
else if (t==2) {
setattribute(CustomButton, lbl[i], 'Rec');
}
else  {
setattribute(CustomButton, lbl[i], 'Sel');
}
}
is EQUAL to this, which you might find more understandable

Code: Select all

t ++;
if (t==4) t=0;
if (t==0)
 {
setattribute(CustomButton, 'label_on', 'S');
setattribute(CustomButton, 'label_off', 'S');
}
else if (t==1) {
setattribute(CustomButton, 'label_on', 'M');
setattribute(CustomButton, 'label_off', 'M');
}
else if (t==2) {
setattribute(CustomButton, 'label_on', 'Rec');
setattribute(CustomButton, 'label_off', 'Rec');
}
else  {
setattribute(CustomButton, 'label_on', 'Sel');
setattribute(CustomButton, 'label_off', 'Sel');
}
}
lastly, once you finally settle on which solution to use, you might even consider changing not only the "text" of the buttons (label_on, label_off) but also its color so that it will be more aparrent which function you are currently controlling (for example yellow=mute, green=solo, red=rec, blue=sel)
Emerson
Newbie
Posts: 15
Joined: 08 Jul 2014 16:00

Re: Multiple Tab Toggle with 1 Button

Post by Emerson »

Thanks! That definitely makes the script easier for me to understand. Great idea about the buttons changing colors to reflect their current "mode". That was my plan all along...but now I feel more confident I can make it happen! So far everything is working great. I appreciate your help Softcore!
Post Reply