com.frinika.sequencer.model
Class MidiPart

java.lang.Object
  extended by com.frinika.sequencer.model.Part
      extended by com.frinika.sequencer.model.MidiPart
All Implemented Interfaces:
Item, EditHistoryRecordable, EditHistoryRecorder<MultiEvent>, MenuPlugable, Selectable, java.io.Serializable
Direct Known Subclasses:
MidiPartGhost

public class MidiPart
extends Part
implements EditHistoryRecorder<MultiEvent>

Contains a List of MultiEvents. Belongs to a lane.

Author:
Paul
See Also:
Serialized Form

Nested Class Summary
protected  class MidiPart.MidiPartPropertiesPanel
          Instance returned via createProperitesPanel().
 
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
MidiPart()
           
MidiPart(MidiLane lane)
          Constructor for an MidiPart.
 
Method Summary
 void add(MultiEvent ev)
          Add a MultiEvent to the track.
 void addCommitListener(CommitListener l)
           
 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 deltaTick, Lane dst)
           
protected  OptionsEditor createPropertiesPanel(ProjectFrame frame)
          Create PropertiesPanel.
 Selectable deepCopy(Selectable parent)
          Complete copy of object.
 void deepMove(long tick)
          Move object and all children by tick
 void drawThumbNail(java.awt.Graphics2D g, java.awt.Rectangle rect, PartView panel)
           
 EditHistoryContainer getEditHistoryContainer()
           
 int getMidiChannel()
           
 java.util.SortedSet<MultiEvent> getMultiEvents()
          Returns the multievent array.
 java.util.SortedSet<MultiEvent> getMultiEventSubset(long startTick, long endTick)
          Returns a subset of the multievent array including startTick excluding endTick
 java.lang.String getName()
           
 int[] getPitchRange()
          deprecated
 FrinikaTrackWrapper getTrack()
           
 void importFromMidiTrack(long startTickArg, long endTickArg)
          Import Midi events into a Part from a section of track.
 void importFromMidiTrack(javax.sound.midi.Track track, long startTickArg, long endTickArg)
          Import Midi events into a Part from a section of track.
protected  void initContextMenu(ProjectFrame frame, javax.swing.JPopupMenu popup)
          Fills the part's context menu with menu-items.
 void moveContentsBy(double dTick, Lane dstLane)
          move the contents by tick into dstLane
protected  void moveItemsBy(long deltaTick)
          Make sure part is detached before calling this then reattach after This operation does not change the database rep so we do not call setChanged()
 void onLoad()
          Commit the MultiEvents as MidiEvents to a Sequencers Track event list.
 void rebuildMultiEventEndTickComparables()
           
 void remove(MultiEvent multiEvent)
          Remove a MultiEvent from the track
 void removeCommitListener(CommitListener l)
           
 void restoreFromClone(EditHistoryRecordable o)
          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 setBoundsFromEvents()
          Rebuild the bounds from the multievent startTicks
 void setName(java.lang.String name)
           
 
Methods inherited from class com.frinika.sequencer.model.Part
addPluginRightButtonMenu, addToModel, createPropertiesDialog, displayStructure, getColor, getDuration, getDurationInSecs, getDurationInTicks, getEditParent, getEnd, getEndInSecs, getEndTick, getEventBounds, getLane, getMultiPart, getPartResourceId, getRootPart, getStart, getStartInSecs, getStartTick, getTransparentColor, isAttached, isSelected, leftTickForMove, moveBy, removeFromModel, rightTickForMove, setChanged, setColor, setEditParent, setEndInSecs, setEndTick, setMultiPart, setPartResourceId, setRootPart, setSelected, setStartInSecs, setStartTick, showContextMenu, showPropertiesDialog, showRightButtonMenu
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MidiPart

public MidiPart()

MidiPart

public MidiPart(MidiLane lane)
Constructor for an MidiPart.

Parameters:
lane -
Method Detail

setBoundsFromEvents

public void setBoundsFromEvents()
Rebuild the bounds from the multievent startTicks


importFromMidiTrack

public void importFromMidiTrack(long startTickArg,
                                long endTickArg)
Import Midi events into a Part from a section of track. Notes with start ticks in the range and inserted and the end events will be found and added. (So end events may be outside the bounds)

Parameters:
startTickArg - start tick (inclusive)
endTickArg - end tick (exclusive)

importFromMidiTrack

public void importFromMidiTrack(javax.sound.midi.Track track,
                                long startTickArg,
                                long endTickArg)
Import Midi events into a Part from a section of track. Notes with start ticks in the range and inserted and the end events will be found and added. (So end events may be outside the bounds)

Parameters:
startTickArg - start tick (inclusive)
endTickArg - end tick (exclusive)

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

add

public void add(MultiEvent ev)
Add a MultiEvent to the track. The client is responsible for adjusting the Part bounds is need be.

Specified by:
add in interface EditHistoryRecorder<MultiEvent>
Parameters:
ev -

remove

public void remove(MultiEvent multiEvent)
Remove a MultiEvent from the track

Specified by:
remove in interface EditHistoryRecorder<MultiEvent>
Parameters:
multiEvent -

commitEventsRemove

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

Specified by:
commitEventsRemove in class Part

getMultiEvents

public java.util.SortedSet<MultiEvent> getMultiEvents()
Returns the multievent array.

Returns:

getMultiEventSubset

public java.util.SortedSet<MultiEvent> getMultiEventSubset(long startTick,
                                                           long endTick)
Returns a subset of the multievent array including startTick excluding endTick

Parameters:
startTick -
endTick -
Returns:

getTrack

public FrinikaTrackWrapper getTrack()

getMidiChannel

public int getMidiChannel()

getEditHistoryContainer

public EditHistoryContainer getEditHistoryContainer()

moveItemsBy

protected void moveItemsBy(long deltaTick)
Make sure part is detached before calling this then reattach after This operation does not change the database rep so we do not call setChanged()

Specified by:
moveItemsBy 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

restoreFromClone

public void restoreFromClone(EditHistoryRecordable o)
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

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

commitEventsAdd

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

copyBy

public void copyBy(double deltaTick,
                   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 tick)
Description copied from interface: Selectable
Move object and all children by tick

Specified by:
deepMove in interface Selectable

rebuildMultiEventEndTickComparables

public void rebuildMultiEventEndTickComparables()

getPitchRange

public int[] getPitchRange()
deprecated


onLoad

public void onLoad()
Commit the MultiEvents as MidiEvents to a Sequencers Track event list.

Specified by:
onLoad in class Part

drawThumbNail

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

addCommitListener

public void addCommitListener(CommitListener l)

removeCommitListener

public void removeCommitListener(CommitListener l)

initContextMenu

protected void initContextMenu(ProjectFrame frame,
                               javax.swing.JPopupMenu popup)
Fills the part's context menu with menu-items.

Overrides:
initContextMenu in class Part
Parameters:
popup -

createPropertiesPanel

protected OptionsEditor createPropertiesPanel(ProjectFrame frame)
Create PropertiesPanel.

Overrides:
createPropertiesPanel in class Part
Parameters:
frame -
Returns: