Class PlaybackSettings
Property change events are fired when settings are modified.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static class
-
Field Summary
Modifier and TypeFieldDescriptionstatic String
static String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Fired each time a parameter whic can impact music generation is modified .static final String
static final String
static final String
This vetoable property change can be fired by playback actions (eg Play, Pause) just before playing a song and can be vetoed by vetoables listeners to cancel playback start. -
Method Summary
Modifier and TypeMethodDescriptionint
addClickTrack
(Sequence sequence, SongContext context) Add a click track using the current settings.void
Listeners will be notified via the PROP_VETO_PRE_PLAYBACK property change before a playback is started.long
addPrecountClickTrack
(Sequence sequence, SongContext context) Add a precount click track to the sequence for the specified song.void
void
addPropertyChangeListener
(String propName, PropertyChangeListener l) void
firePlaybackStartVetoableChange
(SongContext sgContext) Notify all playback start VetoableChangeListeners with a PROP_VETO_PRE_PLAYBACK property vetoable change event.int
getClickChannel
(MidiMix midiMix) The actual Midi channel to be used with he specified MidiMix.int
int
Get the precount mode.int
getClickPrecountNbBars
(TimeSignature ts, int tempo) Get the number of precount bars.int
int
static PlaybackSettings
int
int
Get the key transposition applied to chord symbols when playing a song.int
The preferred click channel.boolean
True if playing backing track should be automatically updated in real-time when song changes.boolean
boolean
void
void
void
removePropertyChangeListener
(String propName, PropertyChangeListener l) void
setAutoUpdateEnabled
(boolean b) Set if playing backing track should be automatically updated in real-time when song changes.void
setClickPitchHigh
(int pitch) void
setClickPitchLow
(int pitch) void
setClickPrecountEnabled
(boolean b) void
Set the precount mode.void
setClickVelocityHigh
(int v) void
setClickVelocityLow
(int v) void
setLoopCount
(int loopCount) Set the loop count of the playback.void
setPlaybackClickEnabled
(boolean b) Enable the click during playback.void
setPlaybackKeyTransposition
(int t) Set the key transposition applied to chord symbols when playing a song.void
setPreferredClickChannel
(int channel)
-
Field Details
-
CLICK_TRACK_NAME
-
PRECOUNT_CLICK_TRACK_NAME
-
PROP_VETO_PRE_PLAYBACK
This vetoable property change can be fired by playback actions (eg Play, Pause) just before playing a song and can be vetoed by vetoables listeners to cancel playback start.NewValue=If non null it contains the SongContext object.
- See Also:
-
PROP_LOOPCOUNT
- See Also:
-
PROP_PLAYBACK_KEY_TRANSPOSITION
- See Also:
-
PROP_CLICK_PITCH_HIGH
- See Also:
-
PROP_CLICK_PITCH_LOW
- See Also:
-
PROP_CLICK_VELOCITY_HIGH
- See Also:
-
PROP_CLICK_VELOCITY_LOW
- See Also:
-
PROP_CLICK_PREFERRED_CHANNEL
- See Also:
-
PROP_CLICK_PRECOUNT_ENABLED
- See Also:
-
PROP_CLICK_PRECOUNT_MODE
- See Also:
-
PROP_PLAYBACK_CLICK_ENABLED
- See Also:
-
PROP_AUTO_UPDATE_ENABLED
- See Also:
-
PROP_MUSIC_GENERATION
Fired each time a parameter whic can impact music generation is modified .OldValue=the property name that triggered the musical change, newValue=optional data
- See Also:
-
-
Method Details
-
getInstance
-
getLoopCount
public int getLoopCount() -
setLoopCount
public void setLoopCount(int loopCount) Set the loop count of the playback.- Parameters:
loopCount
- If 0, play the song once (no loop). Use Sequencer.LOOP_CONTINUOUSLY for endless loop.
-
getPlaybackKeyTransposition
public int getPlaybackKeyTransposition()Get the key transposition applied to chord symbols when playing a song.- Returns:
- [0;-11] Default is 0.
-
setPlaybackKeyTransposition
public void setPlaybackKeyTransposition(int t) Set the key transposition applied to chord symbols when playing a song.Ex: if transposition=-2, chord=C#7 will be replaced by B7.
Note that to have some effect the current PlaybackSession must take into account this parameter.
- Parameters:
t
- [0;-11]
-
setAutoUpdateEnabled
public void setAutoUpdateEnabled(boolean b) Set if playing backing track should be automatically updated in real-time when song changes.- Parameters:
b
-
-
isAutoUpdateEnabled
public boolean isAutoUpdateEnabled()True if playing backing track should be automatically updated in real-time when song changes.- Returns:
-
setPlaybackClickEnabled
public void setPlaybackClickEnabled(boolean b) Enable the click during playback.- Parameters:
b
-
-
isPlaybackClickEnabled
public boolean isPlaybackClickEnabled() -
setClickPrecountEnabled
public void setClickPrecountEnabled(boolean b) - Parameters:
b
- If true a click precount is used before playing the song.
-
isClickPrecountEnabled
public boolean isClickPrecountEnabled() -
setClickPrecountMode
Set the precount mode.- Parameters:
mode
-
-
getClickPrecountMode
Get the precount mode.- Returns:
-
getClickPrecountNbBars
Get the number of precount bars.The parameters are only used if precount mode is set to AUTO.
Example in AUTO mode: a very fast tempo song will use 2 bars, a 4/4 will use 1 bar up to mid-range tempo etc.- Parameters:
ts
- Ignored if precount mode is not AUTO.tempo
- Ignored if precount mode is not AUTO.- Returns:
- Can be 1 or 2 bars.
-
setPreferredClickChannel
public void setPreferredClickChannel(int channel) - Parameters:
channel
-
-
getPreferredClickChannel
public int getPreferredClickChannel()The preferred click channel.- Returns:
-
getClickChannel
The actual Midi channel to be used with he specified MidiMix.If in the midiMix channel=getPreferredClickChannel() is used and is not a drums/percussion instrument, return the Midi channel MidiConst.CHANNEL_DRUMS. Otherwise return getPreferredClickChannel().
- Parameters:
midiMix
-- Returns:
-
setClickPitchHigh
public void setClickPitchHigh(int pitch) - Parameters:
pitch
- value must be [35-81] (GM1 drum map)
-
getClickPitchHigh
public int getClickPitchHigh() -
setClickPitchLow
public void setClickPitchLow(int pitch) - Parameters:
pitch
- value must be [35-81] (GM1 drum map)
-
getClickPitchLow
public int getClickPitchLow() -
setClickVelocityHigh
public void setClickVelocityHigh(int v) -
getClickVelocityHigh
public int getClickVelocityHigh() -
setClickVelocityLow
public void setClickVelocityLow(int v) -
getClickVelocityLow
public int getClickVelocityLow() -
addClickTrack
Add a click track using the current settings.- Parameters:
sequence
- The sequence for which we add the control track.context
-- Returns:
- the index of the track in the sequence.
-
addPrecountClickTrack
Add a precount click track to the sequence for the specified song.Except for the cases below, all existing sequence MidiEvents are shifted 1 or 2 bars later in order to leave room for the precount bars.
The following initial events (at tick 0) are not moved:
- Meta track name
- Meta time signature
- Meta tempo
- Meta copyright
- Parameters:
sequence
- The sequence for which we add the precount click track. Resolution must be MidiConst.PPQ.context
-- Returns:
- The tick position of the start of the song.
-
addPropertyChangeListener
-
addPropertyChangeListener
-
removePropertyChangeListener
-
removePropertyChangeListener
-
addPlaybackStartVetoableListener
Listeners will be notified via the PROP_VETO_PRE_PLAYBACK property change before a playback is started.The NewValue is a SongContext object. A listener who has already notified the end-user via its own UI must throw a PropertyVetoException with a null message to avoid another notification by the framework.
- Parameters:
listener
-
-
removePlaybackStartVetoableListener
-
firePlaybackStartVetoableChange
Notify all playback start VetoableChangeListeners with a PROP_VETO_PRE_PLAYBACK property vetoable change event.- Parameters:
sgContext
- Used as the new value of the Vetoable change- Throws:
PropertyVetoException
-