Class StylePart

java.lang.Object
org.jjazz.yamjjazz.rhythm.api.StylePart

public class StylePart extends Object
Data representing a Style Part, e.g. MAIN_A.

For each source Midi channel, store ctab data and SourcePhraseSets.
SourcePhraseSets are stored per ComplexityLevel. There can be several SourcePhraseSets variations for one complexity level. Standard Yamaha styles use only one variation at the default complexity level.
Cntt data is discarded because not used in this version.

  • Field Details

    • DEFAULT_COMPLEXITY_LEVEL

      public static final int DEFAULT_COMPLEXITY_LEVEL
      See Also:
  • Constructor Details

    • StylePart

      public StylePart(StylePartType t)
      Create a StylePart of specified type.

      StylePart is initialized with 1 SourcePhraseSet at DEFAULT_COMPLEXITY_LEVEL.

      Parameters:
      t -
  • Method Details

    • getType

      public StylePartType getType()
    • getCtabChannelSettings

      public CtabChannelSettings getCtabChannelSettings(int channel)
      Get this StylePart's CtabChannelSettings for the specified channel.
      Parameters:
      channel -
      Returns:
    • setCtabChannelSettings

      public void setCtabChannelSettings(int channel, CtabChannelSettings cTab)
      Set the StylePart's CtabChannelSettings for the specified channel.
      Parameters:
      channel -
      cTab -
    • getSizeInBeats

      public float getSizeInBeats()
      Get the size of this stylepart.

      NOTE: might be 0 if music data has not been loaded yet (see isMusicLoaded()).

      Returns:
    • setSizeInBeats

      public void setSizeInBeats(float sizeInBeats)
      Set the size of this stylepart : must be consistent with the actual source phrases size.

      Parameters:
      sizeInBeats - Must be an integer value.
    • addSourcePhraseSet

      public void addSourcePhraseSet(SourcePhraseSet sps, int complexity)
      Add a SourcePhraseSet for the specified complexity level.

      There can be several SourcePhraseSets variations for a given complexity level. Size in beats of the source phrases must be consistent with getSizeInBeats().

      Parameters:
      sps -
      complexity - An integer > 0
    • getComplexityLevels

      public List<Integer> getComplexityLevels()
      The complexity levels for which there is at least 1 SourcePhraseSet.
      Returns:
      A list with an ascending order.
    • getSourcePhraseSet

      public SourcePhraseSet getSourcePhraseSet(int complexity, int variationIndex)
      Get the SourcePhraseSet for the specified parameters.
      Parameters:
      complexity - An integer > 0
      variationIndex - The index of the variation phrase >=0
      Returns:
      Can be null
    • getSourcePhraseSet

      public SourcePhraseSet getSourcePhraseSet(int complexity, String propName, String propValue)
      Get the SourcePhraseSet which match the specified parameters.
      Parameters:
      complexity -
      propName - the name of the property to check
      propValue - The value of the of the property to check. Can be null to check if property is not set.
      Returns:
      Null if not found
    • getSourcePhraseSets

      public List<SourcePhraseSet> getSourcePhraseSets(int complexity)
      Get the list of SourcePhraseSets for the specified complexity.
      Parameters:
      complexity -
      Returns:
    • isMusicLoaded

      public boolean isMusicLoaded()
      Check if music data has been loaded for this StylePart.
      Returns:
      True if there is at least one non-empty SourcePhraseSet for a given complexity level with one SourcePhrase inside.
    • clearMusicData

      public void clearMusicData(int complexityLevel)
      Remove the music data for the specified complexity level.

      This calls clear() on each SourcePhraseSet of this complexityLevel.

      Parameters:
      complexityLevel - If value is < 1, remove music data for all the complexity levels.
    • getSourceChannels

      public List<Integer> getSourceChannels(AccType at, Note rootNote, YamChord yc)
      Get the source channels matching the parameters.

      There might have 0, 1 or more channels for the specified AccType and chord symbol. There are 2 (or more) channels when each channel handles a part of the chord, e.g one channel for the 1+5 notes, another for the 3+7 notes.

      Channels match if :
      - same AccType as at
      - rootNote is not muted
      - chord is not muted

      Parameters:
      at - If null, parameter is ignored
      rootNote - If null, parameter is ignored.
      yc - If null, parameter is ignored.
      Returns:
      The channels which match the parameters.
    • getAccTypes

      public List<AccType> getAccTypes()
      The AccParts used by this object, in ascending channel order.
      Returns:
    • getAccType

      public AccType getAccType(int channel)
      Get the AccType for a specified channel (which can be a "secondary" source channel or the "main" one).
      Parameters:
      channel -
      Returns:
      Null if this channel is not used.
    • dump

      public void dump(boolean showMusicData, boolean showCtab)
    • toString

      public String toString()
      Overrides:
      toString in class Object