Class ControlTrack

java.lang.Object
org.jjazz.musiccontrol.api.ControlTrack

public class ControlTrack extends Object
A control track contains custom MetaEvents used by the MusicController to fire PlaybackListener events.

- a trackname event
- a MetaEvent for each chord symbol.
- a MetaEvent for each beat changel.

Methods are provided to extract the original data from these custom MetaEvents.

  • Field Details

    • POSITION_META_EVENT_TYPE

      public static final int POSITION_META_EVENT_TYPE
      See Also:
    • CHORD_SYMBOL_META_EVENT_TYPE

      public static final int CHORD_SYMBOL_META_EVENT_TYPE
      See Also:
    • TRACK_NAME

      public static String TRACK_NAME
  • Constructor Details

    • ControlTrack

      public ControlTrack(SongContext sgContext, int trackId)
      Create a control track for the specified SongContext.
      Parameters:
      sgContext -
      trackId -
  • Method Details

    • getTrackId

      public int getTrackId()
    • getMidiEvents

      public List<MidiEvent> getMidiEvents()
      The list of MidiEvents of the control track: track name, beat changes, chord symbol changes.
      Returns:
      Can't be null. IMPORTANT: events may NOT be ordered by tick position.
    • getContextChordGetSequence

      public SongChordSequence getContextChordGetSequence()
      The chord sequence used to generate the control track events.
      Returns:
      Can't be null
    • fillTrack

      public void fillTrack(Track track)
      Fill the specified track with this control track MidiEvents.
      Parameters:
      track -
    • getChordSymbol

      public CLI_ChordSymbol getChordSymbol(MetaMessage mm)
      Retrieve the chord symbol from a control track MetaMessage.
      Parameters:
      mm - A MetaMessage with type==CHORD_SYMBOL_META_EVENT_TYPE
      Returns:
      Can be null if mm is unknown
    • getPosition

      public Position getPosition(MetaMessage mm)
      Retrieve the Position from a control track MetaMessage.
      Parameters:
      mm - A MetaMessage with type==POSITION_META_EVENT_TYPE
      Returns:
      Can be null if mm is unknown
    • getPositionInBeats

      public float getPositionInBeats(MetaMessage mm)
      Retrieve the position in beats from a control track MetaMessage.
      Parameters:
      mm - A MetaMessage with type==POSITION_META_EVENT_TYPE
      Returns:
      -1 if mm is unknown
    • toString

      public String toString()
      Overrides:
      toString in class Object