Home AMX User Forum NetLinx Studio

Multi-Dimensional Arrays and Multiple Devices

staticatticstaticattic Junior MemberPosts: 200
I have 9 display devices, 18 inputs to an Extron switch, and 10 scalers as outputs on that Extron switch. The 10 scalers pass video from a low res switch to the high res switch. The displays are all hanging off the high res switch. I wanted to make the scalers recyclable. For example, if a user wants to watch the DVD player, the scaler outputs of the low res switch can be polled to see if the DVD player is currently routed to a scaler. If it is, I need to which scaler so I can take that scaler's input to the high res switch and push it to the proper output. if the dvd player is not currently routed to a scaler, the code needs to be able to pick the first open scaler and route accordingly. In order for this to work, the tie needs to first be broken, Input 0 to Output xx, and then the new selection made. In it's current config, it works fine as long as there is only one display device. If user A is watching the cable tuner and decides to watch the DVD player, the system will first send a 0 to the output the cable tuner is curently routed to, and then make the new connection for the dvd player. The problem is, if someone else is watching the cable tuner, they will lose it. As a fix, I thought a multi-dimesional array, truth table type polling would be the best solution. That way, if anyone were watching the DVD player, the system would act accordingly. Instead of polling the Extron switches, the code would poll the truth table. I thought of something like:
CHAR cTestArray [9][18][10]. If all 9 displays were watching the dvd player, then all 9 truth tables would have a 1 in the dvd column. That way the system would know, if there was at least one 1, someone was watching the DVD player. Whatever scaler the DVD player was currently on, would be busy and not available. I am having problems implementing this idea. Am I making it harder than what is should be? The quick and easy would be to assign each display a scaler, but that would eat up 9 scalers and only leave 1 spare. Plus, if they added equipment, it would take recoding as compared to just changing a few digits in the array. Any thoughts or ideas would be greatly appreciated. Thanks.

