com.petersalomonsen.jjack.javasound
Class JJackMixer

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
                      extended by de.gulden.framework.jjack.JJackClient
                          extended by com.petersalomonsen.jjack.javasound.JJackMixer
All Implemented Interfaces:
JJackAudioConsumer, JJackAudioProcessListener, JJackAudioProcessor, JJackAudioProcessorMonitorable, JJackAudioProducer, JJackConstants, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.sound.sampled.Line, javax.sound.sampled.Mixer

public class JJackMixer
extends JJackClient
implements javax.sound.sampled.Mixer

A Javasound Mixer implementation that enables use of jack through this standard java interface..

Version:
0.3
Author:
Peter Johan Salomonsen
See Also:
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
 
Nested classes/interfaces inherited from interface javax.sound.sampled.Mixer
javax.sound.sampled.Mixer.Info
 
Field Summary
(package private)  javax.sound.sampled.AudioFormat[] audioFormatsIn
           
(package private)  javax.sound.sampled.AudioFormat[] audioFormatsOut
          Supported audio formats
private static long serialVersionUID
           
(package private)  java.util.Vector sourceLines
           
(package private)  java.util.Vector targetLines
           
 
Fields inherited from class de.gulden.framework.jjack.JJackMonitor
active, chained, gui, listeners, monitors, 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
JJackMixer()
           
 
Method Summary
 void addLineListener(javax.sound.sampled.LineListener listener)
           
 void close()
           
private  void fillAudioFormats(javax.sound.sampled.AudioFormat[] audioFormats)
          Fill audioFormats array with available audio formats.
 javax.sound.sampled.Control getControl(javax.sound.sampled.Control.Type control)
           
 javax.sound.sampled.Control[] getControls()
           
 javax.sound.sampled.Line getLine(javax.sound.sampled.Line.Info info)
           
 javax.sound.sampled.Line.Info getLineInfo()
           
 int getMaxLines(javax.sound.sampled.Line.Info info)
           
 javax.sound.sampled.Mixer.Info getMixerInfo()
           
 javax.sound.sampled.Line.Info[] getSourceLineInfo()
           
 javax.sound.sampled.Line.Info[] getSourceLineInfo(javax.sound.sampled.Line.Info info)
           
 javax.sound.sampled.Line[] getSourceLines()
           
 javax.sound.sampled.Line.Info[] getTargetLineInfo()
           
 javax.sound.sampled.Line.Info[] getTargetLineInfo(javax.sound.sampled.Line.Info info)
           
 javax.sound.sampled.Line[] getTargetLines()
           
 boolean isControlSupported(javax.sound.sampled.Control.Type control)
           
 boolean isLineSupported(javax.sound.sampled.Line.Info info)
           
 boolean isOpen()
           
 boolean isSynchronizationSupported(javax.sound.sampled.Line[] lines, boolean maintainSync)
           
 void open()
           
 void process(JJackAudioEvent e)
          Process multiple samples from input buffer to output buffer.
(package private)  void registerOpenLine(JJackLine line)
           
 void removeLineListener(javax.sound.sampled.LineListener listener)
           
 void synchronize(javax.sound.sampled.Line[] lines, boolean maintainSync)
           
(package private)  void unregisterLine(JJackLine line)
           
 void unsynchronize(javax.sound.sampled.Line[] lines)
           
 
Methods inherited from class de.gulden.framework.jjack.JJackMonitor
addAudioProcessListener, addMonitor, afterProcess, beforeProcess, createUI, getAudioProcessListeners, getChained, getInfo, getMonitors, getName, getSampleRate, initUI, removeAudioProcessListener, removeChained, removeMonitor, setChained, setName, updateUI
 
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
 
Methods inherited from interface de.gulden.framework.jjack.JJackAudioProducer
addMonitor, getChained, getMonitors, removeChained, removeMonitor, setChained
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

targetLines

java.util.Vector targetLines

sourceLines

java.util.Vector sourceLines

audioFormatsOut

javax.sound.sampled.AudioFormat[] audioFormatsOut
Supported audio formats


audioFormatsIn

javax.sound.sampled.AudioFormat[] audioFormatsIn
Constructor Detail

