Class ChordSymbolTextInput

java.lang.Object
org.jjazz.chordsymboltextinput.api.ChordSymbolTextInput

public class ChordSymbolTextInput extends Object
Define methods how to convert CLI_ChordSymbols from/to Strings.
  • Field Details

  • Constructor Details

    • ChordSymbolTextInput

      public ChordSymbolTextInput()
  • Method Details

    • toCLI_ChordSymbol

      public static CLI_ChordSymbol toCLI_ChordSymbol(String str, Position defaultPos, ChordLeadSheet cls) throws ParseException
      Return a new CLI_ChordSymbol built from specified string.

      Recognized strings:
      "C7" => C7 at pos=defaultPos
      "C7[2]" => C7 at pos=defaultPos.getBar()/beat 2
      "C7[1:2]" => C7 at pos=bar 1/beat 2

      Parameters:
      str - As produced by ChordSymboInput.toString(CLI_ChordSymbol).
      defaultPos - Used when position data is missing in str.
      cls - The container for this CLI_ChordSymbol.
      Returns:
      Throws:
      ParseException
    • toCLI_ChordSymbolsNoPosition

      public static List<CLI_ChordSymbol> toCLI_ChordSymbolsNoPosition(String str, int barIndex, ChordLeadSheet cls, boolean swing) throws ParseException
      Analyze a string describing a bar like "C Fm7" and return the list of CLI_ChordSymbols.

      If 1 chord, beat=0.
      If 2 chords, second chord is at the "half" of the bar.
      If 3 chords, second chord is at the "half" of the bar and last one on last beat
      If more chords place them at regular intervals.

      Parameters:
      str -
      barIndex -
      cls -
      swing - If true for example for 3/4 time signature place half-beat chord symbols at 1.666 (5/3) instead of 1.5
      Returns:
      Throws:
      ParseException - When thrown, GetErrorOffset() represents the faulty chord symbol index.
    • toBarString

      public static String toBarString(TimeSignature ts, List<? extends CLI_ChordSymbol> items)
      Make a string representing the bar chord symbols.
      This string can be used as input for toCLI_ChordSymbols().
      Parameters:
      ts - The TimeSignature of the bar.
      items - The chord symbols in the bar.
      Returns:
    • toStringNoPosition

      public static String toStringNoPosition(List<? extends CLI_ChordSymbol> items)
      A String like "C7 Am7 D"
      Parameters:
      items -
      Returns:
    • toString

      public static String toString(CLI_ChordSymbol cli, ChordSymbolTextInput.PositionDisplay pDisplay)
      Return a CLI_ChordSymbol as a string. Returned String can be used as an input for toCLI_ChordSymbol().

      Parameters:
      cli -
      pDisplay - Define how position is represented.
      Returns: