public class AudioOverviewVisualisation extends VisualisationImpl<AudioStream> implements TimelineObject
VisualisationImpl and a TimelineObject. This
means that it can be used to plot a complete visualisation of the overview of
the data or it can be used to plot temporal parts of the data into the
visualisation window.
An internal class (AudioOverviewGenerator) can be used to generate overviews if necessary.
This class also extends TimelineObjectAdapter which allows an audio
waveform to be put upon a timeline.
| Modifier and Type | Class and Description |
|---|---|
class |
AudioOverviewVisualisation.AudioOverviewGenerator
Generates an audio overview.
|
JPanel.AccessibleJPanelJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
long |
millisecondsInView
The calculation of how many milliseconds are in the last generated view
at the resampled overview.
|
long |
numberOfProcessedSamples
The number of samples that were originally read in from the data
|
clearBeforeDraw, data, visImagelistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
AudioOverviewVisualisation(AudioStream as)
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
static MBFImage |
getAudioWaveformImage(AudioStream a,
int w,
int h,
Float[] backgroundColour,
Float[] colour)
Generates a waveform image that fits within the given width and height
and drawn in the given colour.
|
long |
getEndTimeMilliseconds()
Returns the end time of the timeline object in the timeline.
|
long |
getLength()
Returns the length of the audio data in milliseconds.
|
long |
getStartTimeMilliseconds()
Returns the start time of the timeline object in the timeline.
|
MBFImage |
plotAudioWaveformImage(int w,
int h,
Float[] backgroundColour,
Float[] colour)
Generates a waveform image that fits within the given width and height
and drawn in the given colour.
|
void |
setDataPixelTransformer(DataUnitsTransformer<Float[],double[],int[]> dpt)
The timeline object will need to know how to convert between
time and pixels, and the
DataUnitsTransformer given here
should be able to do that. |
void |
setStartTimeMilliseconds(long l)
Set the start time of this object
|
void |
update()
Called to update the visualisation.
|
addOverlay, componentHidden, componentMoved, componentResized, componentShown, getRequiredSize, getVisualisationImage, isAllowResize, newVisualisationAvailable, paint, removeOverlay, setAllowResize, setClearBeforeDraw, setData, setRequiredSize, showWindow, update, updateVis, updateVisgetAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, 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, 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, unregisterKeyboardActionadd, 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, validateTreeaction, 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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetPreferredSize, getRequiredSizegetVisualisationImage, setRequiredSize, updateVispublic long millisecondsInView
public long numberOfProcessedSamples
public AudioOverviewVisualisation(AudioStream as)
as - The audio data to plotpublic static MBFImage getAudioWaveformImage(AudioStream a, int w, int h, Float[] backgroundColour, Float[] colour)
a - The audio to draww - The width of the image to returnh - The height of the image to returnbackgroundColour - The background colour to draw on the imagecolour - The colour in which to draw the audio waveform.public MBFImage plotAudioWaveformImage(int w, int h, Float[] backgroundColour, Float[] colour)
If you require information about the plot afterwards you can check the fields that are stored within this instance.
w - The width of the image to returnh - The height of the image to returnbackgroundColour - The background colour to draw on the imagecolour - The colour in which to draw the audio waveform.public long getLength()
public long getStartTimeMilliseconds()
getStartTimeMilliseconds in interface TimelineObjectTimelineObjectAdapter.getStartTimeMilliseconds()public long getEndTimeMilliseconds()
getEndTimeMilliseconds in interface TimelineObjectTimelineObjectAdapter.getEndTimeMilliseconds()public void update()
visImage member to be available and of the correct size.
The method simply needs to draw the visualisation to this MBFImage.
You should wrap any drawing code in a synchronized block, synchronized on
the visImage - this stops the image being repainted to the screen half way
through drawing.
Update is called from the paint() method so should ideally not force a repaint() as this will call a continuous repaint loop.
update in class VisualisationImpl<AudioStream>VisualisationImpl.update()public void setStartTimeMilliseconds(long l)
setStartTimeMilliseconds in interface TimelineObjectl - The start time in millisecondsTimelineObject.setStartTimeMilliseconds(long)public void setDataPixelTransformer(DataUnitsTransformer<Float[],double[],int[]> dpt)
DataUnitsTransformer given here
should be able to do that. Use it to paint the image.setDataPixelTransformer in interface TimelineObjectTimelineObject.setDataPixelTransformer(org.openimaj.vis.DataUnitsTransformer)