Component
Component objects allow access to Named Components in the design. Create a Named Component by typing a unique, non-default name in any component block.
Methods
Create a Named Component reference in your script.
Syntax
Component.New("named_component")
Example
In this example, we have two Named Components in a design, "gain a" and "gain b". We are watching the gain of "gain a" and muting "gain b" if "gain a" goes above 0 dB.
gainA = Component.New("gain a")
gainB = Component.New("gain b")
gainA.gain.EventHandler = function( ctl )
if gainA.gain.Value > 0 then
gainB.mute.Boolean = true
else
gainB.mute.Boolean = false
end
end
Returns a table of all Named Components in the design and their properties.
Syntax
Component.GetComponents()
Examples
In this example, we have a Gain component named MyGain in the design.
Components = {} --Create a table called Components
DebugOutput = "" --Build string to be displayed in the Debug Output window
Components = Component.GetComponents() --Set Components table equal to the table returned by Component.GetComponents()
--Loop through all table entries in the Components table to display their values--------------------------
for _,v1 in ipairs(Components) do
DebugOutput = "\nName: "..v1.Name --Add the component name to the DebugOutput string
DebugOutput = DebugOutput.."\nType: "..v1.Type --Add the component type to the DebugOutput string
DebugOutput = DebugOutput.."\nProperties:" --Add Properties text to the DebugOutput string
for _,v2 in ipairs(v1.Properties) do --Add the list of properties to the DebugOutput string
for k3,v3 in pairs(v2) do
DebugOutput = DebugOutput.."\n "..k3.." = "..v3
end
DebugOutput = DebugOutput.."\n"
end
print (DebugOutput) --Print the DebugOutput string
end
Debug Output
2021-01-04T16:27:53.786 Name: MyGain Type: gain Properties: Name = max_gain Value = 20 PrettyName = Max Gain (dB) Name = min_gain Value = -100 PrettyName = Min Gain (dB) Name = enable_stepper Value = False PrettyName = Enable Ramp Controls Name = step_mode Value = 0 PrettyName = Mode Name = num_steps Value = 8 PrettyName = Number of Steps Name = multi_channel_type Value = 1 PrettyName = Type Name = multi_channel_count Value = 8 PrettyName = Count
comps = Component.GetComponents()
-- iterate components
for _,comp in pairs(comps) do
print(string.format("Component '%s' of Type '%s'", comp.Name, comp.Type))
-- iterate properties
print("---- Properties")
for _,prop in pairs(comp.Properties) do
print(string.format(" %s ( %s ) : %s", prop.PrettyName, prop.Name, prop.Value))
end
end
Returns a table of all controls in the specified Named Component.
Note: You can also use Tools > View Component Controls Info to see a list of all controls for a selected component, including a named component. See Viewing Component Control Information.
Syntax
Component.GetControls("named_component")
Examples
In this example, we have a Blinking LED component named "led". We want to obtain a list of all its controls and their properties.
blinker = Component.New("led")
b_ctrls = Component.GetControls(blinker)
print("Component GetControls: ")
for _,b_element in ipairs(b_ctrls) do
print("Name: "..tostring(b_element.Name))
print(".\tValue: "..tostring(b_element.Value))
print(".\tString: "..tostring(b_element.String))
print(".\tPosition: "..tostring(b_element.Position))
print(".\tType: "..tostring(b_element.Type))
print(".\tDirection: "..tostring(b_element.Direction))
print(".\tMinValue: "..tostring(b_element.MinValue))
print(".\tMaxValue: "..tostring(b_element.MaxValue))
print(".\tMinString: "..tostring(b_element.MinString))
print(".\tMaxString: "..tostring(b_element.MaxString))
end
Note: b_element.Boolean
, RampTime
, and Index
are omitted from the request since they do not apply in this context.
Debug Output
2019-10-28T18:48:10.938Starting Script 2019-10-28T18:48:10.938Component GetControls: 2019-10-28T18:48:10.938Name: blink 2019-10-28T18:48:10.939. Value: true 2019-10-28T18:48:10.939. String: true 2019-10-28T18:48:10.939. Position: 1.0 2019-10-28T18:48:10.939. Type: Boolean 2019-10-28T18:48:10.939. Direction: Read Only 2019-10-28T18:48:10.939. MinValue: 0.0 2019-10-28T18:48:10.939. MaxValue: 1.0 2019-10-28T18:48:10.939. MinString: false 2019-10-28T18:48:10.939. MaxString: true 2019-10-28T18:48:10.939Name: duty.cycle 2019-10-28T18:48:10.939. Value: 50.0 2019-10-28T18:48:10.939. String: 50.0% 2019-10-28T18:48:10.939. Position: 0.5 2019-10-28T18:48:10.939. Type: Float 2019-10-28T18:48:10.939. Direction: Read/Write 2019-10-28T18:48:10.939. MinValue: 10.0 2019-10-28T18:48:10.939. MaxValue: 90.0 2019-10-28T18:48:10.939. MinString: 10.0% 2019-10-28T18:48:10.939. MaxString: 90.0% 2019-10-28T18:48:10.939Name: enable 2019-10-28T18:48:10.939. Value: true 2019-10-28T18:48:10.939. String: enabled 2019-10-28T18:48:10.939. Position: 1.0 2019-10-28T18:48:10.939. Type: Boolean 2019-10-28T18:48:10.939. Direction: Read/Write 2019-10-28T18:48:10.939. MinValue: 0.0 2019-10-28T18:48:10.939. MaxValue: 1.0 2019-10-28T18:48:10.939. MinString: disabled 2019-10-28T18:48:10.939. MaxString: enabled 2019-10-28T18:48:10.939Name: random 2019-10-28T18:48:10.939. Value: false 2019-10-28T18:48:10.939. String: disabled 2019-10-28T18:48:10.939. Position: 0.0 2019-10-28T18:48:10.939. Type: Boolean 2019-10-28T18:48:10.939. Direction: Read/Write 2019-10-28T18:48:10.939. MinValue: 0.0 2019-10-28T18:48:10.939. MaxValue: 1.0 2019-10-28T18:48:10.939. MinString: disabled 2019-10-28T18:48:10.939. MaxString: enabled 2019-10-28T18:48:10.939Name: time 2019-10-28T18:48:10.939. Value: 10.0 2019-10-28T18:48:10.939. String: 10.0s 2019-10-28T18:48:10.939. Position: 1.0 2019-10-28T18:48:10.939. Type: Float 2019-10-28T18:48:10.939. Direction: Read/Write 2019-10-28T18:48:10.939. MinValue: 0.1 2019-10-28T18:48:10.939. MaxValue: 10.0 2019-10-28T18:48:10.939. MinString: 100ms 2019-10-28T18:48:10.939. MaxString: 10.0s
Code Name / Script Access
Q-SYS will automatically assign any added component a unique name for external control and scripting control purposes. The Code Name and Script Access can be set in the Properties for any component.
The Code name will also display over the top-left of a component when selected, or hovering over with the pointer.
Note: This function takes the place of Named Components. While it is not expected to affect existing designs, it is possible that adjustments may be needed to some scripts and/or Code Names.
Script Access Properties
Property | Function | Choices |
---|---|---|
Code Name |
Displays the currently assign name for control access. This may be customized. Q-SYS will automatically check all Code Names in the design to ensure name is unique. |
Automatic User Defined |
Script Access |
Defines whether the component will be accessible by script and/or externally, or not at all. |
All External None Script
|