com.frinika.sequencer.model
Class AudioPart

java.lang.Object
  extended by com.frinika.sequencer.model.Part
      extended by com.frinika.sequencer.model.AudioPart
All Implemented Interfaces:
AudioReaderFactory, Item, EditHistoryRecordable, MenuPlugable, Selectable, java.io.Serializable

public class AudioPart
extends Part
implements AudioReaderFactory

See Also:
Serialized Form

Nested Class Summary
 class AudioPart.Envelope
           
 
Nested classes/interfaces inherited from class com.frinika.sequencer.model.Part
Part.PropertiesPanel
 
Field Summary
 
Fields inherited from class com.frinika.sequencer.model.Part
lane, selected
 
Constructor Summary
AudioPart()
           
AudioPart(AudioLane lane)
           
AudioPart(Lane lane, java.io.File clipFile, double startTimeInMicros)
          Creates a new AudioPart.
 
Method Summary
 void addToModel()
          Add to the model making sure the history is informed
 java.lang.Object clone()
          If restoration from a clone is needed - this method should return a clone otherwise throw the CloneNotSupportedException
 void commitEventsAdd()
           
 void commitEventsRemove()
          Called when part is removed from the model
 void copyBy(double tick, Lane dst)
           
 AudioReader createAudioReader()
          A non realtime Reader for a raw view at the data.
 Selectable deepCopy(Selectable parent)
          Complete copy of object.
 void deepMove(long dTick)
          Move object and all children by tick
 void drawEnvelope(java.awt.Graphics2D g, java.awt.Rectangle rect, PartView view)
           
 void drawThumbNail(java.awt.Graphics2D g, java.awt.Rectangle rect, PartView panel)
           
 java.io.File getAudioFile()
           
 uk.org.toot.audio.core.AudioProcess getAudioProcess()
           
 double getDurationInSecs()
           
 double getEndInSecs()
           
 long getEndTick()
           
 AudioPart.Envelope getEvelope()
           
 int getHoverState(java.awt.Point p, java.awt.Rectangle rect)
           
 double getStartInSecs()
           
 long getStartTick()
           
protected  void initContextMenu(ProjectFrame frame, javax.swing.JPopupMenu popup)
          To be extended by subclasses.
 void moveContentsBy(double dTick, Lane dstLane)
          move the contents by tick into dstLane
protected  void moveItemsBy(long deltaTick)
           
 void onLoad()
           
 void refreshEnvelope()
           
 void restoreFromClone(EditHistoryRecordable object)
          On removal the EditHistoryContainer will attempt to clone the object - and if restored later it will use the restoreFromClone method to restore the cloned data on the original instance.
 void setEndInSecs(double end)
           
 void setEndTick(long tick)
           
 void setStartInSecs(double start)
           
 void setStartTick(long tick)
           
 java.lang.String toString()
           
 
Methods inherited from class com.frinika.sequencer.model.Part
addPluginRightButtonMenu, createPropertiesDialog, createPropertiesPanel, displayStructure, getColor, getDuration, getDurationInTicks, getEditParent, getEnd, getEventBounds, getLane, getMultiPart, getPartResourceId, getRootPart, getStart, getTransparentColor, isAttached, isSelected, leftTickForMove, moveBy, removeFromModel, rightTickForMove, setChanged, setColor, setEditParent, setEndTick, setMultiPart, setPartResourceId, setRootPart, setSelected, setStartTick, showContextMenu, showPropertiesDialog, showRightButtonMenu
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AudioPart

public AudioPart(AudioLane lane)

AudioPart

public AudioPart()

AudioPart

public AudioPart(Lane lane,
                 java.io.File clipFile,
                 double startTimeInMicros)
Creates a new AudioPart. To use the AudioPart call onLoad() (normally done be the AudioLane).

Parameters:
lane - add part to this lane. Can be null for a detached part.
clipFile - .wav file of audio
startTimeInMicros - postition first sample in micros
Method Detail

refreshEnvelope

public void refreshEnvelope()

getAudioFile

public java.io.File getAudioFile()

moveItemsBy

protected void moveItemsBy(long deltaTick)
Specified by:
moveItemsBy in class Part

addToModel

public void addToModel()
Description copied from interface: Selectable
Add to the model making sure the history is informed

Specified by:
addToModel in interface Selectable
Overrides:
addToModel in class Part

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Description copied from interface: EditHistoryRecordable
If restoration from a clone is needed - this method should return a clone otherwise throw the CloneNotSupportedException

Specified by:
clone in interface EditHistoryRecordable
Specified by:
clone in class Part
Returns:
Throws:
java.lang.CloneNotSupportedException

restoreFromClone

public void restoreFromClone(EditHistoryRecordable object)
Description copied from interface: EditHistoryRecordable
On removal the EditHistoryContainer will attempt to clone the object - and if restored later it will use the restoreFromClone method to restore the cloned data on the original instance.

Specified by:
restoreFromClone in interface EditHistoryRecordable

copyBy

public void copyBy(double tick,
                   Lane dst)
Specified by:
copyBy in class Part

deepCopy

public Selectable deepCopy(Selectable parent)
Description copied from interface: Selectable
Complete copy of object.

Specified by:
deepCopy in interface Selectable
Parameters:
parent - owner of the new object;
Returns:

deepMove

public void deepMove(long dTick)
Description copied from interface: Selectable
Move object and all children by tick

Specified by:
deepMove in interface Selectable

getStartTick

public long getStartTick()
Overrides:
getStartTick in class Part
Returns:
start of the part in ticks

getEndTick

public long getEndTick()
Overrides:
getEndTick in class Part
Returns:
end tick of the part

getDurationInSecs

public double getDurationInSecs()
Overrides:
getDurationInSecs in class Part
Returns:
length of the part in secs

getStartInSecs

public double getStartInSecs()
Overrides:
getStartInSecs in class Part
Returns:
start of the part in secs

getEndInSecs

public double getEndInSecs()
Overrides:
getEndInSecs in class Part
Returns:
end of the part in secs

commitEventsRemove

public void commitEventsRemove()
Description copied from class: Part
Called when part is removed from the model

Specified by:
commitEventsRemove in class Part

commitEventsAdd

public void commitEventsAdd()
Specified by:
commitEventsAdd in class Part

onLoad

public void onLoad()
            throws java.io.FileNotFoundException
Specified by:
onLoad in class Part
Throws:
java.io.FileNotFoundException

createAudioReader

public AudioReader createAudioReader()
                              throws java.io.IOException
A non realtime Reader for a raw view at the data.

Specified by:
createAudioReader in interface AudioReaderFactory
Returns:
Throws:
java.io.IOException

drawThumbNail

public void drawThumbNail(java.awt.Graphics2D g,
                          java.awt.Rectangle rect,
                          PartView panel)
Specified by:
drawThumbNail in class Part

moveContentsBy

public void moveContentsBy(double dTick,
                           Lane dstLane)
Description copied from class: Part
move the contents by tick into dstLane

Specified by:
moveContentsBy in class Part

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getAudioProcess

public uk.org.toot.audio.core.AudioProcess getAudioProcess()
Returns:
output process to play audio

setStartTick

public void setStartTick(long tick)

setEndTick

public void setEndTick(long tick)
Parameters:
tick - new end tick for display purpose only

drawEnvelope

public void drawEnvelope(java.awt.Graphics2D g,
                         java.awt.Rectangle rect,
                         PartView view)

getHoverState

public int getHoverState(java.awt.Point p,
                         java.awt.Rectangle rect)

getEvelope

public AudioPart.Envelope getEvelope()

initContextMenu

protected void initContextMenu(ProjectFrame frame,
                               javax.swing.JPopupMenu popup)
To be extended by subclasses.

Overrides:
initContextMenu in class Part
Parameters:
popup -

setStartInSecs

public void setStartInSecs(double start)
Overrides:
setStartInSecs in class Part

setEndInSecs

public void setEndInSecs(double end)
Overrides:
setEndInSecs in class Part