Home AMX User Forum NetLinx Studio
Options

absolute values vs relative values

I have a customer that wants an active bargraph to control volume, they want to slide with their finger. They are using Clearone 1212A's for their audio control. That part is easy. The problem I am having, the engineer that is setting up the room does not want to use absolute values when it comes to controlling the gain. Instead, he wants to give them a "midpoint" and give them 20 steps down and 10 steps up, increasing or decreasing by 1db. I created a LEVEL.EVENT and grabbed the LEVEL.VALUE for the bargraph. I need to know if the bargraph value is increasing or decreasing. If LEVEL.VALUE is getting higher, then continue increasing the volume by 1. If it is getting lower, then continue decreasing the volume by 1. I am currently comparing the old value against the new value, but that is causing funky results. Am I making this harder than it needs to be?

Comments

  • Options
    ericmedleyericmedley Posts: 4,177
    I have a customer that wants an active bargraph to control volume, they want to slide with their finger. They are using Clearone 1212A's for their audio control. That part is easy. The problem I am having, the engineer that is setting up the room does not want to use absolute values when it comes to controlling the gain. Instead, he wants to give them a "midpoint" and give them 20 steps down and 10 steps up, increasing or decreasing by 1db. I created a LEVEL.EVENT and grabbed the LEVEL.VALUE for the bargraph. I need to know if the bargraph value is increasing or decreasing. If LEVEL.VALUE is getting higher, then continue increasing the volume by 1. If it is getting lower, then continue decreasing the volume by 1. I am currently comparing the old value against the new value, but that is causing funky results. Am I making this harder than it needs to be?

    you could trap the value and do a comparison to the last known state.

    something like.

    if(level_real > level_temp)
    {
    //do something special
    level_real = level_temp

    }

    if(level_real < level_temp)
    {
    //do something else special
    level_real = level_temp

    }
  • Options
    I thought about it more on the car ride home and figured out part of my problem. I am comparing two numbers and if the new number is less than the old number, decrease the volume by 1 and vice versa. That works fine when using up and down buttons and I can add or subtract from LEVEL.VALUE by 1 with each button press. If LEVEL.VALUE = 28 and the users touch the bargraph changing LEVEL.VAULE to 2, the way my code is written, 2 < 28, so the command sent to the Converge is to lower the volume by 1, when really it needs to lower the volume by 26 relative to it's current setting. So I need to compare the 2 numbers, subtract one from the other and either add or subtract that amount. I'm done for the evening. I have a 6 pack of Bud Light in the fridge, and dinner on the table, work is the last thing on my mind right now.
  • Options
    I've got it (I think)!!!! if I always subtract new - old, then I don't need to do a comparison of the numbers. if the new value is 1 and the old value was 30, 1 - 30 = -29. So I would send the string to the Converge telling it to change the GAIN -29 relative to the current value. Whereas if the new number is 25 and the old number was 5, 25 - 5 = 20. That would change the GAIN +20 relative to the current position. I'll give that a shot tomorrow when I get to work. Hopefully that solves my problems.
  • Options
    ColzieColzie Posts: 470
    I've got it (I think)!!!! if I always subtract new - old, then I don't need to do a comparison of the numbers. if the new value is 1 and the old value was 30, 1 - 30 = -29. So I would send the string to the Converge telling it to change the GAIN -29 relative to the current value. Whereas if the new number is 25 and the old number was 5, 25 - 5 = 20. That would change the GAIN +20 relative to the current position. I'll give that a shot tomorrow when I get to work. Hopefully that solves my problems.

    The amazing power of the 6-pack in action.... ;)
  • Options
    DHawthorneDHawthorne Posts: 4,584
    Colzie wrote: »
    The amazing power of the 6-pack in action.... ;)

    I was just reading an article the other day (sadly, I forget where, someplace on the Cloud) about how counter-productive it is for programmers to work too hard. It's essentially creative work, and the more hours you put into something in a single setting, the more likely you are to get caught up in cold logic ... which tends to create a tunnel vision that may prevent you from seeing a better solution. It's fine for troubleshooting, but creating a project or figuring out a "best way" to do something is far better approached when you are relaxed and fresh and thinking outside the lines that logic tends to lay down.
  • Options
    ericmedleyericmedley Posts: 4,177
    DHawthorne wrote: »
    I was just reading an article the other day (sadly, I forget where, someplace on the Cloud) about how counter-productive it is for programmers to work too hard. It's essentially creative work, and the more hours you put into something in a single setting, the more likely you are to get caught up in cold logic ... which tends to create a tunnel vision that may prevent you from seeing a better solution. It's fine for troubleshooting, but creating a project or figuring out a "best way" to do something is far better approached when you are relaxed and fresh and thinking outside the lines that logic tends to lay down.

    In my case, you assume my programming is creative. :D
  • Options
    jweatherjweather Posts: 320
    DHawthorne wrote: »
    I was just reading an article the other day (sadly, I forget where, someplace on the Cloud) about how counter-productive it is for programmers to work too hard. It's essentially creative work, and the more hours you put into something in a single setting, the more likely you are to get caught up in cold logic ... which tends to create a tunnel vision that may prevent you from seeing a better solution. It's fine for troubleshooting, but creating a project or figuring out a "best way" to do something is far better approached when you are relaxed and fresh and thinking outside the lines that logic tends to lay down.

    Depends on what you mean by "too hard". I'm not sure programming requires the same kind of creativity as other pursuits (I don't consider myself a creative person at all), but certain tasks seem to require a kind of mental energy that I don't have all the time. Other things (documentation and drawings, especially) can be done at practically any time, including during the post-lunchtime brain freeze.
  • Options
    to steal a quote from Bruce Lee, programming is "like a finger pointing to the moon. don't concentrate on the finger or you will miss all of the heavenly glory." that sounds deep anyway. really that means I am watching "enter the dragon" right now. that movie is just full of good Bruce Lee quotes.
Sign In or Register to comment.