Class SongSequenceBuilder
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The return value of the buildSongSequence() methods. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuildAll
(boolean silent) Call buildMapRvPhrase() then buildSongSequence().buildMapRvPhrase
(boolean silent) Build the RhythmVoice phrases for the defined context.buildSongSequence
(Map<RhythmVoice, Phrase> rvPhrases) Build the SongSequence from the specified RhythmVoice phrases for the defined context.static String
buildTrackName
(RhythmVoice rv, int channel) Built the Midi track name from the specified parameters.static float
getTempoFactor
(MetaMessage tempoFactorMm) Get the tempo factor [.5;2.0] from the specified MetaMessage.static MetaMessage
getTempoFactorMetaMessage
(float tempoFactor) Get a Meta message which encodes a JJazz tempo factor.void
makeSequenceExportable
(SongSequenceBuilder.SongSequence songSequence, boolean ignoreMidiMixMute) Update the Midi sequence so that it can be exported to external tools (sequencers, Midi editors, etc.).toString()
-
Field Details
-
TEMPO_FACTOR_META_EVENT_TYPE
public static final int TEMPO_FACTOR_META_EVENT_TYPE
-
-
Constructor Details
-
SongSequenceBuilder
- Parameters:
context
- The songContext to build the sequence.
-
-
Method Details
-
buildAll
Call buildMapRvPhrase() then buildSongSequence().- Parameters:
silent
- If true do not show a progress dialog while generating the musical phrases- Returns:
- Throws:
MusicGenerationException
- See Also:
-
buildMapRvPhrase(boolean)
#buildSongSequence(java.util.Map, boolean)
-
buildMapRvPhrase
Build the RhythmVoice phrases for the defined context.- Perform some checks on the context (start chord on each section start, no overlapping chord symbols)
- Ask each used rhythm in the song to produce music (one Phrase per RhythmVoice) via its MusicGenerator implementation.
- Add the user phrases if any
- Apply on each channel possible instrument transpositions, velocity shift, mute (RP_SYS_Mute).
- Apply the RP_SYS_DrumsMix velocity changes. Note that it is expected that, if there is an AdaptedRhythm for a Rhythm which uses RP_SYS_DrumsMix, the AdaptedRhythm reuses the same RP_SYS_DrumsMix instance.
- Apply the RP_SYS_CustomPhrase changes
- Apply the RP_SYS_DrumsTransform changes
- Apply drums rerouting if needed
- Handle the NC chord symbols
Phrases for RhythmVoiceDelegates are merged into the phrases of the source RhythmVoices.
- Parameters:
silent
- If true do not show a progress dialog- Returns:
- The returned phrases always start at beat/bar 0 (i.e phrases are shifted if context start bar is not bar 0).
- Throws:
MusicGenerationException
-
buildSongSequence
Build the SongSequence from the specified RhythmVoice phrases for the defined context.- Create a track 0 with no notes but MidiEvents for song name, time signature changes, TEMPO_FACTOR_META_EVENT_TYPE MetaMessages for the RP_SYS_TempoFactor value (if used by a rhythm).
- Then create a track per RhythmVoice.If songContext range start bar is > 0, the Midi events are shifted to start at sequence tick 0.
- Parameters:
rvPhrases
- The RhythmVoice phrases such as produced by buildMapRvPhrase(boolean), must start at beat 0.- Returns:
- A Sequence containing accompaniment tracks for the songContext, including time signature change Midi meta events and JJazz custom Midi controller messages (MidiConst.CTRL_CHG_JJAZZ_TEMPO_FACTOR) for tempo factor changes.
- See Also:
-
makeSequenceExportable
public void makeSequenceExportable(SongSequenceBuilder.SongSequence songSequence, boolean ignoreMidiMixMute) Update the Midi sequence so that it can be exported to external tools (sequencers, Midi editors, etc.).Get rid of all JJazzLab-only MidiEvents and add some initialization events:
- add copyright message
- remove JJazzLab-specific tempo factor and beat
- add tempo events
- add GM/GS/XG/GM2 reset messages depending of the current OutputSynth configuration
- add reset controllers for each RhythmVoice track
- add bank/program and volume/effects events for each RhythmVoice track
- add a marker for each chord symbol- Parameters:
songSequence
- Must have been created using buildSongSequence() for the current SongContextignoreMidiMixMute
- If true, a track will sound even if it was muted in the context MidiMix- See Also:
-
#buildSongSequence(java.util.Map, boolean)
-
getSongContext
-
toString
-
buildTrackName
Built the Midi track name from the specified parameters.- Parameters:
rv
-channel
-- Returns:
-
getTempoFactorMetaMessage
Get a Meta message which encodes a JJazz tempo factor.- Parameters:
tempoFactor
- A percentage in the [.5;2.0] range.- Returns:
- A MetaMessage with type==TEMPO_FACTOR_META_EVENT_TYPE
-
getTempoFactor
Get the tempo factor [.5;2.0] from the specified MetaMessage.- Parameters:
tempoFactorMm
- MetaMessage type must be TEMPO_FACTOR_META_EVENT_TYPE- Returns:
-