Using an Active Bargraph to Control Levels by Touching the Bargraph
Question:
How do I use an active bargraph to control levels from just touching the bargraph?
Answer:
This is a working example of controlling levels with an active bargraph. Active bargraphs give you the ability to change a level that gets sent to the Netlinx controller. You can then make volume, light, etc, changes in code based on where your finger is on the bargraph. The problem is, if you send the level from an active bargraph to control volume on a DVX (for instance), and then send the level from the DVX back to the bargraph, you create a loop that makes it work erratically.
For example:
DEFINE_DEVICE
dvTP = 10001:1:0
dvDVX_VOLUME_1 = 5002:1:0
DEFINE_EVENT
LEVEL_EVENT[dvTP,1] // LEVEL COMING IN FROM BARGRAPH
{
// SENDS BARGRAPH VALUE TO THE DVX VOLUME
SEND_LEVEL dvDVX_VOLUME_1,1,LEVEL.VALUE
}
LEVEL_EVENT[dvDVX_VOLUME_1,1] // LEVEL COMING IN FROM DVX
{
// SENDS DVX VALUE TO THE TOUCH PANEL ACTIVE BARGRAPH
SEND_LEVEL dvTP,1,LEVEL.VALUE
}This would be done so that if you move your finger on the bargraph, you will send that level to the DVX to raise and lower volume. Conversely, if the volume changes on the DVX, you want to send that to the touch panel bargraph so you can see the level has changed. In this configuration, you will encounter the loop mentioned earlier (TP feeds DVX, DVX feeds TP, on and on).
This can be fixed by adding another bargraph under the active bargraph with a different level address. Use the active bargraph (on top) to touch on the panel. Use the bottom bargraph to show the level from the DVX. Make the top bargraph transparent so you only see the one below. Now you change the code like this:
DEFINE_DEVICE
dvTP = 10001:1:0
dvDVX_VOLUME_1 = 5002:1:0
DEFINE_EVENT
LEVEL_EVENT[dvTP,1] // LEVEL COMING IN FROM BARGRAPH
{
// SENDS BARGRAPH VALUE TO THE DVX VOLUME
SEND_LEVEL dvDVX_VOLUME_1,1,LEVEL.VALUE
}
LEVEL_EVENT[dvDVX_VOLUME_1,1] // LEVEL COMING IN FROM DVX
{
// SENDS DVX VALUE TO THE TOUCH PANEL BOTTOM BARGRAPH
SEND_LEVEL dvTP,2,LEVEL.VALUE
}This will separate the level value of the DVX from the active bargraph, thereby showing the level on the touch panel, but not changing the value of the active bargraph which breaks the loop.
The attached code consists of an example main source code file and an example touch panel file. This example is for an AMX DVX-3256/5 and is setup to use the DVX as an audio preamp and amplifier for audio inputs (Bluetooth, etc). There are bargraph controls for EQ and volume. It is easily adapted for any model DVX.
.png)