SEND LEVEL TO MET-6N
remeolb
Junior Member
I am trying to send volume info from an Autopatch 18x18 Precis DSP matrix switcher to the bargraph on a MET-6N keypad. The string from the device displays volume from '( -700 )' to '( 100 )' which is -70dB to +10dB. How do I store this info and then change the range to 0-255 so I can display the volume on the bargraph? I'm running into issues with type conversions.
Comments
-
Yeah I've seen that post. I actually have the code saved as an include file. My issue is when I ATOI the string I get a signed integer. I then add 700 multiply by 255 and divide by 800 to scale it. For some reason this returns zero.
To solve the problem I ended up doing this...IF(FIND_STRING(sAUDIO_SWITCH_VOLUME,'M',1)) { nAUDIO_SWITCH_VOLUME[nAUDIO_SWITCH_OUTPUT] = -700 ON[nAUDIO_SWITCH_MUTE[nAUDIO_SWITCH_OUTPUT]] nVOL = 0 } ELSE IF(FIND_STRING(sAUDIO_SWITCH_VOLUME,'-',1)) { nAUDIO_SWITCH_VOLUME[nAUDIO_SWITCH_OUTPUT] = (ATOL(RIGHT_STRING(sAUDIO_SWITCH_VOLUME,(nSTRING_LENGTH -1))) * (-1)) OFF[nAUDIO_SWITCH_MUTE[nAUDIO_SWITCH_OUTPUT]] GET_BUFFER_CHAR(sAUDIO_SWITCH_VOLUME) nVOL = (((700 - ATOI(sAUDIO_SWITCH_VOLUME)) * 255) / 800) } ELSE { nAUDIO_SWITCH_VOLUME[nAUDIO_SWITCH_OUTPUT] = (ATOL(sAUDIO_SWITCH_VOLUME)) OFF[nAUDIO_SWITCH_MUTE[nAUDIO_SWITCH_OUTPUT]] nVOL = ((((ATOI(sAUDIO_SWITCH_VOLUME))+700) * 255) / 800) } fnAUDIO_SWITCH_VOLUME_UPDATE(nAUDIO_SWITCH_OUTPUT,nVOL)
This works fine when I send nVOL to my update level function. -
what I do is add an offset to the value coming in so it is always positve. It's lazy, but it does work.
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums