Home AMX User Forum NetLinx Studio

Extron DMP Level Feedback

Hi

I`m looking for some help in controlling the levels on an Extron DMP 128 Audio DSP.

Increase/Decrease volume is no problem.

I need to convert the values from between 1868 to 2848 to be represented on the touch panel for user feedback. I can't for the life of me work this out. It`s been a while since i`ve done AMX and i`m way out of practice.

The device reports back a string of DsG40001*2288,$0d,$0a - the part before the * being the specific input, moreover the value of the digit before the * is the crucial part.

Now I know I need to strip out everything before that and throw it away, as it isn't relevant. Then I need the value before the * so I need to keep that.

What I don't know how to do is use the value after the * and before the $0d and put it so it can be displayed as level bar graph back on the panel.

Here is what I have thus far;
BUTTON_EVENT[dvTP,nDMPMicUpBtns]
{
    PUSH:
    {
	INTEGER nMicChannel
	nMicChannel = GET_LAST(nDMPMicUpBtns)
	
	IF(nMicLevels[nMicChannel] > -99)
	{
	    nMicLevels[nMicChannel] = nMicLevels[nMicChannel] + 10
	    SEND_STRING dvDMP,"$1B,'G',cDMPMicNames[nMicChannel],'*',ITOA(nMicLevels[nMicChannel]),'AU',$0D"
	}
    }
    
		
		HOLD[1,REPEAT]:
		{
		    INTEGER nMicChannel
		    nMicChannel = GET_LAST(nDMPMicDownBtns)
		    
		    IF(nMicLevels[nMicChannel] > -99)
		    {
			nMicLevels[nMicChannel] = nMicLevels[nMicChannel] +10
			SEND_STRING dvDMP,"$1B,'G',cDMPMicNames[nMicChannel],'*',ITOA(nMicLevels[nMicChannel]),'AU',$0D"
		    }
		}
}

BUTTON_EVENT[dvTP,nDMPMicDownBtns]
{
    PUSH:
    {
	INTEGER nMicChannel
	nMicChannel = GET_LAST(nDMPMicDownBtns)
	
	IF(nMicLevels[nMicChannel] > -99)
	{
	    nMicLevels[nMicChannel] = nMicLevels[nMicChannel] - 10
	    SEND_STRING dvDMP,"$1B,'G',cDMPMicNames[nMicChannel],'*',ITOA(nMicLevels[nMicChannel]),'AU',$0D"
	}
    }
    
		
		HOLD[1,REPEAT]:
		{
		    INTEGER nMicChannel
		    nMicChannel = GET_LAST(nDMPMicDownBtns)
		    
		    IF(nMicLevels[nMicChannel] > -99)
		    {
			nMicLevels[nMicChannel] = nMicLevels[nMicChannel] - 10
			SEND_STRING dvDMP,"$1B,'G',cDMPMicNames[nMicChannel],'*',ITOA(nMicLevels[nMicChannel]),'AU',$0D"
		    }
		}
		
}



DATA_EVENT[dvDMP]
{
    ONLINE: SEND_COMMAND dvDMP,"'SET BAUD 38400,N,8,1 485 DISABLE'"
    
    STRING:
    {
	CHAR cMicString[20]
	SLONG nMicLevel
	INTEGER nLoop
	
	WHILE(FIND_STRING(DATA.TEXT,'DsG',1))
	{
	    REMOVE_STRING(DATA.TEXT,'DsG4000',1)
	    cMicString = REMOVE_STRING(DATA.TEXT,"'*'",1) //Look for end of name
	    cMicString = LEFT_STRING(cMicString,LENGTH_STRING(cMicString)-1) 
	    nMicLevel = ATOI(LEFT_STRING(DATA.TEXT,LENGTH_STRING(DATA.TEXT)-3))
	    
	    FOR(nLoop = 1;nLoop <= LENGTH_ARRAY(cDMPMicNum);nLoop++) //Do 
	    {
		IF(cMicString = cDMPMicNum[nLoop]) 
		{
		    nMicLevels[nLoop] = nMicLevel
		    SEND_LEVEL dvTP,nLoop+10,nMicLevel+100
		    SEND_COMMAND dvTP,"'^TXT-',ITOA(nLoop),',0,',ITOA(nMicLevel)"
		    BREAK
		}
	    }
	}
    }
}


