Package org.jjazz.ss_editor.spi
Interface RhythmSelectionDialog.RhythmPreviewProvider
- Enclosing class:
- RhythmSelectionDialog
public static interface RhythmSelectionDialog.RhythmPreviewProvider
The object responsible to preview a rhythm.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
Should be called when provider will no longer be used.Find an implementation in the global lookup.The rhythm currently being previewed.void
previewRhythm
(Rhythm r, Map<RhythmParameter<?>, Object> rpValues, boolean useRhythmTempo, boolean loop, ActionListener endActionListener) Hear a "preview" of the specified rhythm.void
setContext
(Song sg, SongPart spt) Set the context for which the object will preview rhythms.void
stop()
Stop the current preview.
-
Method Details
-
getDefault
Find an implementation in the global lookup.Implementation should be done in another module because we don't want to add music control/generation dependencies in this editor module, which would cause other dependencies problems.
- Returns:
-
setContext
Set the context for which the object will preview rhythms.- Parameters:
sg
- The song for which we preview rhythmspt
- The spt for which rhythm is changed- Throws:
MidiUnavailableException
-
cleanup
void cleanup()Should be called when provider will no longer be used.Enable the provider to release resources or restore settings if needed.
-
previewRhythm
void previewRhythm(Rhythm r, Map<RhythmParameter<?>, Object> rpValues, boolean useRhythmTempo, boolean loop, ActionListener endActionListener) throws MusicGenerationExceptionHear a "preview" of the specified rhythm.If a preview is already being played on a different rhythm, stop it and start a new one. The context must have been set previously.
- Parameters:
r
-rpValues
- The rhythm RhythmParameter values. Can't be null. For non defined values the previewer should use the default RhythmParameter values in this case.useRhythmTempo
- If true use r preferred tempo, otherwise use default tempo.loop
- If true the rhythm preview loops until stop() is called.endActionListener
- Called when preview is complete (if loop disabled) or stopped. Called on the EDT. Can be null if not used.- Throws:
MusicGenerationException
- If a problem occured. endActionListener is not called in this case.
-
getPreviewedRhythm
Rhythm getPreviewedRhythm()The rhythm currently being previewed.- Returns:
- Null if no preview being currently played.
-
stop
void stop()Stop the current preview.Do nothing if isPreviewRunning() returns false. If endActionListener is specified in previewRhythm(), it is called.
-