Create Custom XY Router User Panel

Scope

The audio routers in CorePro are one of the most used parts of the system. User panels already include an XY Router component you can simply drop onto the page. As well, the Routers page offers another way to directly set Sources to Destinations. Sometimes you might want to create your own custom X Y router interface on a user panel. This helpdoc will review the steps one could take to create such an interface

If you are looking to create a more simple X router with a fixed Y (Destination) take a look at Example 1 in the CorePro user manual regarding the user panel List Component

Disclaimer

This is an advanced topic. It is provided with no warranty and limited support. The example below will utilize User Panel List components, String Builder Memory Slots, Logic Flows and directly sending CorePro API commands to control the Axia Audio Router

Overview of work

We will create a user panel that contains two List Components and a Button. The Lists will read from the Axia Audio Router Source and Destination entries. The Take button will ultimately set the Source to Destination choice that is made by the two lists.

We will create two Memory slots that will store the choice of each list. A string builder memory slot will be used to allow use to concatenate a special SAPv2 string that includes data from the memory slots that store our List choices.

A logic flow using the relay combiner will be used to "push" the SAPv2 string to a special endpoint that will submit the SAPv2 command. The relay is controlled by the Take button in the user panel. The relay will "push" the string we created with the help of the String Builder Memory Slot directly into CorePro's own API to control set the audio router Source and Destination

Step by Step

Create the user panel

Place two List components and one button on the canvas

The "Theme" of my panel is set to Dark

It would also be good practice to set the ID for the two List's and Button accordingly:

Source List, set its id property to : saselector_Source_X

Destination List, set its id property to: saselector_Destination_Y

Button, set its id property to: button_XY_TAKE

Click Save on the panel. For this example I saved the panel name as My_XY_Router

Configure the Source List to read from the Axia Audio Router Sources

For the Source List you need to set the properties accordingly:

Set listsearchpath to Routers#0.AxiaAudioRouter#1 SapObjectType=AxiaAudioSource

Set listsearchdepth to 1

Set itemdisplayproperty to Name

Set itemselectproperty to Path

Save the panel

Configure the Destination List to read from the Axia Audio Router Sources

For the Destination list you need to set the properties accordingly

Set listsearchpath to Routers#0.AxiaAudioRouter#1 SapObjectType=AxiaAudioDestination

Set listsearchdepth to 1

Set itemdisplayproperty to Name

Set itemselectproperty to Path

Save the panel

If you are trying to make route changes with a Virtual Router, please see addendum at end of this helpdoc

Test that Lists display values

This is a good time to save the panel and click the view button to launch the panel

If all is good so far, the Source and Destination list should contain the Source and Destination Names from the Axia Audio Router. If it doesn't work, double check your property entries for mistakes

Allow binding of the Button's MouseDown event

Go back to the user panel editor

Select the TAKE button and Expand the "event" properties

Click the small button next to mousedown

Save the panel

Create the memory slots

Now we will create the three memory slots

Go to the Memory Slots page

Create memory slots to store Source and Destination list choices

Create a new memory slot of Type "Memory Slot"

Set Name MyRouter_Source_X

Set Startup State blank

Set Persistent True

Click Apply

Create a new memory slot of Type "Memory Slot"

Set Name MyRouter_Destination_Y

Set Startup State blank

Set Persistent True

Click Apply

Create memory slot that will create the SAPv2 API command string

Create a new memory slot of Type "String Builder Memory Slot

Set Name MyRouter_SAPv2_Set_String

Set Startup State blank

For Included Slots click the ellipse button to the right of the text box. Highlight MyRouter_Destination_Y and MyRouter_Source_X from the list and click Select. Included Slots text field should now have MyRouter_Destination_Y,MyRouter_Source_X in it

Set Pattern SET Routers#0.AxiaAudioRouter#1.AxiaAudioDestination#[{0}] CurrentSourcePath="{1}"

Click Apply

Create Relay Logic Flow

Go to the Logic Flows page

For best practice, create a new logic flow folder to store this logic flow in

Create a new logic flow:

Highlight the ListTranslator and click on the Combiner icon from the toolbar:

Click on the NOT combiner and click on the Start Point icon from the toolbar:

Click on the AND combiner and change the Combiner Type to Relay:

For the upper left Start Point, set the Property to UserPanels, My_XR_Router (or whatever you named your panel), button_XY_TAKE, mousedown, value

For the upper left Translator, set it so that True = True and * = False

For the bottom left Start Point, set the Property to Memory, TextBuilderMemorySlot#MyRouter_SAPv2_Set_String, SlotValue

For the bottom left List Translator, this can be left as it is with * = *

For the End Point on the Right Side, set the Property Selector to API mode first

Set the property to Devices, SubmitSapMessage

The ListTranslator at the end can also be left as * = *

After clicking apply the top and bottom start points on the left side will flip around, which is normal. You should get a logic flow that looks like this:

Configure Lists to store their current choice to memory slots

Go back into the user panel editor

The one thing left to do is have it so that when you pick a Source from the Source list, and a Destination from the Destination list, those will get stored to our memory slots

Set Source list "Change" event action

