Extron DMP Level Feedback
davec
Posts: 21
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;
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`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
0
Comments
Is the way i`m taking the string apart the correct way or, would you do it differently?
Thanks
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:
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
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???