randomize by CustomGroup?

Home Forums General Programming randomize by CustomGroup?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #72266
    human fly
    Participant
      • Topics: 124
      • Replies: 1070
      • Total: 1194
      • ★★★★

      ok, i can get modulators by uiGroup for collective
      randomization, bu ti want to try to do it:
      by modulatorCustomNameGroup,

      or maybe:
      by modulatorCustomIndexGroup

      does anyone know how this is done?

      here’s where i’m up to:
      (this is the uiGroup, working version, with rens for
      what i’ve tried but doesn’t work, hope this comes out
      ok in the post)

      randomGroup=function()
      -- randomize a group by custom index group
      
      	-- This stops issues during panel bootup
      	if panel:getRestoreState() or panel:getProgramState() then return end
      
      	randomGroup = panel:getModulator("randomGroup"):getValue()
      
      -- random seeder
      	local t=os.time()
      	local c=os.clock()
      	math.randomseed(t*c)
      	--math.randomseed(Time.getMillisecondCounterHiRes())
      
      	if randomGroup~=nil then
      
      -- custom group items to randomize
      
      		for k=1,4 do
      
      		modul	=panel:getModulatorWithProperty("modulatorCustomIndex",k)
      		group=modul:getComponent():getProperty("componentTabName")
      		--group	=panel:getModulatorWithProperty("modulatorCustomNameGroup",1)
      
      			--if group=="custom_pitchEG"
      			if group=="tabs_Envelopes"
      			then
      
      			rnd=math.random(0,100) --value range to random
      			modul:setModulatorValue(rnd,false,false,false)
      			end
      		end
      	end
      end
      #72267
      human fly
      Participant
        • Topics: 124
        • Replies: 1070
        • Total: 1194
        • ★★★★

        HOKEY-DOKEY :o) found a cool workaround (but i’d still
        like to know how to do it the other ways).

        i can of course do it all within the same uiTab ‘group’,
        but i just have to specify the index range,
        ie: if index items are 1 to 9, i can get 1 to 4 to do
        one ‘if then’, and 5 to 9 to do another.

        so, in the present case, as i have ‘time’ params with
        range (0,100) and level params as (-50,50) i just treat
        them separately, do the if…then twice, and it works
        great. so you could have *all* params on a uitabs, across
        all the existing tabs, and treat them all in separate
        groups. this is what’s working:

        randomGroup=function()
        -- randomize a group by custom index group
        
        	-- This stops issues during panel bootup
        	if panel:getRestoreState() or panel:getProgramState() then return end
        
        	randomGroup = panel:getModulator("randomGroup"):getValue()
        
        -- random seeder
        	local t=os.time()
        	local c=os.clock()
        	math.randomseed(t*c)
        	--math.randomseed(Time.getMillisecondCounterHiRes())
        
        	if randomGroup~=nil then
        
        -- custom group items to randomize
        		for k=1,4 do
        
        		modul	=panel:getModulatorWithProperty("modulatorCustomIndex",k)
        		tab		=modul:getComponent():getProperty("componentTabName")
        		--group	=panel:getModulatorWithProperty("modulatorCustomNameGroup",1)
        		--if group=="custom_pitchEG"
        
        			if tab =="tabs_Envelopes" then
        
        			rnd=math.random(0,100) --value range to random
        			modul:setModulatorValue(rnd,false,false,false) end
        		end
        
        		for k=5,9 do
        
        		modul	=panel:getModulatorWithProperty("modulatorCustomIndex",k)
        		tab		=modul:getComponent():getProperty("componentTabName")
        
        			if tab =="tabs_Envelopes" then
        
        			rnd=math.random(-50,50) --value range to random
        			modul:setModulatorValue(rnd,false,false,false) end
        		end
        
        	end
        end

        great isn’t it, that you can sleep on a problem and
        wake up and suss it out in a few minutes with a fresh
        mind. (chuffed) 🙂
        (soz for the mega indents, it came out like that)

        edit: drafted a quick demo for clicky fun (4.8mb zip/win64)
        https://app.box.com/s/5n8qot5bseby3h776up86x95pldn6ocr

        • This reply was modified 6 years, 10 months ago by human fly.
        • This reply was modified 6 years, 10 months ago by human fly.
        #72271
        human fly
        Participant
          • Topics: 124
          • Replies: 1070
          • Total: 1194
          • ★★★★

          updated file, same link. all three graphic EGs can now
          randomize. so that confirms that you treat the whole
          uiTabs as a customgroup, and then refer to ranges of
          the index. works great, looks pretty nice. very happy.
          (and was quite easy)

          nb: for some reason, first run is a bit weird here,
          and either shows a popup, or the random doesn’t
          respond(?) so just close it and re-run.

          #72292
          human fly
          Participant
            • Topics: 124
            • Replies: 1070
            • Total: 1194
            • ★★★★

            latest on this: we now have random and reset to
            anything we want. starting to look usable, imo.
            single window display, called by tab or rand/reset buttons.
            hey, i’m getting into this 🙂
            win64 only. soz, i will upload bpanelz when it’s
            tidied up.

            https://app.box.com/s/uhnvjnde7cawsom9u1bzyiyr19gqq23q

            (zip>exe win64)

          Viewing 4 posts - 1 through 4 (of 4 total)
          • The forum ‘Programming’ is closed to new topics and replies.
          There is currently 0 users and 67 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