1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

Global Speed Control for all Groups

Discussion in 'Scripting Workshop' started by Echo_7, Mar 30, 2019.

  1. Echo_7

    Echo_7 NI Product Owner

    Messages:
    28
    Hi everyone. How can I set a global speed control that effects all groups? Also, do all the groups have to be in time machine pro mode, or a mode that shows a speed control?

    The code below doesn't work, but if I change the $ALL_GROUPS to 0 then it works properly, but just on group 1.

    on ui_control ($speedsld)
    set_engine_par($ENGINE_PAR_SPEED, $speedsld, $ALL_GROUPS, -1, -1)
    end on

    As always thanks!
     
  2. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    You would need to use a while loop and instead of $ALL_GROUPS use the loop counter.

    $ALL_GROUPS is mostly only used with purge_group(), you cannot use it with get/set_engine_par.
     
  3. Echo_7

    Echo_7 NI Product Owner

    Messages:
    28
    What does the while loop have to contain?

    while ($counter < $numgroups)

    inc ($counter)
    end while
     
  4. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    That set_engine_par() line from your first post, but with counter instead of $ALL_GROUPS.
     
  5. Echo_7

    Echo_7 NI Product Owner

    Messages:
    28
    When I do that with the while statement above, it doesn't work. My speed slider doesn't seem to effect anything.
     
  6. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Works fine here.

    Code:
    on ui_control ($speedsld)
        $count := 0
        while ($count < $NUM_GROUPS)
            set_engine_par($ENGINE_PAR_SPEED, $speedsld, $count, -1, -1)
            inc($count)
        end while
    end on
     
  7. Echo_7

    Echo_7 NI Product Owner

    Messages:
    28
    Gotcha thanks! I wasn't putting the set_engine_par within the while statement. Still new to this. Thanks for being so helpful!