Package org.jjazz.musiccontrol.api
Class SongMusicGenerationListener
java.lang.Object
org.jjazz.musiccontrol.api.SongMusicGenerationListener
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
A helper class to be notified when a song and other elements have changed in a way that will impact music generation for that song.
The class fires a PROP_CHANGED change event when it receives a PROP_MUSIC_GENERATION property change from Song, MidiMix, and PlaybackSettings.
A black-list mechanism can be used to filter out some PROP_MUSIC_GENERATION source events. A delay can be set before firing the ChangeEvent, in order to automatically filter out rapid successive changes.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
oldValue = the name of the Song/MidiMix/PlaybackSettings source property change event (PROP_MUSIC_GENERATION).
newValue = optional data associated to the source property change event (PROP_MUSIC_GENERATION). -
Constructor Summary
ConstructorDescriptionSongMusicGenerationListener
(Song song, MidiMix midiMix, int preFireChangeEventDelayMs) Construct a SongMusicGenerationListener. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a listener to be notified when a music generation impacting change has occured.void
cleanup()
int
The delay to wait before firing a PROP_CHANGED event.getSong()
void
void
void
setBlackList
(Set<String> blackList) Black list some source PROP_MUSIC_GENERATION events by their property name or actionId: those source events won't trigger a ChangeEvent from this instance.
-
Field Details
-
PROP_CHANGED
oldValue = the name of the Song/MidiMix/PlaybackSettings source property change event (PROP_MUSIC_GENERATION).
newValue = optional data associated to the source property change event (PROP_MUSIC_GENERATION).- See Also:
-
-
Constructor Details
-
SongMusicGenerationListener
Construct a SongMusicGenerationListener.- Parameters:
song
-midiMix
-preFireChangeEventDelayMs
- The delay in ms before firing a PROP_CHANGED event.- See Also:
-
-
Method Details
-
getSong
-
getMidiMix
-
cleanup
public void cleanup() -
getPreFireChangeEventDelayMs
public int getPreFireChangeEventDelayMs()The delay to wait before firing a PROP_CHANGED event.Delay is activated when receiving a PROP_MUSIC_GENERATION event. When the delay expires a PROP_CHANGED event is fired using the last PROP_MUSIC_GENERATION received while the delay was running.
- Returns:
- A value in milliseconds.
-
getBlackList
-
setBlackList
Black list some source PROP_MUSIC_GENERATION events by their property name or actionId: those source events won't trigger a ChangeEvent from this instance.Property names or actionId of Song, ChordLeadSheet, SongStructure, MidiMix, or PlaybackSettings.
- Parameters:
blackList
- Can be null
-
addPropertyChangeListener
Add a listener to be notified when a music generation impacting change has occured.- Parameters:
listener
-
-
removePropertyChangeListener
-
propertyChange
- Specified by:
propertyChange
in interfacePropertyChangeListener
-