Default values of the default macro/connect parameters?

Hi.

Here is an example for you. Anima uses only a subset of the filter types. Legacy filter types like HALion 3 or Waldorf are not used.

Below, you find script code how to do this. I copied this code from the “Anima” script module.

-- define the filter types
defineSlotLocal("filterTypes")
filterTypes = {
				{ name = "Tube", 					  index = 2 },
				{ name = "Hard Clip", 				  index = 3 },
				{ name = "Bit Reduction", 			  index = 4 },
				{ name = "Rate Reduction", 			  index = 5 },
				{ name = "Rate Reduction Key Follow",      index = 6 },
  		     }

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

-- parameter change callback
function onFilterTypeChanged()
    this.parent:getZone():setParameter("Filter.Type", filterTypes[FilterType].index)
end

-- define parameters for the filter section
defineParameter("FilterType", 	  "Filter Type", 	 1, filterTypeNames, onFilterTypeChanged)

Here is the basic idea behind this:

  • filterTypes is an array that contains one table for each filter type. Each of these tables has the keys name and index with the desired values.
  • The function getFilterTypeNames creates the table “filterTypeNames” by reading the names from the filterTypes table. filterTypeNames is used as the strings table in defineParameter.
  • The change callback “onFilterTypeChanged” uses setParameter. The correct value is read from the index field of the filterTypes table.

This might look complicated, but the advantage is that if you change the table filterTypes, the rest of your code will still work.

Cheers,

Matthias