public class DynamicControl extends java.lang.Object implements ScheduledEventListener
DynamicControl
determines message interconnection,
DynamicControls also have an attribute called ControlScope
, which dictates how far (in
a topological sense) the object can reach in order to communicate with other
DynamicControls. DynamicControls can be bound to different objects, the default being the class that instantiated it.
DynamicControlParent
abstractionsModifier and Type | Class and Description |
---|---|
static interface |
DynamicControl.ControlScopeChangedListener |
static class |
DynamicControl.DISPLAY_TYPE
Define how we want the object displayed in the plugin
|
static interface |
DynamicControl.DynamicControlListener
Create an Interface to listen to
|
static class |
DynamicControl.NETWORK_TRANSMIT_MESSAGE_ARGS |
Constructor and Description |
---|
DynamicControl(ControlType control_type,
java.lang.String name)
A dynamic control that can be accessed from outside this sketch
it is created with the sketch object that contains it along with the type
|
DynamicControl(ControlType control_type,
java.lang.String name,
java.lang.Object initial_value)
A dynamic control that can be accessed from outside this sketch
it is created with the sketch object that contains it along with the type
|
DynamicControl(ControlType control_type,
java.lang.String name,
java.lang.Object initial_value,
java.lang.Object min_value,
java.lang.Object max_value)
A dynamic control that can be accessed from outside
it is created with the sketch object that contains it along with the type
|
DynamicControl(java.lang.Object parent_sketch,
ControlType control_type,
java.lang.String name)
A dynamic control that can be accessed from outside this sketch
it is created with the sketch object that contains it along with the type
|
DynamicControl(java.lang.Object parent_sketch,
ControlType control_type,
java.lang.String name,
java.lang.Object initial_value)
A dynamic control that can be accessed from outside this sketch
it is created with the sketch object that contains it along with the type
|
DynamicControl(java.lang.Object parent_sketch,
ControlType control_type,
java.lang.String name,
java.lang.Object initial_value,
java.lang.Object min_value,
java.lang.Object max_value)
A dynamic control that can be accessed from outside
it is created with the sketch object that contains it along with the type
|
DynamicControl(java.lang.Object parent_sketch,
ControlType control_type,
java.lang.String name,
java.lang.Object initial_value,
java.lang.Object min_value,
java.lang.Object max_value,
DynamicControl.DISPLAY_TYPE display_type)
A dynamic control that can be accessed from outside
it is created with the sketch object that contains it along with the type
|
DynamicControl(de.sciss.net.OSCMessage msg)
Create a DynamicControl based on OSC Message.
|
DynamicControl(java.lang.String name,
java.lang.Object initial_value)
A dynamic control that can be accessed from outside this sketch
it is created with the sketch object that contains it along with the type
|
Modifier and Type | Method and Description |
---|---|
DynamicControl |
addControlListener(DynamicControl.DynamicControlListener listener)
Register Listener to receive changed values in the control
|
DynamicControl |
addControlScopeListener(DynamicControl.ControlScopeChangedListener listener)
Register Listener to receive changed values in the control scope
|
DynamicControl |
addGlobalControlListener(DynamicControl.DynamicControlListener listener)
Register Listener to receive changed values in the control that need to be global type messages
|
void |
addTargetDevice(java.net.InetAddress... inetAddresses)
Add one or more device
InetAddress for use in ControlScope.TARGET Message |
void |
addTargetDevice(java.lang.String... deviceNames)
Add one or more device names or addresses as strings to use in
ControlScope.TARGET Message |
DynamicControl |
addValueSetListener(DynamicControl.DynamicControlListener listener)
Register Listener to receive changed values in the control that need to be received when value is specifically set from
Within sketch
|
de.sciss.net.OSCMessage |
buildCreateMessage()
Build the OSC Message for a create message
|
static de.sciss.net.OSCMessage |
buildDeviceNameMessage()
Build OSC Message that gives our device name
|
static de.sciss.net.OSCMessage |
buildDeviceRequestNameMessage()
Build OSC Message that requests devices send us their name
|
de.sciss.net.OSCMessage |
buildNetworkSendMessage()
Build OSC Message that specifies a Network update
|
de.sciss.net.OSCMessage |
buildRemoveMessage()
Build OSC Message that specifies a removal of a control
|
de.sciss.net.OSCMessage |
buildUpdateMessage()
Build OSC Message that specifies an update
|
void |
clearTargetDevices()
Clear all devices as Targets
|
void |
doScheduledEvent(double scheduledTime,
java.lang.Object param)
Notification interface that a scheduled event is occuring
|
static boolean |
enableProcessControlMessage(java.lang.String device_name,
int message_id)
See if we will process a control message based on device name and message_id
If the message_id is mapped against the device_name, ignore message, otherwise store mapping and return true;
|
DynamicControl |
eraseListeners()
Erase all listeners from this control
|
static DynamicControl |
getControl(java.lang.String map_key)
Get the Dynamic control based on Map key
|
java.lang.String |
getControlMapKey()
Get the map key created in the device as a method for mapping back
|
java.lang.String |
getControlName()
Get the name of the control used for ControlScope matching.
|
ControlScope |
getControlScope()
Get the scope of this control.
|
ControlType |
getControlType()
Get the type of control we want
|
static ControlType |
getControlType(java.lang.Object value)
Ascertain the Control Type based on the Value
|
DynamicControl.DISPLAY_TYPE |
getDisplayType()
Whether we disable the control on the screen
|
double |
getExecutionTime()
Returns the JVM execution time we last used when we set the value
|
java.lang.Object |
getMaximumDisplayValue()
The maximum value that we want as a display, for example, in a slider control.
|
java.lang.Object |
getMinimumDisplayValue()
The minimum value that we want as a display, for example, in a slider control.
|
java.lang.Object |
getParentSketch()
Get the Sketch or class object linked to this control
|
java.lang.String |
getSendingDevice()
Get the name of the device that sent the message.
|
java.util.Set<java.lang.String> |
getTargetDeviceAddresses()
Return all mapped device addresses for this control
|
java.lang.String |
getTooltipText()
Get the tooltip to display
|
java.lang.Object |
getValue()
Gets the value of the control.
|
static long |
integersToLong(int msi,
int lsi)
Convert two halves of a long stored integer values into a long value
|
static double |
integersToScheduleTime(int msi,
int lsi,
int nano)
Convert three integers to a double representing scheduler time
|
boolean |
isPersistentControl()
See if control is a persistent control
|
static int[] |
longToIntegers(long l_value)
Convert a long into two integers in an array of two integers
|
DynamicControl |
notifyControlChangeListeners()
Notify all registered listeners of object value
|
void |
notifyGlobalListeners()
Send Global Update Message
|
DynamicControl |
notifyLocalListeners()
Notify all registered listeners of object value on this device
|
void |
notifyValueSetListeners()
Send Update Message when value set
|
static int |
numberIntsForScheduledTime()
Return the array size of Integers that would be required to encode a scheduled time
|
static void |
postRequestNamesMessage()
Post a request device name message to other devices so we can target them specifically and update our map
|
static void |
processDeviceNameMessage(java.net.InetAddress src_address,
de.sciss.net.OSCMessage msg)
Process the DynamicControl deviceName message and map device name to IPAddress
We ignore our own device
|
static void |
processOSCControlMessage(de.sciss.net.OSCMessage msg,
ControlScope controlScope)
Process the
ControlScope.GLOBAL or ControlScope.TARGET Message from an OSC Message. |
static void |
processRequestNameMessage(java.net.InetAddress src_address,
de.sciss.net.OSCMessage msg)
Process the DynamicControl deviceRequest message
Send a deviceName back to src.
|
static void |
processUpdateMessage(de.sciss.net.OSCMessage msg)
Process the Update Message from an OSC Message.
|
DynamicControl |
removeControlListener(DynamicControl.DynamicControlListener listener)
Deregister listener so it no longer receives messages from this control
|
DynamicControl |
removeControlScopeChangedListener(DynamicControl.ControlScopeChangedListener listener)
Deregister listener so it no longer receives messages from this control
|
DynamicControl |
removeGlobalControlListener(DynamicControl.DynamicControlListener listener)
Deregister listener so it no longer receives messages from this control
|
void |
removeTargetDevice(java.net.InetAddress... inetAddresses)
Remove one or more
InetAddress for use in ControlScope.TARGET Message |
void |
removeTargetDevice(java.lang.String... deviceNames)
Remove one or more device names or addresses as a string.
|
static int[] |
scheduleTimeToIntegers(double d_val)
Convert a SchedulerTime into integers in an array of three integers
|
DynamicControl |
setControlScope(ControlScope new_scope)
Changed the scope that the control has.
|
static void |
setDisableScheduler(boolean disabled)
Set whether we disable setting all values in context of scheduler
|
DynamicControl |
setDisplayType(DynamicControl.DISPLAY_TYPE display_type)
Set how we will display control object on the screen
|
DynamicControl |
setMaximumDisplayValue(java.lang.Object max)
Set the maximum display range for display
|
DynamicControl |
setMinimumValue(java.lang.Object min)
Set the minimum display range for display
|
DynamicControl |
setPersistentController()
Set this control as a persistentSimulation control so it does not get removed on reset
|
void |
setTargetDevice(java.net.InetAddress... inetAddresses)
Remove all set target devices and replace with the those provided as arguments
Adds device addresses to
ControlScope.TARGET Message |
void |
setTargetDevice(java.lang.String... deviceNames)
Remove all set target devices and replace with the those provided as arguments
Adds device address as a string or device name to
ControlScope.TARGET Message |
DynamicControl |
setTooltipPrefix(java.lang.String tooltipPrefix)
Create the text we will display at the beginning of tooltip
|
DynamicControl |
setValue(java.lang.Object val)
Set the value of the object and notify any listeners
Additionally, the value will propagate to any controls that match the control scope
If we are using a trigger, send a random number or a unique value
|
DynamicControl |
setValue(java.lang.Object val,
double execution_time)
Set the value of the object and notify any listeners
Additionally, the value will propagate to any controls that match the control scope
If we are using a trigger, send a random number or a unique value
|
DynamicControl |
updateControl(DynamicControl mirror_control)
Update the parameters of this control with another.
|
public DynamicControl(java.lang.String name, java.lang.Object initial_value)
name
- The name we will give to associate it with other DynamicControls with identical ControlScope and type.initial_value
- The initial value of the controlpublic DynamicControl(ControlType control_type, java.lang.String name, java.lang.Object initial_value)
control_type
- The type of control message you want to sendname
- The name we will give to associate it with other DynamicControls with identical ControlScope and type.initial_value
- The initial value of the controlpublic DynamicControl(java.lang.Object parent_sketch, ControlType control_type, java.lang.String name)
parent_sketch
- the object calling - typically this, however, you can use any class objectcontrol_type
- The type of control message you want to sendname
- The name we will give to associate it with other DynamicControls with identical ControlScope and type.public DynamicControl(ControlType control_type, java.lang.String name)
control_type
- The type of control message you want to sendname
- The name we will give to associate it with other DynamicControls with identical ControlScope and type.public DynamicControl(java.lang.Object parent_sketch, ControlType control_type, java.lang.String name, java.lang.Object initial_value)
parent_sketch
- the object calling - typically this, however, you can use any class objectcontrol_type
- The type of control message you want to sendname
- The name we will give to associate it with other DynamicControls with identical ControlScope and type.initial_value
- The initial value of the controlpublic DynamicControl(java.lang.Object parent_sketch, ControlType control_type, java.lang.String name, java.lang.Object initial_value, java.lang.Object min_value, java.lang.Object max_value)
parent_sketch
- the object calling - typically this, however, you can use any class objectcontrol_type
- The type of control message you want to sendname
- The name we will give to associate it with other DynamicControls with identical ControlScope and type.initial_value
- The initial value of the controlmin_value
- The minimum display value of the control. Only used for display purposesmax_value
- The maximum display value of the control. Only used for display purposespublic DynamicControl(java.lang.Object parent_sketch, ControlType control_type, java.lang.String name, java.lang.Object initial_value, java.lang.Object min_value, java.lang.Object max_value, DynamicControl.DISPLAY_TYPE display_type)
parent_sketch
- the object calling - typically this, however, you can use any class objectcontrol_type
- The type of control message you want to sendname
- The name we will give to associate it with other DynamicControls with identical ControlScope and type.initial_value
- The initial value of the controlmin_value
- The minimum display value of the control. Only used for display purposesmax_value
- The maximum display value of the control. Only used for display purposesdisplay_type
- The way we want the control displayedpublic DynamicControl(ControlType control_type, java.lang.String name, java.lang.Object initial_value, java.lang.Object min_value, java.lang.Object max_value)
control_type
- The type of control message you want to sendname
- The name we will give to associate it with other DynamicControls with identical ControlScope and type.initial_value
- The initial value of the controlmin_value
- The minimum display value of the control. Only used for display purposesmax_value
- The maximum display value of the control. Only used for display purposespublic DynamicControl(de.sciss.net.OSCMessage msg)
msg
- the OSC Message with the parameters to make Controlpublic static boolean enableProcessControlMessage(java.lang.String device_name, int message_id)
device_name
- the device namemessage_id
- the message_idpublic java.lang.String getSendingDevice()
public java.util.Set<java.lang.String> getTargetDeviceAddresses()
public void doScheduledEvent(double scheduledTime, java.lang.Object param)
ScheduledEventListener
doScheduledEvent
in interface ScheduledEventListener
scheduledTime
- the time that was scheduled for the callback to occurparam
- the parameter to pass to the listener.public void addTargetDevice(java.lang.String... deviceNames)
ControlScope.TARGET
MessagedeviceNames
- device name or IP Addresspublic void setTargetDevice(java.lang.String... deviceNames)
ControlScope.TARGET
MessagedeviceNames
- device name or IP Addresspublic void setTargetDevice(java.net.InetAddress... inetAddresses)
ControlScope.TARGET
MessageinetAddresses
- device name or IP Addresspublic void addTargetDevice(java.net.InetAddress... inetAddresses)
InetAddress
for use in ControlScope.TARGET
MessageinetAddresses
- the target addresses to addpublic void clearTargetDevices()
public void removeTargetDevice(java.lang.String... deviceNames)
ControlScope.TARGET
MessagesdeviceNames
- device names or IP Addresses to removepublic void removeTargetDevice(java.net.InetAddress... inetAddresses)
InetAddress
for use in ControlScope.TARGET
MessageinetAddresses
- the target addresses to removepublic DynamicControl setTooltipPrefix(java.lang.String tooltipPrefix)
tooltipPrefix
- The starting text of the tooltippublic static void setDisableScheduler(boolean disabled)
disabled
- set true to disablepublic DynamicControl.DISPLAY_TYPE getDisplayType()
public DynamicControl setDisplayType(DynamicControl.DISPLAY_TYPE display_type)
display_type
- how we will display controlpublic double getExecutionTime()
public java.lang.Object getParentSketch()
public static ControlType getControlType(java.lang.Object value)
value
- the value we are obtaing a control value frompublic DynamicControl setPersistentController()
public boolean isPersistentControl()
public ControlType getControlType()
public ControlScope getControlScope()
public DynamicControl setControlScope(ControlScope new_scope)
new_scope
- The new Control Scopepublic static DynamicControl getControl(java.lang.String map_key)
map_key
- the string that we are using as the keypublic DynamicControl updateControl(DynamicControl mirror_control)
mirror_control
- The control that we are copying frompublic static void processDeviceNameMessage(java.net.InetAddress src_address, de.sciss.net.OSCMessage msg)
src_address
- The address of the devicemsg
- The OSC Message that has device namepublic static void processRequestNameMessage(java.net.InetAddress src_address, de.sciss.net.OSCMessage msg)
src_address
- The address of the devicemsg
- The OSC Message that has device namepublic static void postRequestNamesMessage()
public static de.sciss.net.OSCMessage buildDeviceNameMessage()
public static de.sciss.net.OSCMessage buildDeviceRequestNameMessage()
public static long integersToLong(int msi, int lsi)
msi
- most significant integerlsi
- least significant integerpublic static int[] longToIntegers(long l_value)
l_value
- the Long values that needs to be encodedpublic static int numberIntsForScheduledTime()
public static int[] scheduleTimeToIntegers(double d_val)
d_val
- the double values that needs to be encodedpublic static double integersToScheduleTime(int msi, int lsi, int nano)
msi
- the most significant value of millisecond valuelsi
- the least significant value of millisecond valuenano
- the number of nanosecondspublic static void processOSCControlMessage(de.sciss.net.OSCMessage msg, ControlScope controlScope)
ControlScope.GLOBAL
or ControlScope.TARGET
Message from an OSC Message. Examine buildUpdateMessage for parameters inside Message
We will not process messages that have come from this device because they will be actioned through local listenersmsg
- OSC message with new valuecontrolScope
- the type of ControlScope
;public static void processUpdateMessage(de.sciss.net.OSCMessage msg)
msg
- OSC message with new valuepublic de.sciss.net.OSCMessage buildRemoveMessage()
public de.sciss.net.OSCMessage buildUpdateMessage()
public de.sciss.net.OSCMessage buildNetworkSendMessage()
public de.sciss.net.OSCMessage buildCreateMessage()
public java.lang.String getControlMapKey()
public DynamicControl setValue(java.lang.Object val)
val
- the value to setpublic DynamicControl setValue(java.lang.Object val, double execution_time)
val
- the value to setexecution_time
- the Scheduler time we want this to occurpublic java.lang.Object getValue()
public java.lang.Object getMaximumDisplayValue()
public DynamicControl setMinimumValue(java.lang.Object min)
min
- minimum display valuepublic DynamicControl setMaximumDisplayValue(java.lang.Object max)
max
- maximum display valuepublic java.lang.Object getMinimumDisplayValue()
public java.lang.String getControlName()
public DynamicControl addControlListener(DynamicControl.DynamicControlListener listener)
listener
- Listener to register for eventspublic DynamicControl addGlobalControlListener(DynamicControl.DynamicControlListener listener)
listener
- Listener to register for eventspublic DynamicControl addValueSetListener(DynamicControl.DynamicControlListener listener)
listener
- Listener to register for eventspublic DynamicControl removeControlListener(DynamicControl.DynamicControlListener listener)
listener
- The lsitener we are removingpublic DynamicControl removeGlobalControlListener(DynamicControl.DynamicControlListener listener)
listener
- the listener we are remmovingpublic DynamicControl addControlScopeListener(DynamicControl.ControlScopeChangedListener listener)
listener
- Listener to register for eventspublic DynamicControl removeControlScopeChangedListener(DynamicControl.ControlScopeChangedListener listener)
listener
- the listenerpublic DynamicControl eraseListeners()
public DynamicControl notifyLocalListeners()
public void notifyValueSetListeners()
public void notifyGlobalListeners()
public DynamicControl notifyControlChangeListeners()
public java.lang.String getTooltipText()