Reply To: 'custom'?

Home Forums General Programming 'custom'? Reply To: 'custom'?

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

i remember seeing them used in the matrix panel you pointed
me to.

i have this randomizer that is a bit of a bodge, but works
if all modulators are on the designated tab. but i want to
get rid of the tab reference, and make each grouping of
modulators – here, envelopes – randomize by custom group name,
or custom modulator index group. i tried it but didn’t get it
to work for some reason, so i have been using this hack of what
i found in the matrix panel (which works fine as long as they’re
on the UItabs) – yes, it was pointed out to me that the iteration
is nonsensical 🙂 but i’ve been using it in the meantime. time to
tidy up.(nb: this is now ‘old’, so i might do it differently now)

randomPitchEG1_pt1=function()
-- randomize a group by custom index group

	-- This stops issues during panel bootup
	if panel:getRestoreState() or panel:getProgramState() then return end

	local randomGroup = panel:getModulator("randomPitch1pt1"):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")

			if tab =="tabs_Main_pt1" 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_Main_pt1" then

			rnd=math.random(-50,50) --value range to random
			modul:setModulatorValue(rnd,false,false,false) end
		end
	end
end

btw: it’s a bipolar pitch envelope and has 2 sets of value ranges,
hence arguments done twice. level has to be centred -50/+50,
whereas ‘time’ is 0-100.

  • This reply was modified 4 years, 8 months ago by human fly.
Ctrlr