de.gulden.framework.jjack
Class JJackMonitor

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by de.gulden.framework.jjack.JJackMonitor
All Implemented Interfaces:
JJackAudioConsumer, JJackAudioProcessListener, JJackAudioProcessor, JJackAudioProcessorMonitorable, JJackConstants, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
JJackClient

public abstract class JJackMonitor
extends javax.swing.JPanel
implements JJackAudioProcessorMonitorable, JJackAudioConsumer, JJackAudioProcessListener, JJackConstants

Abstract base class for JJack clients that listen to input but do not generate output. The feature of generating output is added by the subclass JJackClient. Classes derived from this one can also be used as visible JavaBeans.

Version:
0.3
Author:
Jens Gulden
See Also:
JJackClient, JJackBeanInfoAbstract, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  boolean active
          Flag marking active mode.
protected  JJackAudioProducer chained
          Chained audio processor.
protected  javax.swing.JComponent gui
          The GUI component associated with this audio processor.
protected  java.util.ArrayList listeners
          JJackAudioProcessListeners connected to this processor.
protected  java.util.ArrayList monitors
          Monitor-processors connected to this processor.
protected  java.lang.String name
          The audio processor's name.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface de.gulden.framework.jjack.JJackConstants
INPUT, LEFT, OUTPUT, RIGHT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JJackMonitor()
          Constructor.
JJackMonitor(boolean active)
          Constructor.
JJackMonitor(java.lang.String name)
          Constructor.
JJackMonitor(java.lang.String name, boolean active)
          Constructor.
 
Method Summary
 void addAudioProcessListener(JJackAudioProcessListener l)
          Adds a JJackAudioProcessListener to this audio processor.
 void addMonitor(JJackAudioConsumer p)
          Adds a monitor processor after this processor.
 void afterProcess(JJackAudioEvent e)
          Event handler method called after the supervised audio processor has performed its process()-method.
 void beforeProcess(JJackAudioEvent e)
          Event handler method called before the supervised audio processor performs its process()-method.
protected  javax.swing.JComponent createUI()
          Creates the user interface.
(package private) static void exc(java.lang.Exception e)
          Outputs an Exception's type and message.
 java.util.Collection getAudioProcessListeners()
          Returns all JJackAudioProcessListeners.
 JJackAudioProducer getChained()
          Returns the next audio processor in chain.
 java.lang.String getInfo()
          Returns a short info text about this audio processor.
 java.util.Collection getMonitors()
          Returns all monitor processors currently connected after this processor.
 java.lang.String getName()
          Returns the audio processor's name.
 int getSampleRate()
          Returns the sample rate with which the JACK daemon is running.
protected  void initUI()
          Initializes the user interface.
abstract  void process(JJackAudioEvent e)
          Process multiple samples from input buffer to output buffer.
 void removeAudioProcessListener(JJackAudioProcessListener l)
          Removes a JJackAudioProcessListener from this audio processor.
 void removeChained(JJackAudioProducer p)
          Removes p as the next audio processor in chain, if it is the currently chained processor.
 void removeMonitor(JJackAudioConsumer p)
          Removes a monitor processor from this processor.
 void setChained(JJackAudioProducer p)
          Sets the next audio processor in chain.
 void setName(java.lang.String name)
          Sets the audio processor's name.
 void updateUI()
          Synchronize user interface with parameter values.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
The audio processor's name.


gui

protected javax.swing.JComponent gui
The GUI component associated with this audio processor.


active

protected boolean active
Flag marking active mode. In active mode, the output of this processor is being swapped to be the input of any chained and monitoring processor. In inactive mode, inputs to this processor are simply passed on to the next processors.


chained

protected JJackAudioProducer chained
Chained audio processor. null if this is the last processor in the chain.


monitors

protected java.util.ArrayList monitors
Monitor-processors connected to this processor.


listeners

protected java.util.ArrayList listeners
JJackAudioProcessListeners connected to this processor.

Constructor Detail

JJackMonitor

public JJackMonitor()
Constructor. Creates a new instance named as the unqualified classname and initially set to inactive processing mode.


JJackMonitor

