Package de.sciss.io
Class AudioFileFormatPane
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- de.sciss.gui.SpringPanel
-
- de.sciss.io.AudioFileFormatPane
-
- All Implemented Interfaces:
PreferenceNodeSync,java.awt.event.ItemListener,java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,java.util.EventListener,javax.accessibility.Accessible
public class AudioFileFormatPane extends SpringPanel implements java.awt.event.ItemListener, PreferenceNodeSync
A multi component panel that provides gadgets for specification of the output format of an audio file, such as file format, resolution or sample rate. It implements thePreferenceNodeSyncinterface, allowing the automatic saving and recalling of its gadget's values from/to preferences.- See Also:
PreferenceNodeSync,AudioFileDescr, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.sciss.gui.SpringPanel
SpringPanel.ComponentHeightRatioSpring, SpringPanel.ComponentWidthRatioSpring, SpringPanel.RatioSpring
-
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
-
-
Field Summary
Fields Modifier and Type Field Description static intCHANNELSConstructor-Flag : create channel num gadgetsstatic intENCODINGConstructor-Flag : create sample encoding gadgetstatic intFORMATConstructor-Flag : create file type gadgetstatic intFORMAT_ENCODING_RATEConstructor-Flag : conventient combination ofFORMAT,ENCODINGandRATE.static intGAINConstructor-Flag : create gain gadgetstatic intGAIN_NORMALIZEConstructor-Flag : conventient combination ofGAINandNORMALIZE.static intNEW_FILE_FLAGSConstructor-Flag : conventient combination ofFORMAT,ENCODING,RATE,CHANNELS.static intNORMALIZEConstructor-Flag : create normalize optionstatic intRATEConstructor-Flag : create sample rate gadget-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description AudioFileFormatPane()AudioFileFormatPane(int flags)Construct a new AudioFileFormatPane with the shown components specified by the given flags.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidautomaticFileSuffix(PathField ggPath)Registers aPathFieldto be updated upon format switches.voidfromDescr(AudioFileDescr source)Copy a sound format from the givenAudioFileDescrto the corresponding gadgets in the pane.java.lang.StringgetEncodingString()Returns a text representation of the encoding (integer/floating point and bit depth).intgetFlags()java.lang.StringgetFormatString()Returns a text representation of the file format type.doublegetGain()Return the value of the gain gadget (in decibels).booleangetNormalized()Return the state of the 'normalized' checkbox of the pane.voiditemStateChanged(java.awt.event.ItemEvent e)voidsetFlags(int flags)voidsetPreferences(java.util.prefs.Preferences prefs)Enables Preferences synchronization.voidtoDescr(AudioFileDescr target)Copy the internal state of theAudioFileFormatPaneinto theAudioFileDescrobject.-
Methods inherited from class de.sciss.gui.SpringPanel
gridAdd, gridAdd, gridAdd, makeCompactGrid, makeCompactGrid, makeGrid, setInitialX, setInitialY, setPadding, setTitle, setXPad, setYPad
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
FORMAT
public static final int FORMAT
Constructor-Flag : create file type gadget- See Also:
- Constant Field Values
-
ENCODING
public static final int ENCODING
Constructor-Flag : create sample encoding gadget- See Also:
- Constant Field Values
-
RATE
public static final int RATE
Constructor-Flag : create sample rate gadget- See Also:
- Constant Field Values
-
GAIN
public static final int GAIN
Constructor-Flag : create gain gadget- See Also:
- Constant Field Values
-
NORMALIZE
public static final int NORMALIZE
Constructor-Flag : create normalize option- See Also:
- Constant Field Values
-
CHANNELS
public static final int CHANNELS
Constructor-Flag : create channel num gadgets- See Also:
- Constant Field Values
-
FORMAT_ENCODING_RATE
public static final int FORMAT_ENCODING_RATE
Constructor-Flag : conventient combination ofFORMAT,ENCODINGandRATE.- See Also:
- Constant Field Values
-
NEW_FILE_FLAGS
public static final int NEW_FILE_FLAGS
Constructor-Flag : conventient combination ofFORMAT,ENCODING,RATE,CHANNELS.- See Also:
- Constant Field Values
-
GAIN_NORMALIZE
public static final int GAIN_NORMALIZE
Constructor-Flag : conventient combination ofGAINandNORMALIZE.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AudioFileFormatPane
public AudioFileFormatPane()
-
AudioFileFormatPane
public AudioFileFormatPane(int flags)
Construct a new AudioFileFormatPane with the shown components specified by the given flags.- Parameters:
flags- a bitwise OR combination of gadget creation flags such as FORMAT or GAIN_NORMALIZE
-
-
Method Detail
-
setFlags
public void setFlags(int flags)
-
getFlags
public int getFlags()
-
toDescr
public void toDescr(AudioFileDescr target)
Copy the internal state of theAudioFileFormatPaneinto theAudioFileDescrobject. This will fill in thetype,bitsPerSample,sampleFormat,rateandchannelsfields, provided that the pane was specified to contain corresponding gadgets- Parameters:
target- the description whose format values are to be overwritten.
-
getGain
public double getGain()
Return the value of the gain gadget (in decibels). If the pane was not created without a dedicated gain gadget, this method returns 0.0.- Returns:
- the pane's gain setting or 0.0 if no gain gadget exists.
-
getEncodingString
public java.lang.String getEncodingString()
Returns a text representation of the encoding (integer/floating point and bit depth). This String is compatible with SuperCollider's/b_writecommand.- Returns:
- encoding string, such as
"int16"
-
getFormatString
public java.lang.String getFormatString()
Returns a text representation of the file format type. This String is compatible with SuperCollider's/b_writecommand.- Returns:
- file format string, such as
"aiff"
-
getNormalized
public boolean getNormalized()
Return the state of the 'normalized' checkbox of the pane.- Returns:
trueif the pane's 'normalized' checkbox was checked,falseotherwise or if no checkbox gadget exists.
-
automaticFileSuffix
public void automaticFileSuffix(PathField ggPath)
Registers aPathFieldto be updated upon format switches. When the user selects a different format, the path's suffix will be updated accordingly.- Parameters:
ggPath- the path field to update ornullto stop updating.
-
fromDescr
public void fromDescr(AudioFileDescr source)
Copy a sound format from the givenAudioFileDescrto the corresponding gadgets in the pane.
-
itemStateChanged
public void itemStateChanged(java.awt.event.ItemEvent e)
- Specified by:
itemStateChangedin interfacejava.awt.event.ItemListener
-
setPreferences
public void setPreferences(java.util.prefs.Preferences prefs)
Description copied from interface:PreferenceNodeSyncEnables Preferences synchronization. This method is not thread safe and must be called from the event thread. When a preference change is received, the GUI is updated and dispatches an event to registered listeners. Likewise, if the user adjusts the GUI value, the preference will be updated. The same is true, if you call one of the value changing methods.- Specified by:
setPreferencesin interfacePreferenceNodeSync- Parameters:
prefs- the preferences node in which the values are stored, or null to disable prefs sync.
-
-