Home AMX User Forum AMX General Discussion
Options

embarrassing

Ok - no such thing as a dumb question but...

What is the trick to converting a FLOAT to Integer? I need to convert a level conversion value which is is returning 4 decimal accuracy but need only the integer value to send the the Autopatch router.

Define_Variable
FLOAT Vol
FLOAT Vol2

Define_Event
...
Vol2 = ((Vol / 3.1875) -70)
Vol3 = (Vol2*10)
SEND_STRING dvAswitch, "'CO9VA',ItoA(vol3),'T'"

I am feeling really dumb right now - and it's really late!.

Thanks for not snickering (out loud!)

Comments

  • Options
    Spire_JeffSpire_Jeff Posts: 1,917
    It's late here, and I've been playing with Java for the past few days, but I think you can just make vol2 an INTEGER instead of FLOAT and it should work.

    You might need to do a TYPE_CAST() to avoid compiler warnings.

    Jeff
  • Options
    a_riot42a_riot42 Posts: 1,624
    PyroGuy wrote:
    Ok - no such thing as a dumb question but...

    What is the trick to converting a FLOAT to Integer? I need to convert a level conversion value which is is returning 4 decimal accuracy but need only the integer value to send the the Autopatch router.

    Define_Variable
    FLOAT Vol
    FLOAT Vol2

    Define_Event
    ...
    Vol2 = ((Vol / 3.1875) -70)
    Vol3 = (Vol2*10)
    SEND_STRING dvAswitch, "'CO9VA',ItoA(vol3),'T'"

    I am feeling really dumb right now - and it's really late!.

    Thanks for not snickering (out loud!)

    (silently snickering)
    Why are you doing this? If its an Autopatch switch then you shouldn't need to do any volume arithmetic at all as it is done in the module.
    Paul
  • Options
    Spire_JeffSpire_Jeff Posts: 1,917
    My guess would be because the Autopatch module is not very functional (at least the last time I tried it). I wrote my own module for the Autopatch PrecisLT because the one available was lacking most of the functionality I needed.

    Jeff
  • Options
    a_riot42a_riot42 Posts: 1,624
    Spire_Jeff wrote:
    My guess would be because the Autopatch module is not very functional (at least the last time I tried it). I wrote my own module for the Autopatch PrecisLT because the one available was lacking most of the functionality I needed.

    Jeff

    Interesting. I am using the autopatch module right now and the only thing it is missing is the eq stuff that should get added sometime soon. So far it has worked really well, so I am not sure why you would need to rebuild it. All the volume arithmetic is done for me so that my volume feedback has a level in the range of 0-255 and I just send it the level.value of the virtual output volume.
    Paul
  • Options
    PyroGuyPyroGuy Posts: 121
    I'm not using the module - the switching that is being done is very simple so sending a BCS command was easier. Also - I haven't looked at the module but if it is written for a modero panel, I have a lot of reworking to do as this project is using some G3s. (I discovered THAT treat when I started playing with the Sharp projector module. As a newbie to modules, THAT was a treat in itself - remapping the address codes for buttons and feedback!

    The command requires a value which was being created when converting from a level (0-255) to a db value for the switcher (Vol / 3.1875) -70) which was something I learned from a previous post. (AP ranges from -70db to +10db)

    Some subsequent playing around seems to indicate that the Autopatch could care less about the decimal value and it seems to work as I have it coded...

    Vol2 = ((Vol / 3.1875) -70)
    Vol3 = (Vol2*10)
    SEND_STRING dvAswitch, "'CO9VA',ItoA(vol3),'T'"

    Go figure - but it's nice to think you are wrong and find out that it works anyway!

    Cheers!
Sign In or Register to comment.