public JJackMonitor(java.lang.String name)
Constructor. Creates a new instance, initially set to inactive processing mode.

Parameters:
name - the processor's name

JJackMonitor

public JJackMonitor(boolean active)
Constructor. Creates a new instance named as the unqualified classname.

Parameters:
active - sets whether to run in active or inactive mode.
See Also:
active

JJackMonitor

public JJackMonitor(java.lang.String name,
                    boolean active)
Constructor.

Parameters:
name - the processor's name
active - sets whether to run in active or inactive mode.
See Also:
active
Method Detail

getName

public java.lang.String getName()
Returns the audio processor's name.

Overrides:
getName in class java.awt.Component
Returns:
the name

setName

public void setName(java.lang.String name)
Sets the audio processor's name.

Overrides:
setName in class java.awt.Component
Parameters:
name - the name

getSampleRate

public int getSampleRate()
Returns the sample rate with which the JACK daemon is running.

Returns:
the sample rate in samples per second

setChained

public void setChained(JJackAudioProducer p)
Sets the next audio processor in chain. The chained processor will get the output of this processor as its own input.

Parameters:
p - the next audio processor in chain

removeChained

public void removeChained(JJackAudioProducer p)
Removes p as the next audio processor in chain, if it is the currently chained processor.

Parameters:
p - the current audio processor in chain

getChained

public JJackAudioProducer getChained()
Returns the next audio processor in chain.

Returns:
the next audio processor in chain, null if no processor is chained to this

addMonitor

public void addMonitor(JJackAudioConsumer p)
Adds a monitor processor after this processor. The monitor processor will get the output of this processor as its own input.


removeMonitor

public void removeMonitor(JJackAudioConsumer p)
Removes a monitor processor from this processor.


getMonitors

public java.util.Collection getMonitors()
Returns all monitor processors currently connected after this processor.

Returns:
Collection of JJackAudioConsumer

addAudioProcessListener

public void addAudioProcessListener(JJackAudioProcessListener l)
Adds a JJackAudioProcessListener to this audio processor.

Specified by:
addAudioProcessListener in interface JJackAudioProcessorMonitorable
Parameters:
l - the JJackAudioProcessListener to add

removeAudioProcessListener

public void removeAudioProcessListener(JJackAudioProcessListener l)
Removes a JJackAudioProcessListener from this audio processor.

Specified by:
removeAudioProcessListener in interface JJackAudioProcessorMonitorable
Parameters:
l - the JJackAudioProcessListener to remove

getAudioProcessListeners

public java.util.Collection getAudioProcessListeners()
Returns all JJackAudioProcessListeners.

Specified by:
getAudioProcessListeners in interface JJackAudioProcessorMonitorable
Returns:
Collection of JJackAudioProcessListener

beforeProcess

public void beforeProcess(JJackAudioEvent e)
Event handler method called before the supervised audio processor performs its process()-method.

Specified by:
beforeProcess in interface JJackAudioProcessListener
Parameters:
e - audio event that is going to be processed by the supervised audio processor

afterProcess

public void afterProcess(JJackAudioEvent e)
Event handler method called after the supervised audio processor has performed its process()-method.

Specified by:
afterProcess in interface JJackAudioProcessListener
Parameters:
e - audio event that has been processed by the supervised audio processor

updateUI

public void updateUI()
Synchronize user interface with parameter values.

Overrides:
updateUI in class javax.swing.JPanel

getInfo

public java.lang.String getInfo()
Returns a short info text about this audio processor.

Returns:
info text, or null if no info is available

process

public abstract void process(JJackAudioEvent e)
Process multiple samples from input buffer to output buffer. This is regularly called by the JACK daemon.

Specified by:
process in interface JJackAudioProcessor
Parameters:
e - event object with references to input buffer and output buffer.

initUI

protected void initUI()
Initializes the user interface.

See Also:
createUI()

createUI

protected javax.swing.JComponent createUI()
Creates the user interface.

Returns:
visible component with the user interface, or null if this is an invisible audio processor

exc

static void exc(java.lang.Exception e)
Outputs an Exception's type and message. Program execution is not interrupted.

Parameters:
e - the exception