Home › Forums › General › Programming › randomize by CustomGroup?
Tagged: group random, presets
- This topic has 3 replies, 1 voice, and was last updated 6 years, 11 months ago by human fly.
-
AuthorPosts
-
June 4, 2017 at 10:24 am #72266
ok, i can get modulators by uiGroup for collective
randomization, bu ti want to try to do it:
by modulatorCustomNameGroup,or maybe:
by modulatorCustomIndexGroupdoes 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
June 4, 2017 at 10:47 am #72267HOKEY-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/5n8qot5bseby3h776up86x95pldn6ocrJune 4, 2017 at 11:57 am #72271updated 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.June 6, 2017 at 10:13 am #72292latest 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)
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.