sky.monome
Class Analog

java.lang.Object
  extended by sky.monome.Component
      extended by sky.monome.Analog
Direct Known Subclasses:
HookAnalog

public class Analog
extends Component

Analog input soldered into the Monome device. An analog can be a potentiometer, an accelerometer, a gyrometer, a thermometer, an altimeter, a barometer or any device that can give output signal in the range specified by the Monome microcontroller (0V to 5V, powered by a 5V DC voltage). Analogs are usually contained by the logical Monome device directly for convenience, but you can build the Monome assembling tree of your choice. By example, you can add an analog in a page, and this analog will be active only when the page will be visible.

Author:
PJ Skyman

Field Summary
protected  float value
          Current value of this analog.
 
Fields inherited from class sky.monome.Component
container, eventListenerList, lockObject, name, x, y
 
Constructor Summary
Analog(java.lang.String name, Container container, int rank)
          Deprecated. Since SkyMonome v1.2, all components register themselves inside their container, so you don't need to specify the container by calling this constructor.
Analog(java.lang.String name, int rank)
          Constructs an analog with the specified name and the specified rank.
 
Method Summary
 void addAnalogListener(AnalogListener analogListener)
          Adds the specified listener to the listeners list of this analog.
 boolean canHaveParentContainer()
          Indicates whether this analog can have a parent container in the Monome assembling tree.
 void fireAnalogMoved(float value)
          Notifies all the listeners that a new analog move occured.
 int getAbsoluteX()
          Returns the absolute X-coordinate of this analog.
 int getAbsoluteY()
          Returns the absolute Y-coordinate of this analog.
 AnalogListener[] getAnalogListeners()
          Returns an array of all listeners contained in the listeners list of this analog.
 java.awt.Rectangle getBounds()
          Returns the bounds of this analog in the local context of its container.
 Monome getMonome()
          Returns the logical Monome device that contains this analog.
 float getValue()
          Returns the current value of this analog.
 boolean isVisible()
          Indicates whether this analog is actually visible.
 void notify(OSCMessageDigester messageDigester)
          Notifies this analog that a message comes from the Monome device.
 void removeAnalogListener(AnalogListener analogListener)
          Removes the specified listener from the listeners list of this analog.
protected  void setValue(float value)
          Modifies the current value of this analog.
 java.lang.String toString()
          Returns a string representation of this analog.
 void writeOn(Frame frame)
          Writes this analog on the specified frame in order to refresh the Monome device.
 
Methods inherited from class sky.monome.Component
getContainer, getLockObject, getName, getX, getY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected float value
Current value of this analog.

Constructor Detail

Analog

@Deprecated
public Analog(java.lang.String name,
                         Container container,
                         int rank)
Deprecated. Since SkyMonome v1.2, all components register themselves inside their container, so you don't need to specify the container by calling this constructor.

Constructs an analog with the specified name and the specified rank and contained by the specified container.

Parameters:
name - Name of this analog.
container - Container that contains this analog.
rank - Rank of the analog. The rank is the physical rank on the Monome device. For compatibility with other components, the rank is also named X-coordinate. This rank MUST follow this rule : the first analog have a rank of 0, the second is 1, and so on. If you do not respect that rule, you should meet event problems.

Analog

public Analog(java.lang.String name,
              int rank)
Constructs an analog with the specified name and the specified rank.

Parameters:
name - Name of this analog.
rank - Rank of the analog. The rank is the physical rank on the Monome device. For compatibility with other components, the rank is also named X-coordinate. This rank MUST follow this rule : the first analog have a rank of 0, the second is 1, and so on. If you do not respect that rule, you should meet event problems.
Since:
SkyMonome v1.2
Method Detail

getValue

public float getValue()
Returns the current value of this analog.

Returns:
The current value of this analog.

setValue

protected void setValue(float value)
Modifies the current value of this analog. Warning ! Only internal listener methods must call this method. Otherwise, chaotic behaviors must appear.

Parameters:
value - New value to give to this analog.

addAnalogListener

public void addAnalogListener(AnalogListener analogListener)
Adds the specified listener to the listeners list of this analog.

Parameters:
analogListener - Listener to add to the listeners list of this analog.

removeAnalogListener

public void removeAnalogListener(AnalogListener analogListener)
Removes the specified listener from the listeners list of this analog.

Parameters:
analogListener - Listener to remove from the listeners list of this analog.

getAnalogListeners

public AnalogListener[] getAnalogListeners()
Returns an array of all listeners contained in the listeners list of this analog.

Returns:
An array of all listeners contained in the listeners list of this analog.

fireAnalogMoved

public void fireAnalogMoved(float value)
Notifies all the listeners that a new analog move occured.

Parameters:
value - New value given to this analog.

getMonome

public Monome getMonome()
Returns the logical Monome device that contains this analog. The logical Monome device is always at the top of the Monome assembling tree.

Specified by:
getMonome in class Component
Returns:
The logical Monome device that contains this analog.

notify

public void notify(OSCMessageDigester messageDigester)
Notifies this analog that a message comes from the Monome device.

Specified by:
notify in class Component
Parameters:
messageDigester - Message digester that prepares and encapsulates the message for an easy access of informations contained in the message.

writeOn

public void writeOn(Frame frame)
Writes this analog on the specified frame in order to refresh the Monome device. Once this frame is completed, it is sent to the Monome device. This method does nothing since analogs haven't any relation with the leds.

Specified by:
writeOn in class Component
Parameters:
frame - Frame in which this analog must write its led state.
See Also:
Monome.refresh()

getAbsoluteX

public int getAbsoluteX()
Returns the absolute X-coordinate of this analog. For analogs, this method returns the rank that was given at construction.

Specified by:
getAbsoluteX in class Component
Returns:
The absolute X-coordinate of this analog.

getAbsoluteY

public int getAbsoluteY()
Returns the absolute Y-coordinate of this analog. For analogs, this method always returns 0.

Specified by:
getAbsoluteY in class Component
Returns:
The absolute Y-coordinate of this analog.

isVisible

public boolean isVisible()
Indicates whether this analog is actually visible.

Specified by:
isVisible in class Component
Returns:
true if this analog is actually visible, false otherwise.

toString

public java.lang.String toString()
Returns a string representation of this analog.

Specified by:
toString in class Component
Returns:
A string representation of this analog.

canHaveParentContainer

public boolean canHaveParentContainer()
Indicates whether this analog can have a parent container in the Monome assembling tree.

Specified by:
canHaveParentContainer in class Component
Returns:
Always true.

getBounds

public java.awt.Rectangle getBounds()
Returns the bounds of this analog in the local context of its container.

Specified by:
getBounds in class Component
Returns:
The bounds of this analog in the local context of its container.