Interface SongContext
- All Known Subinterfaces:
SongPartContext
public interface SongContext
A Song music generation context.
Associates a Song, a MidiMix and a bar range within that song.
-
Method Summary
Modifier and TypeMethodDescriptionclone()Shallow cloning which reuses the same song and midi mix.Music should be produced for the song's bar range.default FloatRangeThe beat range within the song for which music should be produced.getDeepCopy(boolean disableInternalUpdates) Deep copy the Song and the MidiMix.intThe bar to restart from after last bar was played, when playback is in loop mode.getMergedBarRanges(Rhythm r, RhythmParameter<E> rp, E rpValue) Get the bar ranges in this context whose SongParts use rpValue.Music should be produced for this MidiMix.getSong()Music should be produced for this song.Get all the song parts contained in this context bar range.default IntRangegetSptBarRange(SongPart spt) Get the intersection between the song part bar range and this SongContext bar range.default FloatRangegetSptBeatRange(SongPart spt) Get the intersection between the song part beat range and this SongContext beat range.default LongRangegetSptTickRange(SongPart spt) Get the range of ticks of spt belonging to this context.default LongRangeThe tick range corresponding to getBarRange() or getBeatRange().Get the list of unique rhythms used in this context.default List<RhythmVoice> Get the list of unique rhythm voices used in this context.default List<CLI_Section> Get the unique parent sections used by the context song parts.default booleanCheck if the specified spt has at least one bar in the range of this context.default PositiontoClsPosition(long relativeTick) Converts a tick position relative to this context into a ChordLeadSheet Position.default PositiontoPosition(long relativeTick) Converts a tick position relative to this context into an absolute SongStructure Position.default floattoPositionInBeats(long relativeTick) Converts a tick position relative to this context into an absolute SongStructure position in beats.default longtoRelativeTick(Position pos) Compute the tick relative to this context for the given absolute position expressed in bar/beat.
-
Method Details
-
getMidiMix
-
getSong
-
getBarRange
-
getLoopRestartBar
int getLoopRestartBar()The bar to restart from after last bar was played, when playback is in loop mode.- Returns:
- A value within getBarRange(). By default returns getBarRange().from.
-
getDeepCopy
Deep copy the Song and the MidiMix.- Parameters:
disableInternalUpdates- If true the returned Song instance will have internal consistency updates disabled, e.g. changing a section in the ChordLeadSheet won't impact the SongStructure. The returned MidiMix instance will also not be associated to the Song copy. For special purposes only, this can lead to inconsistent states.- Returns:
-
clone
-
getBeatRange
The beat range within the song for which music should be produced.The range can start/end anywhere in the song (including in the middle of a song part). If getBarRange().from > 0 then toBeatRange().from is also > 0.
- Returns:
-
getSongParts
-
getTickRange
The tick range corresponding to getBarRange() or getBeatRange().The range can start/end anywhere in the song (including in the middle of a song part). If toBeatRange().from > 0 then getTickRange().from is also > 0.
- Returns:
-
getSptBarRange
-
getSptBeatRange
Get the intersection between the song part beat range and this SongContext beat range.- Parameters:
spt-- Returns:
-
getSptTickRange
-
getMergedBarRanges
Get the bar ranges in this context whose SongParts use rpValue.Adjacent BarRanges are merged in the returned list.
- Type Parameters:
E-- Parameters:
r-rp- A RhythmParameter from rrpValue- A value for rp- Returns:
- Can be empty
-
getUniqueRhythms
-
getUniqueRhythmVoices
Get the list of unique rhythm voices used in this context.- Returns:
-
getUniqueSections
Get the unique parent sections used by the context song parts.- Returns:
- An ordered list by position
-
isInRange
Check if the specified spt has at least one bar in the range of this context.- Parameters:
spt-- Returns:
-
toClsPosition
Converts a tick position relative to this context into a ChordLeadSheet Position.- Parameters:
relativeTick-- Returns:
- Null if tick is out of the bounds of this context.
-
toRelativeTick
Compute the tick relative to this context for the given absolute position expressed in bar/beat.- Parameters:
pos-- Returns:
- -1 if pos is outside this context range. Returns 0 for the first bar/beat of the context range.
-
toPosition
Converts a tick position relative to this context into an absolute SongStructure Position.- Parameters:
relativeTick- 0 for the start of this context bar range.- Returns:
- Null if tick is out of the bounds of this context.
-
toPositionInBeats
default float toPositionInBeats(long relativeTick) Converts a tick position relative to this context into an absolute SongStructure position in beats.- Parameters:
relativeTick- 0 for the start of this context bar range.- Returns:
- -1 if tick is out of the bounds of this context.
-