Package org.jjazz.rhythm.api
Class RhythmVoice
java.lang.Object
org.jjazz.rhythm.api.RhythmVoice
- Direct Known Subclasses:
RhythmVoiceDelegate
,UserRhythmVoice
Describe a voice for which a Rhythm will generate music.
This is an immutable class.
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionRhythmVoice
(DrumKit drumKit, Rhythm container, RhythmVoice.Type type, String name, Instrument ins, int preferredChannel) Create a drums/percussion RhythmVoice with a default InstrumentSettings.RhythmVoice
(DrumKit drumKit, Rhythm container, RhythmVoice.Type type, String name, Instrument ins, InstrumentSettings is, int preferredChannel) Create a RhythmVoice for Drums/Percussion instruments.RhythmVoice
(Rhythm container, RhythmVoice.Type type, String name, Instrument instrument, int preferredChannel) Create a RhythmVoice for a non-drums voice with a default InstrumentSettings.RhythmVoice
(Rhythm container, RhythmVoice.Type type, String name, Instrument ins, InstrumentSettings is, int preferredChannel) Create a RhythmVoice for a non-drums voice. -
Method Summary
-
Constructor Details
-
RhythmVoice
public RhythmVoice(Rhythm container, RhythmVoice.Type type, String name, Instrument instrument, int preferredChannel) Create a RhythmVoice for a non-drums voice with a default InstrumentSettings.- Parameters:
container
- The Rhythm this RhythmVoice belongs to.type
- DRUMS or PERCUSSION not allowed.name
-instrument
- The instrument to be used by default. Can't be null. Must have getSubstitute() defined.preferredChannel
- Preferred Midi channel
-
RhythmVoice
public RhythmVoice(Rhythm container, RhythmVoice.Type type, String name, Instrument ins, InstrumentSettings is, int preferredChannel) Create a RhythmVoice for a non-drums voice.- Parameters:
container
- The Rhythm this RhythmVoice belongs to.type
- DRUMS or PERCUSSION not allowed.name
- Name of the RhythmVoiceins
- The recommended instrument. Can't be null. Must have getSubstitute() defined.is
- The recommended InstrumentSettings.preferredChannel
- The preferred Midi channel for this voice.
-
RhythmVoice
public RhythmVoice(DrumKit drumKit, Rhythm container, RhythmVoice.Type type, String name, Instrument ins, int preferredChannel) Create a drums/percussion RhythmVoice with a default InstrumentSettings.- Parameters:
drumKit
-container
-type
- Must be DRUMS or PERCUSSION.name
-ins
- The recommended instrument. Can't be null. Does not need to have getSubstitute() defined.preferredChannel
-
-
RhythmVoice
public RhythmVoice(DrumKit drumKit, Rhythm container, RhythmVoice.Type type, String name, Instrument ins, InstrumentSettings is, int preferredChannel) Create a RhythmVoice for Drums/Percussion instruments.- Parameters:
drumKit
-container
- The Rhythm this RhythmVoice belongs to.type
- Must be DRUMS or PERCUSSION.name
- Name of the RhythmVoiceins
- The recommended instrument. Can't be null. Does not need to have getSubstitute() defined.is
- The recommended InstrumentSettings.preferredChannel
- The preferred Midi channel for this voice.
-
-
Method Details
-
isDrums
public boolean isDrums()- Returns:
- True if this object's type is Drums or Percussion.
-
getDrumKit
Get the DrumKit.- Returns:
- Null if this is not a Drums/Percussion rhythm voice.
-
getContainer
- Returns:
- The Rhythm for which this RhythmVoice is set.
-
getPreferredChannel
public int getPreferredChannel() -
getType
- Returns:
- The type of the rhythm voice.
-
getName
- Returns:
- E.g. "Horn riffs", "walking bass"
-
getPreferredInstrument
The preferred Instrument for this voice.- Returns:
- Can't be null. Except for Drums/Percussion, returned instrument is guaranteed to have its method getSubstitute() defined
-
getPreferredInstrumentSettings
Recommended instrument settings to be used for this voice.- Returns:
- A copy of this rhythmVoice's InstrumentSettings. Can't be null.
-
equals
-
hashCode
public int hashCode() -
toLongString
-
toString
-