APC MKII Shift button for encoder

Discussion in 'PangoScript, Universe and Midi Templates' started by neutrino, Dec 29, 2015.

  1. neutrino

    neutrino Well-Known Member

    Is it possible to use the shift key with the encoders?
    I want to use the DMX encoder to control both my haze output and also the fan output but independently.
    Is this possible?

    Cheers
    Rich
     
  2. neutrino

    neutrino Well-Known Member

    So it looks like I need to find a way of using Layer 2 in Pangoscript.
    Any one have any tips or pointers?

    Cheers
    Rich
     
  3. ENOT

    ENOT Software Developer Staff Member

    Scripters associated to MIDI mapping may read the layer number by means of function:

    getmididevicelayer

    For DMX case, I do not see a reason to build a system around MIDI Layers. It is possible, but there are other ways. As example, by means of global variables. Script initiated by MIDI may set value of global variable. Declaration like this:

    globalvar MyVar

    Such variables are visible in all scripts of BEYOND. What allow to use it is contruction like:

    if (MyVar=1) ...
    if (MyVar=2) ...

    Best Regards,
    Alexey
     
  4. neutrino

    neutrino Well-Known Member

    Not sure I fully understand how to put the script together.

    Just to clarify: I have an APC40 MKII that has a 'shift' key. What I want to do is assign one of the encoders 2 'tasks'. 1 when the 'shift' key isn't used and the 2nd when the 'shift' key is held down.

    I can see how it works in the other MIDI settings windows using the 'surface layers' but not sure how to apply this in the Pangoscript window.

    getmididevicelayer does not seem to exist in the command list.

    I guess what I need to try and code is something like this:

    if mididevicelayer=1 then DMXout 511, extvalue (0,255);
    if mididevicelayer=2 then DMXout 512, ext value (0,255);

    How can I also use the MIDI feedback to make the sure the LEDs around the encoder light up accordingly?

    Thanks again

    Cheers
    Rich



     
  5. ENOT

    ENOT Software Developer Staff Member

    Idea of "layers" is good for MIDI tables like MIDI<>Grid and so on. The layer actually is filter out some items, it block activity of mapping if current layer index is different. For PangoScrtipt and MIDI it is not required, because script has IF. You understood this part, great. OK, go forward. GetMidiDeviceLayer is a function. Sorry, it is not documented. There are multiple functions, such as sin() or cos(), or pi. There are several specific functions, like this "GetMidiDeviceLayer". It return index of layer of MIDI mapping. But, BEYOND has 4 mappings, and it is important detail. Each scripter has internal variable for current mapping. This variable used for MidiOut command and a few other including GetMidiDeviceLayer. If the scripter belong to MIDI mapping the BEYOND assign MIDI mapping index to scripter automatically. Sorry, it might be confusing, I just explain how it really is.

    Function GetMidiDeviceLayer might be undefined in 699. If you use 2.1 then it must work.

    Regarding feedback. The simplest solution is to use MidiOut command. It is not really a true feedback that represent current state of ... wait. Do you use encoder that send 00 or 7F only?

    Normally, feedback done by means of monitoring parameter state and sending the MIDI message when state changed. In your case it seems more complex. Do you want to show DMX channels value in encoder depending on Shift button state?

    Regards,
    Alexey
     

Share This Page