Interface PhraseTransform

All Superinterfaces:
Comparable<PhraseTransform>
All Known Implementing Classes:
DrumsMixTransform

public interface PhraseTransform extends Comparable<PhraseTransform>
An object which can transform a phrase into another one.
  • Field Details

  • Method Details

    • getInfo

      Get the information for this transform.
      Returns:
    • transform

      SizedPhrase transform(SizedPhrase inPhrase, SongPartContext context)
      Transform inPhrase into another phrase.

      The optional context must match inPhrase beat range. Context can be used to retrieve additional information, e.g.:
      - the chord symbols used in the phrase
      - the target RhythmVoice (or RhythmVoiceDelegate) for the phrase, obtained via context.getMidiMix().getRhythmVoice(inPhrase.getChannel()).
      - the InstrumentMix used for the phrase, obtained via context.getMidiMix().getInstrumentMixFromChannel(inPhrase.getChannel()).

      Parameters:
      inPhrase -
      context - Can be null. An optional context to provide additional information about inPhrase.
      Returns:
      The new transformed phrase.
      Throws:
      IllegalArgumentException - If context is non-null and its beat range differs from the beat range of inPhrase.
    • getFitScore

      int getFitScore(SizedPhrase inPhrase, SongPartContext context)
      Return a [0-100] value which indicates how much this transform is adapted for the specified parameters.

      A PhraseTransform which can not work without a context should return 0 if context is null.

      Parameters:
      inPhrase -
      context - Can be null. An optional context to provide additional information about inPhrase.
      Returns:
      0 means this transform is not adapted at all, 100 means this transform is perfectly fit for this context.
      See Also:
    • getCopy

      PhraseTransform getCopy()
      Get a copy of this PhraseTransform instance.
      Returns:
    • compareTo

      default int compareTo(PhraseTransform pt)
      Compare using alphabetical order first on category, then on name.
      Specified by:
      compareTo in interface Comparable<PhraseTransform>
      Parameters:
      pt -
      Returns:
    • getProperties

      PtProperties getProperties()
      Get the PhraseTransform properties.
      Returns:
      Can't be null (but can be empty)
    • showUserSettingsDialog

      default void showUserSettingsDialog(Component anchor)
      Show a modal dialog to modify the user settings of this PhraseTransform.

      The PhraseTransform is responsible for the persistence of its settings. The method does nothing if hasUserSettings() returns false.

      Parameters:
      anchor - The anchor component to adjust dialog location.
      See Also:
    • hasUserSettings

      default boolean hasUserSettings()
      Return true if PhraseTransform has settings which can be modified by end-user.

      Returns:
      See Also:
      • showUserSettingsDialog()
    • equals

      static boolean equals(PhraseTransform pt1, Object o2)
      Helper method to implement PhraseTransform subclass equals(Object) method.

      2 PhraseTransforms are equal when they have same uniqueId and same property/value pairs.

      Parameters:
      pt1 -
      o2 -
      Returns:
    • hashCode

      static int hashCode(PhraseTransform pt)
      Helper method to implement PhraseTransform subclass hashCode() method.

      Rely on uniqueId and properties.

      Parameters:
      pt -
      Returns:
    • saveAsString

      static String saveAsString(PhraseTransform pt)
      A string like "uniqueId#prop1=value1,prop=value2".

      If no property set, return "uniqueId#".

      Parameters:
      pt -
      Returns:
      See Also:
    • loadFromString

      static PhraseTransform loadFromString(String s) throws ParseException
      Try to get a PhraseTransform instance from the specified save string.
      Parameters:
      s -
      Returns:
      Null if not found.
      Throws:
      ParseException
      See Also: