Home AMXForums Archive Threads AMX Applications and Solutions

whole House matrix questions

The system i am doing right now is basically an 8x8 matrix to as many areas for viewing or listening and the way the client wanted the hand full of TPs programmed, is to pick an area and then on the next screen pick a source for the area from any TP. all the TPs would be the same and you would basically be able to do anything from any of them.

I figured an exp programmer would use some type of condtional statement to nest all the matrix/source codes and activate the different code blocks depending on the area and source selected,etc. I was thinking maybe switch/case? im not sure and keep in mind im a noob(this being my first project).

obviously the cheap way to do this would be to multiple source pages, etc but I know thats not the way to do it here. an example of code would really help me! thanks!


  • ericmedleyericmedley Senior Member - 4000+ posts Posts: 4,177
    The approach I'd use is as follows.

    Create an array that has the current zone controlled for each touch panel.

    So, if there are 5 TPs, the the array Current_Audio_Zone would be 5 cells wide. (one for each TP.)
    volatile dev Audio_TPs[]=

    The client selects the zone they wish to control which sets the array Current_Audio_Zone [this TP] to whichever output they selected.
    volatile integer Current_Audio_Zone[5] // number of TPs.
    volatile integer Audio_Zone_Buttons[]=
      // now we know which audio output zone this TP is controlling.
      // do something...

    Then when they selected a source for that zone, I'd populate a Current_Source[number of output zones] with that source.
    volatile integer Current_Source[8] // current input selected for the 8 outupts.
    volatile integer Source_Buttons[]=
      // now we know which source is selected for the zone being controlled by this TP
      // do something...

    Of course, I'm oversimplifying this for the example but this is the basis for it. I'd then create a function to handle the actual switching of the HA switcher and another hink of code to deal with all the popup page navigation and so forth.

    Hope that helps.
  • adcantrelladcantrell Junior Member Posts: 24
    I'll try and wrap my head around that. Cheers~!
  • John GonzalesJohn Gonzales Junior Member Posts: 609
    I like to use structures for these situations, and I load the relevant data into the structures. Basically I'll have a structure that tracks each room's information (current source playing, current volume in that room, name of the source in that room), and I'll have another structure that tracks the panel's information. The button events will store the selections from the panel into the PanelInfo structure until it's time to execute the switch. In other words, client will choose a room or rooms, then the desired volume, then the source. Once they've made all selections, the switch is executed and the volume, and i/o are sent. The data is then parsed and that information gets stored in the room info structure and relevant data is updated on the panel for feedback. This works well because there's always the possibility that one person will be manipulating one zone while another will be manipulating a different or perhaps the same zone. All of the selections each person makes are stored independently with their own panel until the switch is executed.

    Also, it lowers the amount of traffic sent back and forth to each panel since the data is only updated or refreshed on panels that are on the matrix or wholehouse pages, and they can call it out of the stored data.

    The way I implement it in code is probably overly complex, but it works well for me, is simple for the end user to execute, and system response is very snappy. I use lots of GET_LASTs, and BUTTON.INPUT.DEVICEs, and just simple IF/THEN statements to figure out what to do.

    Here's an example of the structure definitions
    STRUCTURE _sPanelInfo
       INTEGER nCurrentSource                       // DSS units 1-12, DVDs 13-20, Tuner 21, CD 22, iPod 23, 24 is unused  
       CHAR    cCurrentSource[25]                   // Descriptive name of source
       CHAR    cOutput[135]                         // Up to 48 Outputs (digits + the space)
       CHAR    cInput[2]                            // Up to 99 Inputs (2-digits total)
       CHAR    cVolAbsolute[4]                      // Volume Absolute String (VA) (-700 to 100)
       INTEGER nWholehouseRoomSelected              // Which Room is selected on this panel 
    STRUCTURE _sRoomInfo
       INTEGER   nCurrentSource
       SINTEGER  nCurrentVolume
       CHAR      cCurrentSourceName[30]
    _sPanelInfo    _PanelInfo[16]       // All 16 panels have access to multi-zone
    _sRoomInfo     _RoomInfo[48]        // Track data for each of the 48 rooms

Sign In or Register to comment.