JJackMixer

public JJackMixer()
Method Detail

process

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

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

getLine

public javax.sound.sampled.Line getLine(javax.sound.sampled.Line.Info info)
                                 throws javax.sound.sampled.LineUnavailableException
Specified by:
getLine in interface javax.sound.sampled.Mixer
Throws:
javax.sound.sampled.LineUnavailableException

getMaxLines

public int getMaxLines(javax.sound.sampled.Line.Info info)
Specified by:
getMaxLines in interface javax.sound.sampled.Mixer

getMixerInfo

public javax.sound.sampled.Mixer.Info getMixerInfo()
Specified by:
getMixerInfo in interface javax.sound.sampled.Mixer

getSourceLineInfo

public javax.sound.sampled.Line.Info[] getSourceLineInfo()
Specified by:
getSourceLineInfo in interface javax.sound.sampled.Mixer

getSourceLineInfo

public javax.sound.sampled.Line.Info[] getSourceLineInfo(javax.sound.sampled.Line.Info info)
Specified by:
getSourceLineInfo in interface javax.sound.sampled.Mixer

getSourceLines

public javax.sound.sampled.Line[] getSourceLines()
Specified by:
getSourceLines in interface javax.sound.sampled.Mixer

getTargetLineInfo

public javax.sound.sampled.Line.Info[] getTargetLineInfo()
Specified by:
getTargetLineInfo in interface javax.sound.sampled.Mixer

getTargetLineInfo

public javax.sound.sampled.Line.Info[] getTargetLineInfo(javax.sound.sampled.Line.Info info)
Specified by:
getTargetLineInfo in interface javax.sound.sampled.Mixer

getTargetLines

public javax.sound.sampled.Line[] getTargetLines()
Specified by:
getTargetLines in interface javax.sound.sampled.Mixer

isLineSupported

public boolean isLineSupported(javax.sound.sampled.Line.Info info)
Specified by:
isLineSupported in interface javax.sound.sampled.Mixer

isSynchronizationSupported

public boolean isSynchronizationSupported(javax.sound.sampled.Line[] lines,
                                          boolean maintainSync)
Specified by:
isSynchronizationSupported in interface javax.sound.sampled.Mixer

synchronize

public void synchronize(javax.sound.sampled.Line[] lines,
                        boolean maintainSync)
Specified by:
synchronize in interface javax.sound.sampled.Mixer

unsynchronize

public void unsynchronize(javax.sound.sampled.Line[] lines)
Specified by:
unsynchronize in interface javax.sound.sampled.Mixer

addLineListener

public void addLineListener(javax.sound.sampled.LineListener listener)
Specified by:
addLineListener in interface javax.sound.sampled.Line

close

public void close()
Specified by:
close in interface javax.sound.sampled.Line

getControl

public javax.sound.sampled.Control getControl(javax.sound.sampled.Control.Type control)
Specified by:
getControl in interface javax.sound.sampled.Line

getControls

public javax.sound.sampled.Control[] getControls()
Specified by:
getControls in interface javax.sound.sampled.Line

getLineInfo

public javax.sound.sampled.Line.Info getLineInfo()
Specified by:
getLineInfo in interface javax.sound.sampled.Line

isControlSupported

public boolean isControlSupported(javax.sound.sampled.Control.Type control)
Specified by:
isControlSupported in interface javax.sound.sampled.Line

isOpen

public boolean isOpen()
Specified by:
isOpen in interface javax.sound.sampled.Line

open

public void open()
          throws javax.sound.sampled.LineUnavailableException
Specified by:
open in interface javax.sound.sampled.Line
Throws:
javax.sound.sampled.LineUnavailableException

removeLineListener

public void removeLineListener(javax.sound.sampled.LineListener listener)
Specified by:
removeLineListener in interface javax.sound.sampled.Line

registerOpenLine

void registerOpenLine(JJackLine line)

unregisterLine

void unregisterLine(JJackLine line)

fillAudioFormats

private void fillAudioFormats(javax.sound.sampled.AudioFormat[] audioFormats)
Fill audioFormats array with available audio formats. We'll support 8,16,24 and 32 bit, big and little endian and lines up to "inputs/outputs" number of channels