Using a "Modifier" / "Shift" in Pangoscript

I'd like to implement the shift button / modifier state so that I can use a single button for multiple uses. If you're familiar with MIDI programming for Native Instruments' Traktor, then you'll probably know what I mean, but to clarify, I'd like to have one button's function dependent on the state of another button.

For example, using the APC40:
-Press *Track Selection 1* and Zone 1 is selected
-Press and hold *Shift* button and press *Track Selection 1* and Quick FX 1-1 is enabled

In Traktor this could be done by programming *Shift* such that when it is depressed Modifier 1 = 1, but when it is not depressed Modifier 1 = 0. When *Track Selection 1* is pressed, it checks the state of Modifier 1 and either selects Zone 1 or enables/disables Quick FX 1-1.

This clearly doesn't need to be done using the modifier convention. It could be done with an "If-then-elseif-else" type logic check also. Is there any thing like this or that could help me achieve this using Pangoscript?

FYI - I did figure out a bit of a workaround for this, although it's not perfect.

Based on the Help tab in the PangoScript editor, it seems that variables are all local to a script and only a few things can be polled for their current state: DMX, Channel, CC, ExtValue, ExtDelta, OSCParam, and GetTransitionName. Of these, CC was the one that could help me the easiest, so I included the following code for a button in order to give it dual functionality:

if(cc(0,21,0,127)<=63) SetFX 1, 1
if(cc(0,21,0,127)>63) SetFX 1, 2

With the APC40, this makes it so that if the "Device Control 6" knob is in the lower-most half of its range, the "Activator 1" button turns on Layer 1, FX 1, but if the "Device Control 6" knob is in the upper-most half of its range, the "Activator 1" button turns on Layer 1, FX 2.

It's not particularly elegant and uses up the knob which is used by default for selecting the "Transition Index", but it does work.

Todd Keebs

ps - For what it's worth, I don't think that it's very optimal to use a knob to select from a list of values the way the "Transition Index" knob is used or the "Select FX Bank" knobs are used. I don't think most people would want to use this unless the knob had physical detents to give physical feedback when the desired state was dialed in, and even then the fact that you must pass through states 1-8 to get to state 9 makes for choppy transitions.

I feel bad starting so many threads, so I'm going to add this on to this thread even though it's not exactly the same content:

The Help documentation and example mappings clearly show how to map the full range (0-127) of a Control Change fader/knob to a smaller range within Beyond using the ExtValue function. However, is there any way to do the opposite: map a partial range of a fader/knob to an action within Beyond?

For example, I'd like to have it so when a fader crosses the mid-point a light on the APC40 is disabled, so I entered the following code in the fader's Control Change slot of the MIDI to PangoScript settings:
if(cc(0,0x0E,0,127)=64) MidiOut(0x90 0x32 0x00)

I had assumed that the script would be evaluated every time Beyond senses its value has been changed, however, this didn't seem to work, even if I parsed it down to just the MidiOut statement with no if statement attached.

I also tried to run the if statement as a background script, but that had no success either (I'm still not sure if background scripts can be run all the time, or only when called).

The Help documentation and example mappings clearly show how to map the full range (0-127) of a Control Change fader/knob to a smaller range within Beyond using the ExtValue function. However, is there any way to do the opposite: map a partial range of a fader/knob to an action within Beyond?

Click to expand...

I wanted to also note that the above request would also aid in the ability to create "super knobs" which is something used in some more advanced DJ controller mappings. This allows one knob to control multiple FX/controls and create some easy to use, dynamic actions. For example, turning a knob from 0 to 31 could bring up FX Action for Layer 1, then 32-63 for Layer 2, 64-95 for Layer 3, etc.

I also tried to run the if statement as a background script, but that had no success either (I'm still not sure if background scripts can be run all the time, or only when called).

Thanks,

Todd Keebs

Click to expand...

Hi Keebs,

Your on the right track.. Indeed where working on an better way to "shift" functionality.

But for your information. Background scripts are only active when a controller is connected and you need to call them to start.

Better use the PangoScript area at the right side of Beyond, where live control is located there is also an tab. There you can have scripts running without controller and have them running continuously.