ShowCockpit Academy
  • 🏠Welcome
  • Getting Started
    • Installation
    • Elements
    • Mapping
  • Tutorials
    • 🧩Integration
      • Ableton Link to MA2
      • LTC Input to MA2 OnPC
      • REAPER Markers to Onyx Cues
      • Ableton Link to Onyx FX Speed
      • MIDI Device with Bitfocus Companion
    • 🎬Timecode
      • LTC to MTC
      • MTC to LTC
      • Static Time Offset
      • LTC Input from Dante
    • 🔄Protocol Conversion
      • OSC to MIDI
      • MIDI to OSC
      • Keyboard to MIDI
      • Joystick to MIDI
    • 💡Lighting
      • grandMA3 OnPC Hotkeys
      • MIDI device(s) with an MA3 Desk
      • Connecting to MA3 OnPC on the same PC
      • MIDI device(s) with MA2
      • MA2 Bi-directional Page Sync
      • MIDI device(s) with Chamsys MagicQ
      • Obsidian Onyx - Multiple OSC Devices
      • Obsidian Onyx Pre-Dylos vs. Dylos
      • MIDI device(s) with Obsidian Onyx
    • 🎥Video
      • Resolume Arena Timecode Clip Trigger
      • Controlling OBS with a MIDI device
      • Controlling vMix with MIDI Devices
    • 🎛️Generic MIDI Mapping
      • Encoders Tips
    • 🤓LUA Scripts
      • Get MA2 Speed Master BPM value
    • 🌐Networking
      • Loopback Network Adapter
      • Multiple IP Addresses on a NIC
  • FAQs
    • License FAQs
    • Registration FAQs
    • Drivers FAQs
Powered by GitBook
On this page
  • Changing Pages from ShowCockpit
  • Changing Pages on MA2
  • Step 1 - Creating a Dummy Executor
  • Step 2 - Sync cues to the page number
  • Step 3 - Reading the current page in ShowCockpit
  • Conclusion

Was this helpful?

  1. Tutorials
  2. Lighting

MA2 Bi-directional Page Sync

PreviousMIDI device(s) with MA2NextMIDI device(s) with Chamsys MagicQ

Last updated 2 years ago

Was this helpful?

When using our MA2 driver, since it communicates with OnPC/desk via the web-remote interface, you will realize there are a couple of limitations. Although ShowCockpit does a good job abstracting you from the underlying communication protocols, there are end-roads due to limitations on the MA2 side.

One of the biggest drawbacks of the web-remote interface is that it does not sync Fader and Button pages.

In this article we will discuss how bi-directional page sync can be achieved with some trickery involved.

Changing Pages from ShowCockpit

You probably realized that there is a "Sync Pages" option in the element. As according to the , this option "syncronizes pages on MA2 sytem when page change occurs via ShowCockpit, using the Change Page function."

So if you are ok with just changing pages via ShowCockpit, this is the way to go - enable this option and the driver will take care of the rest for you.

Changing Pages on MA2

It is not that uncommon that MA2 shows are designed with multiple paging in mind. And sometimes the page change is even triggered via Macros.

In a normal situation, if this occurs, you will notice that any clients connected to the web-remote will be left behind - in other words, they will not follow the page change.

The workaround for this is to have some sort of feedback coming from MA2 into ShowCockpit that will trigger a Change Page on the ShowCockpit side.

To put it simple, the cleanest solution we suggest involves LUA scripts running on both sides. And the feedback of the current page on MA2 arrives via a dummy executor. If you haven't run away already by reading the word LUA, bear with us, it's not that hard and we have actually taken care of the hardest parts.

Step 1 - Creating a Dummy Executor

We will need a dummy executor running a dummy sequence with empty cues in MA2. As funny as this seems, it will all make sense down the road.

For the sake of this tutorial, let's say we will use Executor 80, that we assume it is currently empty.

  • Clear your programmer

  • Store Cue 1 Thru 500 Executor 80

    • This creates a new sequence with 500 empty cues and assigns it to Executor 80 in the current page

  • Fix Executor 80

    • This fixes the sequence to this executor regardless of the page we're in

Step 2 - Sync cues to the page number

In this step we will make sure that the Cue number running in the Executor 80 we have just created is always in sync with the current page number. I.e., when you are on page 8, this Executor should be on Cue 8, if you change to page 16 the Executor should jump to Cue 16, and so on and so forth.

This can be made in multiple ways, but the safest way (that covers any type of page change) is having a LUA script running in the background.

Create a new Plugin in your MA2 showfile and copy-paste the following LUA script:

local lastFaderPage = -1
function pagechange_callback(t,n)
   local nowFaderPage = gma.show.getvar("FADERPAGE");
   if nowFaderPage == lastFaderPage then
      gma.echo("Same Fader Page = " .. nowFaderPage);
   else
      gma.echo("Fader Page=" .. nowFaderPage);
      gma.cmd("Go Executor 1.80 Cue " .. nowFaderPage);
      lastFaderPage = nowFaderPage;
   end

end

function Start()
   gma.timer(pagechange_callback,0.1,0,Cleanup);
end

function Cleanup()
  gma.echo("Cleanup called");
end

return Start;

If you don't understand the LUA syntax, that's ok. But in case you're interested, this plugin simply creates a timer that calls our function "pagechange_callback" every 0.1 seconds.

In this function, we will get the current fader page and compare it with an auxiliary variable that we use to store the last page. So that whenever they are different, it means the page has changed, and we need to action the Executor 80 to Go to Cue number = to the fader page number.

At this point, you should run the script and test if the executor follows the page change.

Step 3 - Reading the current page in ShowCockpit

Now, the last step is to read the current page number (indirectly via Executor 80) and issue a Change Page on the ShowCockpit side in order to follow the page that MA2 is currently in.

For that, we will use LUA again, but this time running on the ShowCockpit side.

So, add a new LUA Script element to your ShowCockpit project and copy-paste the following code:

-- ShowCockpit LUA Script: MA2 Follow Bank
--   created on ShowCockpit v3.1.3
--   by Ricardo Dias
--   on 25-5-2019

function setMA2Page(MA2Element, pageType, executorToRead)
  -- Returns the name of the current cue
  v = MA2Element.GetExecutorCurrentCue(executorToRead)

  if v == nil then
  else
    v = string.sub(v,1,5)

    -- Page to jump to when "Change Type" = "Jump To"
    p_jumptopage = v;
    
    -- Changes fader/button page on MA2
    MA2Element.ChangePage_ButtonClick(pageType, 'Jump To', p_jumptopage)
   end
end


-- Get 'GrandMA2' element
GrandMA2 = GetElement('GrandMA2')

while 1 do
  setMA2Page(GrandMA2, 'Faders', 80)
  sleep(0.1)
end

The script above reads the current cue name from Executor 80, extracts the number of the cue from its name and then issues a "Change Page" by emulating a Button Click event on that function with the "Faders" type and jumping to the page number that is equal to the cue number it just read.

It has a main loop to keep doing this every 0.1 seconds.

Conclusion

And that's all! Now your Fader Page on SC follows the Fader Page changes on MA2.

We have just worked around a limitation, unfortunately involves adding scripts to the showfile, but at least it's an alternative to those wanting to be able to freely change page on MA2.

Note that you can still do it from the SC side as well.

We leave to you as homework how to change the scripts above to change both Fader pages and Button pages.

💡
documentation