I`m probably quite well off the mark but hopefully a little guidance from the pro's can help me along.

Thank you in advance.

Dave

Comments

  • viningvining Posts: 4,368
    I don't know this device or what those values represent but a shot in the dark would be to take the value received and subtract 1868 and then divide the result by 10 and that would give a 0-98 scale that you could use for a level feedback.
  • davecdavec Posts: 21
    Yeah, sorry forgot to mention that, 1868 is 0dB through to 2848 being +24dB.

    Is the way i`m taking the string apart the correct way or, would you do it differently?

    Thanks
  • viningvining Posts: 4,368
    Even though the values indicate 0-24 I would still do as I posted and send values 0-98 to the TP for display, just make your bar graph 0-98 or 0-100.

    As far as parsing goes ya kinda need the doc to verify the consistency of the returned string and how parsing should be handled but there are some basic methods I would change.

    1, don't use data.text on real "non" AMX devices, create a local or global var and append
    var = "var,data.text"; then use the var for your parsing routine.
    2, don't while loop based on the begining of the string but the end $0D,$0A.
    that way your sure to have a complete string.

    I might do it like this:
    cMyVar = "cMyVar,DATA.TEXT";
         
    WHILE(FIND_STRING(cMyVAR,"$0D,$0A",1))
         {
         STACK_VAR CHAR cStr[24];
         STACK_VAR INTEGER nFBS;
    
         cStr = REMOVE_STRING(cMyVAR,"$0D,$0A",1);
         nFBS = FIND_STRING(cStr,'*',1);
         if(nFBS > 1)//could make number 8 if that's consistent
    	  {
    	  GET_BUFFER_STRING(cStr,nFBS-2);//dump
    	  cMicString = aoti(GET_BUFFER_STRING(cStr,2));
    	  nFBS = FIND_STRING(cStr,"$0D,$0A",1);
    	  if(nFBS > 1)
    	       {
    	       nMicLevel = aoti(GET_BUFFER_STRING(cStr,nFBS-2));
    	       }
    	  }
         }
    
  • If that is a mic level you are parsing I believe Extron does a -18 to 80 db level, not 0 to 24, so that would be right in line with the 0-98 feedback.
  • davecdavec Posts: 21
    I obviously can't read the manual correctly as well as parse this info. You are correct, it is -18dB to 80dB.

    Not sure which part of the manual I was reading. Quite clearly not the correct part. Thanks for the advice, I will work with what you haven't given me and then see where I get. :-)

    Thanks
  • JubalJubal Posts: 77
    how you do the volume up and down? what is your variable? im doing this but no luck controlling the volume
  • JubalJubal Posts: 77
    davec wrote: »
    Hi

    I`m looking for some help in controlling the levels on an Extron DMP 128 Audio DSP.

    Increase/Decrease volume is no problem.

    I need to convert the values from between 1868 to 2848 to be represented on the touch panel for user feedback. I can't for the life of me work this out. It`s been a while since i`ve done AMX and i`m way out of practice.

    The device reports back a string of DsG40001*2288,$0d,$0a - the part before the * being the specific input, moreover the value of the digit before the * is the crucial part.

    Now I know I need to strip out everything before that and throw it away, as it isn't relevant. Then I need the value before the * so I need to keep that.

    What I don't know how to do is use the value after the * and before the $0d and put it so it can be displayed as level bar graph back on the panel.

    Here is what I have thus far;
    BUTTON_EVENT[dvTP,nDMPMicUpBtns]
    {
        PUSH:
        {
    	INTEGER nMicChannel
    	nMicChannel = GET_LAST(nDMPMicUpBtns)
    	
    	IF(nMicLevels[nMicChannel] > -99)
    	{
    	    nMicLevels[nMicChannel] = nMicLevels[nMicChannel] + 10
    	    SEND_STRING dvDMP,"$1B,'G',cDMPMicNames[nMicChannel],'*',ITOA(nMicLevels[nMicChannel]),'AU',$0D"
    	}
        }
        
    		
    		HOLD[1,REPEAT]:
    		{
    		    INTEGER nMicChannel
    		    nMicChannel = GET_LAST(nDMPMicDownBtns)
    		    
    		    IF(nMicLevels[nMicChannel] > -99)
    		    {
    			nMicLevels[nMicChannel] = nMicLevels[nMicChannel] +10
    			SEND_STRING dvDMP,"$1B,'G',cDMPMicNames[nMicChannel],'*',ITOA(nMicLevels[nMicChannel]),'AU',$0D"
    		    }
    		}
    }
    
    BUTTON_EVENT[dvTP,nDMPMicDownBtns]
    {
        PUSH:
        {
    	INTEGER nMicChannel
    	nMicChannel = GET_LAST(nDMPMicDownBtns)
    	
    	IF(nMicLevels[nMicChannel] > -99)
    	{
    	    nMicLevels[nMicChannel] = nMicLevels[nMicChannel] - 10
    	    SEND_STRING dvDMP,"$1B,'G',cDMPMicNames[nMicChannel],'*',ITOA(nMicLevels[nMicChannel]),'AU',$0D"
    	}
        }
        
    		
    		HOLD[1,REPEAT]:
    		{
    		    INTEGER nMicChannel
    		    nMicChannel = GET_LAST(nDMPMicDownBtns)
    		    
    		    IF(nMicLevels[nMicChannel] > -99)
    		    {
    			nMicLevels[nMicChannel] = nMicLevels[nMicChannel] - 10
    			SEND_STRING dvDMP,"$1B,'G',cDMPMicNames[nMicChannel],'*',ITOA(nMicLevels[nMicChannel]),'AU',$0D"
    		    }
    		}
    		
    }
    
    
    
    DATA_EVENT[dvDMP]
    {
        ONLINE: SEND_COMMAND dvDMP,"'SET BAUD 38400,N,8,1 485 DISABLE'"
        
        STRING:
        {
    	CHAR cMicString[20]
    	SLONG nMicLevel
    	INTEGER nLoop
    	
    	WHILE(FIND_STRING(DATA.TEXT,'DsG',1))
    	{
    	    REMOVE_STRING(DATA.TEXT,'DsG4000',1)
    	    cMicString = REMOVE_STRING(DATA.TEXT,"'*'",1) //Look for end of name
    	    cMicString = LEFT_STRING(cMicString,LENGTH_STRING(cMicString)-1) 
    	    nMicLevel = ATOI(LEFT_STRING(DATA.TEXT,LENGTH_STRING(DATA.TEXT)-3))
    	    
    	    FOR(nLoop = 1;nLoop <= LENGTH_ARRAY(cDMPMicNum);nLoop++) //Do 
    	    {
    		IF(cMicString = cDMPMicNum[nLoop]) 
    		{
    		    nMicLevels[nLoop] = nMicLevel
    		    SEND_LEVEL dvTP,nLoop+10,nMicLevel+100
    		    SEND_COMMAND dvTP,"'^TXT-',ITOA(nLoop),',0,',ITOA(nMicLevel)"
    		    BREAK
    		}
    	    }
    	}
        }
    }
    
    

    I`m probably quite well off the mark but hopefully a little guidance from the pro's can help me along.

    Thank you in advance.

    Dave




    I try your code but i get error in this area. IF(nMicLevels[nMicChannel] > -99)
    it exactly yours but mine have error.

    nMicLevels is sinteger????
    cDMPMicNames is constant? = 4000???
Sign In or Register to comment.