display value as time

Home Forums General Programming display value as time

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #72730
    goodlucknow
    Participant
      • Topics: 4
      • Replies: 7
      • Total: 11

      new to ctrlr here.
      what i’m looking to do is have a uiImageSlider display a value as time.
      it’s sending midi values of 0-127, and i have it mapped to a reverb decay time of say, 1.5 seconds up to 5 seconds, is it possible to display the time with increments of 0.1 or 0.01?
      if so can anyone point me in the right direction, or link to some relevant threads/examples? is it possible in the component value display or do i need to use a UI label & modulators? would this kind of thing require knowledge of Lua?
      thanks

      #72735
      goodweather
      Participant
        • Topics: 45
        • Replies: 550
        • Total: 595
        • ★★★

        Hi,
        I checked but I’m afraid you are obliged to use a uiLabel and adapt it based on the value of the uiSlider.
        So, use of Lua and only one method that is set in the uiSlider property “Called when the modulator value changes”

        Here is a simple code (I tested it and it works fine):

        --
        -- Called when a modulator value changes
        -- @mod   http://ctrlr.org/api/class_ctrlr_modulator.html
        -- @value    new numeric value of the modulator
        --
        myNewMethod = function(--[[ CtrlrModulator --]] mod, --[[ number --]] value, --[[ number --]] source)
        
        	tData = {0, 0.1, 0.2, 0.3, 0.4, 0.525, 0.550, 0.575, 0.6}
        
        	panel:getModulatorByName("modulator-2"):getComponent():setPropertyString("uiLabelText", tostring(tData[value+1]))
        
        end
        #72737
        goodlucknow
        Participant
          • Topics: 4
          • Replies: 7
          • Total: 11

          Thank you so much! I will try this out this evening, appreciate your help!

        Viewing 3 posts - 1 through 3 (of 3 total)
        • The forum ‘Programming’ is closed to new topics and replies.
        There is currently 0 users and 71 guests online
        No users are currently active
        Forum Statistics
        Threads: 2,495, Posts: 17,374, Members: 77,605
        Most users ever online was 12 on January 22, 2019 3:47 pm
        Ctrlr