Click on the Source List component on your user panel

Expand Event, and click the button next to change so it becomes blue. Click on the Logic Flow

Set the Property to MemorySlot, MemorySlot#MyRouter_Source_X, SlotValue

The translator properties, should stay with the default * = *

Save the panel

Set Destination list "Change" event action

Click on the Destination List component on your user panel

Expand Event, and click the button next to change so it becomes blue. Click on the Logic Flow

Set the Property to MemorySlot, MemorySlot#MyRouter_Destination_Y, SlotValue

The translator properties, should stay with the default * = *

Save the panel

Test that Memory Slot values get set

Go to the Memory Slots page and also launch the user panel

Pick a Source from the Source List

Observe that the memory slot value for MyRouter_Source_X is changing accordingly

Pick a Destination from the Destination List

Observe that the memory slot value for MyRouter_Destination_Y is changing according

When both MyRouter_Source_X and MyRouter_Destination_Y are set, the value of MyRouter_SAPv2_Set_String should contain the values of both memory slots (and some of its own text as well)

From the earlier step. We set the String Builder pattern to this: SET Routers#0.AxiaAudioRouter#1.AxiaAudioDestination#[{0}] CurrentSourcePath="{1}"

{0} = is the memoryslot value of MyRouter_Destination_Y, {1} = is the memoryslot value of MyRouter_Source_X

The end result is that these memory slot values get inserted in correct places of text the string. The complete text string is a valid SAPv2 SET command

Test setting a route

If everything up to this point appears to be working. The very last part is to see if the Logic Flow gets triggered when the TAKE button on the user panel is pushed

On the user panel pick a Source from the Source List and pick a Destination from the Destination list

Go to the Routers page, and open up the Axia Audio Router, go to the Routes tab

In the Filter type in the name of the Destination so its the only route we have visible in the table

Make sure that the route is either not set, or set to something different that what you want to set it to from the user panel

Click the TAKE button on the user panel while observing the Routes tab.

If it works, it should automatically update to show that the Source was set to the selected Destination

Troubleshooting

If the Route didn't get set the troubleshooting advice is as follows:

Make sure that your Source List choice is actually being stored in the Memory Slot meant to hold the Source list choice. Same for the Destination. Make sure it is actually being stored in the Destination Memory Slot. If they are reversed, fix them

Check that the String Builder is using the correct Source and Destination memory slots. Make sure you didn't pick an extra or incorrect memory slot by mistake. The order of the memory slots matter. The first memory slot would be inserted into the string where {0} is, and the second memory slot would be inserted into the string where {1}. The string uses {0} to insert the DestinationIO path, and {1} is used for the SourceIO path. If these are reversed, the SAPv2 SET command will not work since it would be trying to route a Destination to a Source instead

Make sure that the Relay Logic flow is working as expected. When you press down on the TAKE button the Start Point that uses the Take button's mousedown property should turn Green and say True (as pictured). When its let go, it should go red

Additionally, make sure that the Relay Logic flow can read from the String Builder Memory Slot

After you pick a Source and Destination from the List. You can hover over the Start Point that uses StringBuilderMemorySlot and see the memoryslot value. This value should be the same as what you can also see on the memory slot page for the StringBuilderMemorySlot value. If it isn't there, make sure the Start Point is set the correct memory slot value property

Addendum

Setting routes with Virtual Router instead of Axia Audio Router

The virtual router requires that the List components have their properties set slightly different

In the listsearchpath examples below, where you see Routers#0.VirtualRouter# you must reference the router number here. For example on the Routers page, my virtual router ID is 9, so I use Routers#0.VirtualRouter#9

In itemselectproperty, this is changes to be set to Id instead of Path

Configure the Source List to read from a Virtual Audio Router

For the Source List you need to set the properties accordingly:

DIFFERENT>>>> Set listsearchpath to Routers#0.VirtualRouter#9 SapObjectType=VirtualSource

Set listsearchdepth to 1

Set itemdisplayproperty to Name

DIFFERENT>>>> Set itemselectproperty to Id

Configure the Destination List to read from a Virtual Audio Router

For the Destination list you need to set the properties accordingly

DIFFERENT>>>> Set listsearchpath to Routers#0.VirtualRouter#9 SapObjectType=VirtualDestination

Set listsearchdepth to 1

Set itemdisplayproperty to Name

DIFFERENT>>>> Set itemselectproperty to Id

Also, the Pattern for the stringbuilder memory slot needs to be set different

Create memory slot that will create the SAPv2 API command string (Virtual Audio Router)

Create a new memory slot of Type "String Builder Memory Slot

DIFFERENT>>>> Set Name MyRouter_SAPv2_Set_String

Set Startup State blank

For Included Slots click the ellipse button to the right of the text box. Highlight MyRouter_Destination_Y and MyRouter_Source_X from the list and click Select. Included Slots text field should now have MyRouter_Destination_Y,MyRouter_Source_X in it

DIFFERENT>>>> Set Pattern SET Routers#0.VirtualRouter#9.VirtualDestination#{0} CurrentSource={1}

*** VirtualRouter# should be changed to match the same virtual router number you are using for the ListSearchPath step