Modifying an Bus Effect Filter Shape Menu

Post topics about HALion scripting.
Post Reply
rmjmusic
Junior Member
Posts: 51
Joined: Thu Jan 04, 2018 3:22 am
Contact:

Modifying an Bus Effect Filter Shape Menu

Post by rmjmusic »

Hi,

I'm attempting to modify the list in the Filter Shape Menu in the Morph filter. I feel like my code is pretty close but after I connect the parameter to a menu on the macro page I get the error "attempt to index a nil value"...Comparing it to other lists that work especially the Filter Type menu, I'm not sure what I'm doing wrong...any idea?

Code: Select all

-- define the filter types
defineSlotLocal("mffilterTypes")
mffilterTypes = {
				{ name = "HP6", 					  index = 1 },
				{ name = "HP12", 				  index = 2 },
				{ name = "HP18", 			  index = 3 },
				{ name = "HP24", 			  index = 4 },
			  }

-- create table with the names of the filter types
function getmfFilterTypeNames()
	mffilterTypeNames = {}
	for i=1, #mffilterTypes do
		mffilterTypeNames[i] = mffilterTypes[i].name
	end
end

getmfFilterTypeNames()

-- parameter change callbacks for the filter parameters
function onmfFilterTypeChanged()
	local morphFilter = this.parent:getBus(15):getEffect("Morph Filter")
	morphFilter:setParameter("typeFilterB", mffilterTypes[mfFilterType].index)
end

-- define parameters for the filter section
defineParameter("mfFilterType", 	  "mfFilter Type", 	 1, mffilterTypeNames, 	onmfFilterTypeChanged)
As always, Thanks!
Cubase Pro 10.5
Cubase Pro 10
HALioin 6
Windows 10 Pro 64bit
Mac OS 10.13.6

misohoza
Member
Posts: 955
Joined: Sun Oct 05, 2014 12:18 am
Contact:

Re: Modifying an Bus Effect Filter Shape Menu

Post by misohoza »

Most likely cause of the error is that it didn't find the bus. If the getBus() returns nil and you try to use the getEffect() it gives you error. Does the parent layer of the script module have 15 busses?

You can also use findEffects() without specifying the bus.

Code: Select all

this.parent:findEffects(true)[1]
Also the filter type parameter minimum value is 0 not 1. So you probably want to change your index values in your mffilterTypes table.

Apart from that the script should work fine.
Win 10 Home, 64 bit, 8 gb ram,
Cubase Pro 10.5, Wavelab Pro 9.5, Halion 6, Dorico 3,
NI Komplete 10 Ultimate, Ozone 7,
UR 44

rmjmusic
Junior Member
Posts: 51
Joined: Thu Jan 04, 2018 3:22 am
Contact:

Re: Modifying an Bus Effect Filter Shape Menu

Post by rmjmusic »

Thanks for your quick reply and your help! I finally got the script to work. And the "15" in the getBus(15) was a typo when I pasted in here. Originally when I was working the script it was "1". Either way, I omitted the getBus() function and just used the getEffect() as you recommended and it worked fine.

Thanks again!
Cubase Pro 10.5
Cubase Pro 10
HALioin 6
Windows 10 Pro 64bit
Mac OS 10.13.6

Post Reply

Return to “Halion Scripting”

Who is online

Users browsing this forum: No registered users and 1 guest