Comments

  • a_riot42a_riot42 AMX Wizard Posts: 1,619
    I have 9 display devices, 18 inputs to an Extron switch, and 10 scalers as outputs on that Extron switch. The 10 scalers pass video from a low res switch to the high res switch. The displays are all hanging off the high res switch. I wanted to make the scalers recyclable. For example, if a user wants to watch the DVD player, the scaler outputs of the low res switch can be polled to see if the DVD player is currently routed to a scaler. If it is, I need to which scaler so I can take that scaler's input to the high res switch and push it to the proper output. if the dvd player is not currently routed to a scaler, the code needs to be able to pick the first open scaler and route accordingly. In order for this to work, the tie needs to first be broken, Input 0 to Output xx, and then the new selection made. In it's current config, it works fine as long as there is only one display device. If user A is watching the cable tuner and decides to watch the DVD player, the system will first send a 0 to the output the cable tuner is curently routed to, and then make the new connection for the dvd player. The problem is, if someone else is watching the cable tuner, they will lose it. As a fix, I thought a multi-dimesional array, truth table type polling would be the best solution. That way, if anyone were watching the DVD player, the system would act accordingly. Instead of polling the Extron switches, the code would poll the truth table. I thought of something like:
    CHAR cTestArray [9][18][10]. If all 9 displays were watching the dvd player, then all 9 truth tables would have a 1 in the dvd column. That way the system would know, if there was at least one 1, someone was watching the DVD player. Whatever scaler the DVD player was currently on, would be busy and not available. I am having problems implementing this idea. Am I making it harder than what is should be? The quick and easy would be to assign each display a scaler, but that would eat up 9 scalers and only leave 1 spare. Plus, if they added equipment, it would take recoding as compared to just changing a few digits in the array. Any thoughts or ideas would be greatly appreciated. Thanks.

    I don't understand why you need more scalers than you do displays. Are you using more than one scaler per video signal path? If not, then can't you just use a scaler per display and use the extron switch to route video? Perhaps I am missing something.
    Paul
  • Spire_JeffSpire_Jeff Formerly Caffeinated Programmer Posts: 1,917
    I am not sure how this will merge with your code, but you might consider the following function:
    define_variable
    integer nScalerAssignments[10];
    
    define_function integer getScalerAssignment(integer DeviceID){
      stack_var integer x;
    
      for(x=1;x<=10;x++){
        if(nScalerAssignments[x] == DeviceID)
          return x;
      }
      return 0;
    }
    
    

    The device ID would be equal to the input of the various sources on the low res switch. You would also need to write a setScalerAssignment() function or just set the variable nScalerAssignment accordingly.
    When you call the function, if it returns a value, that is the scaler being used. If it returns 0, the device is unassigned and you will have to assign it. In order to accomplish this, you will also need clearScalerAssignment() to release a device from the scaler when it is not needed.

    Personally, as I think about it, I might wind up combining the get and set functions to be one called AssignToScaler. This depends on the code you are trying to integrate with, but I would just have the AssignToScaler function first scan through to see if the device is already assigned somewhere. If it is, return the scaler number it is assigned to. If it is not, then assign it to the first available scaler and return that id.

    Just my two cents,
    Jeff

    P.S.
    The additional scalers might be to support picture in picture or there might be an extra scaler being used as a redundancy option in case one of the first nine fail.
  • staticatticstaticattic Junior Member Posts: 200
    Thanks for the ideas. I will try them today.

    The low res switch is a MAV 2424. The high-res switch is a Crosspoint 3232. The high res switch currently sports 2 projectors, 3 display screens, and a quad view. If a low-res source is selected, it is routed to one of the 10 scalers, outputs 1 - 10 on the low-res switch, over to inputs 23 - 32 of the high-res switch. My initial thought was to give each one of them their own scaler, from the low res-switch, so that would eat up 9 of the 10 scalers. For instance, anything going to the Right projector, if it originates on the low-res switch, would always route to scaler 1. So if someone wanted to watch TV on the right projector, the command string would always be for the low-res switch to put the cable tuner on scaler 1. The signal would "cross the bridge" to the high-res switch, then the input of the high-res that is tied to scaler 1 would route to the output for the Right projector. That would work fine for now. However, in the not so distant future, more outputs are going to be added to the high res switch. Not to mention that besides the 10 inputs being used from the scalers, all of the other inputs on the high-res switch are being used by other devices. I should have made that more clear. My apologies.

    I wanted to write the code in such a way as to recycle the scalers. In paragraph form, this is what the code is doing right now:

    Each input selection has a button assigned to it in an array called nINPUTS[].

    If the input selected is on the low-res switch, a push will start my function WHICH_SCALER().
    DEFINE_FUNCTION WHICH_SCALER()
    {
       LOCAL_VAR CHAR cMAV[10]
       LOCAL_VAR INTEGER n
       FOR(n=1, n<=10, n++)
       {
          CLEAR_BUFFER cMAV_BUFF
          SEND_STRING dvMAV, "ITOA(n),'&'"       // n& will poll the output n and return the input tied to it 
       }
       cMAV = REMOVE_STRING(cMAV_BUFF, "13,10",1)
       IF(LENGTH_STRING(cMAV) != 0)
       {
          SET_LENGTH_STRING(cMAV, LENGTH_STRING(cMAV) - 2)
          cMAV_OUTPUT[n] = ATOI(cMAV)
          nScaler_In_Use = FIND_STRING(cMAV_OUTPUT, "nInputBTN_INDEX",1)
       }
    }
    
    

    cMAV_OUTPUT looks something like "0,0,0,0,0,0,0,0,0,0". When it is polled, it should fill up with the inputs active, like "1,12,4,5,8,17,15,3,6,9". If the input chosen is 12, nScaler_In_Use will equal 2. That would tell me that input 12 is currently on scaler 2, so rather than burn up another scaler, I can simply route scaler 2 to the selected display. If the user selects input 20, nScaler_In_Use will return 0. That would tell me that 20 is not currently on a scaler, so I need to find one that is available. To do that, I need to poll all of the outputs of the Crosspoint swtich, to see which scalers are actually going to an output. if scaler 3, for example, is going nowhere, then that scaler is not in use and input 20 can go to scaler 3.

    All of this code relies on responses from the Extron switches. I haven't tried it in real life, so I am not sure how well it will work with the Extrons. It works great if I hard code numbers in the places where the Extron switches would reply. So I know it at least is running the numbers right. The Extrons are serially controlled, so when polling them, I might be slamming them with too much data at one time. If a person selects an input and it takes 3 to 4 seconds to actually show up, that is going to be unsat. I might be totally approaching this from the wrong angle. This might just be a limitation of the system that they are going to have to deal with. I am just trying to make the limitations as small as possible.
Sign In or Register to comment.