Starting Point on a 4x4 switcher?
vegastech
Posts: 369
What is a better approach for programming a 4x4 switcher? Using a Multi-Dimensional array, like:
NON_VOLATILE INTEGER nMatrixInput [] [] = { {11,12,13,14}, //outputs 1-4 for input 1 {21,22,23,24}, //outputs 1-4 for input 2 {31,32,33,34}, //outputs 1-4 for input 3 {41,42,43,44}, //outputs 1-4 for input 4Or using devchans?
DEVCHAN dcSwitcherOut1 [] = { //inputs available for output 1 {dvTPswitch,11},{dvTPswitch,21},{dvTPswitch,31},{dvTPswitch,41} } DEVCHAN dcSwitcherOut2 [] = { //inputs available for output 2 {dvTPswitch,51},{dvTPswitch,61},{dvTPswitch,71},{dvTPswitch,81} } DEVCHAN dcSwitcherOut3 [] = { //inputs available for output 3 {dvTPswitch,91},{dvTPswitch,101},{dvTPswitch,111},{dvTPswitch,121} } DEVCHAN dcSwitcherOut4 [] = { //inputs available for output 1 {dvTPswitch,131},{dvTPswitch,141},{dvTPswitch,151},{dvTPswitch,161} }I was hoping to use a get_last on either of these...but where do I go from here? I've tried a stacked button_event with a get_last, but it only seems to propagate when using the first grouping. Every other button press returns a 1 instead of a 1,2,3,or 4.
0
Comments
Use one array to track your output feedback, and one variable to track your currently operated output. You only need to change this up if you need a matrix display, in which case there are lots of ways to do it depending on how you want switching to work.
In a distributed audio system, I don't use button presses to switch inputs, I use SEND_COMMAND and create a handler in the module to do the work when the end user selects a source. For feedback, I keep a simple array with a position for each zone, and that position in the array indicates what input is active. For example, {1, 2, 2, 0} would mean zone 1 is on input 1, zones 2 & 3 on input 2, and zone 4 is off.
For a mixing board where you need at-a-glance control and feedback for the whole setup, I'd still do the same for feedback, but would only use a single dimension array for the buttons. It's easy enough to calculate from the button channel which output and input you want. Multi-dimensions just get in the way at that point.