Feedback on an indexed Menu

Post topics about HALion scripting.
Post Reply
FedericoS
New Member
Posts: 15
Joined: Fri Jan 03, 2020 5:40 pm
Contact:

Feedback on an indexed Menu

Post by FedericoS »

Hello, starting by Anima filter index script menu, I created an indexed menu with "filter shape" selector for my zone destinations (Synth Zone, Wavetable, Sampler... and GENERAL to apply it on all).
On my macro page I have one of this single menu for zone. To apply the same shape to all zones I named it GENERAL menu (I used @type way to do that). It work fine in practical, but not so well regarding the visual return of information, because if for example if I change value from GENERAL menu, the value does not change on the singles zones menu displays... So, is there any way to update the value of an index?

Hope someone can help me :)
Thanks

AposMus
Member
Posts: 230
Joined: Fri Nov 14, 2014 11:41 am
Contact:

Re: Feedback on an indexed Menu

Post by AposMus »

If the filter shape for individual zones is being set via a script, instead of connecting to the zones' filter shape parameter directly, you are probably have to update the values via getParameter() in your 'General' menu's callback function. Or by setting the other menus to the same value as the General menu, by script.

This is just a general example approach of how it could be done.

Code: Select all

synthZone = this.parent:findZones(true, 'yourZoneName')[1]

generalMenuItems ={
	'item 1',
	'item 2',
	'item 3',
	'item 4',
}

filtShapeMenu = {
	'shape 1',
	'shape 2',
	'shape 3',
	'shape 4',
}

function onGeneralMenu()
	local zones = this.parent:findZones(true)
	for i, zone in ipairs(zones) do
		zone:setParameter('Filter.ShapeA', GeneralMenu)
	end
	SynthZoneFiltShape = GeneralMenu -- set your individual parameters to the 'general' shape 
end

function onSynthZoneFiltShape()
	synthZone:setParameter('Filter.ShapeA', SynthZoneFiltShape)
end


defineParameter('GeneralMenu', nil, 1, generalMenuItems, onGeneralMenu)
defineParameter('SynthZoneFiltShape', nil, 1, filtShapeMenu, onSynthZoneFiltShape)
Cubase Pro 8.5.2
Halion 6
HSO
Padshop Pro
Dark Planet

FedericoS
New Member
Posts: 15
Joined: Fri Jan 03, 2020 5:40 pm
Contact:

Re: Feedback on an indexed Menu

Post by FedericoS »

Hey AposMus, many thanks for your feedback. Your script is very interesting and works changing the visual value of the "single" destination, but it does not allow to change the parameter from the "single" destination but only from "general". If I try to do it, it give me an error message.

This is a similar example of my situation, where I can select a different kind of filter shape from "general", "Osc Zone" and "Wavetable"
Hope it can describe better my situation.

Code: Select all

-- FILTER SHAPE SELECTION GENERAL

zone=this.parent:getZone()

filterShapes={
  {name="LP24",   index=0},
  {name="LP12",   index=2},
  {name="BP12",   index=4},
  {name="BP24",   index=5},
  {name="HP24",   index=10},
  {name="HP12",   index=12},
}

function getFilterShapeNames()
  filterShapeNames={}
  for i=1,#filterShapes do
    filterShapeNames[i]=filterShapes[i].name
  end
end

getFilterShapeNames()

-- keep track of last applied parameter values
last = {}

function filterShapeChanged()
  setParameterOfZones("Filter.ShapeA",filterShapes[FilterShape].index)
end

defineParameter("FilterShape",nil,1,filterShapeNames,filterShapeChanged)




-- FILTER SHAPE SELECTION OSCs

defineSlotLocal("Filter.ShapeA")

filterShapesOSCs={
  {name="LP24",   index=0},
  {name="LP12",   index=2},
  {name="BP12",   index=4},
  {name="BP24",   index=5},
  {name="HP24",   index=10},
  {name="HP12",   index=12},
}

function getFilterShapeOSCsNames()
  filterShapeOSCsNames={}
  for i=1,#filterShapesOSCs do
    filterShapeOSCsNames[i]=filterShapesOSCs[i].name
  end
end

getFilterShapeOSCsNames()

-- keep track of last applied parameter values
last = {}

function filterShapeOSCsChanged()
  this.parent:getZone("Synth Zone"):setParameter("Filter.ShapeA",filterShapesOSCs[FilterShapeOSCs].index)
end

defineParameter("FilterShapeOSCs",nil,1,filterShapeOSCsNames,filterShapeOSCsChanged)





-- FILTER SHAPE SELECTION WAVE

defineSlotLocal("Filter.ShapeA")

filterShapesWA={
  {name="LP24",   index=0},
  {name="LP12",   index=2},
  {name="BP12",   index=4},
  {name="BP24",   index=5},
  {name="HP24",   index=10},
  {name="HP12",   index=12},
}

function getFilterShapeWANames()
  filterShapeWANames={}
  for i=1,#filterShapesWA do
    filterShapeWANames[i]=filterShapesWA[i].name
  end
end

getFilterShapeWANames()

-- keep track of last applied parameter values
last = {}

function filterShapeWAChanged()
  this.parent:getZone("Wavetable"):setParameter("Filter.ShapeA",filterShapesWA[FilterShapeWA].index)
end

defineParameter("FilterShapeWA",nil,1,filterShapeWANames,filterShapeWAChanged)


AposMus
Member
Posts: 230
Joined: Fri Nov 14, 2014 11:41 am
Contact:

Re: Feedback on an indexed Menu

Post by AposMus »

The script I wrote seems to work fine on my end.

I took yours and made some adjustments:
You only need to declare the shape array once, then you can reuse it.
The error that was thrown was an undeclared function -- setParameterOfZones() --

I tried this out and it worked:
If it doesn't work on your side, you might have to check your program structure and parameter connections.
Your filter shape menus from the macro page should be connected to the script parameters and not the zone parameters for example.

Code: Select all

filterShapes={
  {name="LP24",   index=0},
  {name="LP12",   index=2},
  {name="BP12",   index=4},
  {name="BP24",   index=5},
  {name="HP24",   index=10},
  {name="HP12",   index=12},
}

function getFilterShapeNames()
  filterShapeNames={}
  for i=1,#filterShapes do
    filterShapeNames[i]=filterShapes[i].name
  end
end

getFilterShapeNames()

last = {}

function filterShapeChanged()
  this:setParameter('FilterShapeOSCs', FilterShape)
  this:setParameter('FilterShapeWA', FilterShape)
end

defineParameter("FilterShape",nil,1,filterShapeNames,filterShapeChanged)

function filterShapeOSCsChanged()
  this.parent:getZone("Synth Zone"):setParameter("Filter.ShapeA",filterShapes[FilterShapeOSCs].index)
end

defineParameter("FilterShapeOSCs",nil,1,filterShapeNames,filterShapeOSCsChanged)

function filterShapeWAChanged()
  this.parent:getZone("Wavetable"):setParameter("Filter.ShapeA",filterShapes[FilterShapeWA].index)
end

defineParameter("FilterShapeWA",nil,1,filterShapeNames,filterShapeWAChanged)
Cubase Pro 8.5.2
Halion 6
HSO
Padshop Pro
Dark Planet

FedericoS
New Member
Posts: 15
Joined: Fri Jan 03, 2020 5:40 pm
Contact:

Re: Feedback on an indexed Menu

Post by FedericoS »

Great AposMus, thanks so much, it works! whow
Many thanks for your precious support.

Post Reply

Return to “Halion Scripting”

Who is online

Users browsing this forum: No registered users and 1 guest