public class PlayData extends java.lang.Object implements java.lang.Iterable<BarIterator.Bar>
iterator returns a BarIterator which steps to each bar in the correct play sequence. The BarIterator returns each Part in the bar and also a virtual metronome part.
Part.iterator returns a NoteIterator which steps to each note in the bar in that part. The note returns a midi pitch and start time and duration in ms.
Modifier and Type | Field and Description |
---|---|
static int |
Bartype_default
for default argument
|
static int |
Bartype_full_bar
a normal full bar
|
static int |
Bartype_partial_bar_end
partial bar missing beat 1 (ie after repeat mark)
|
static int |
Bartype_partial_bar_start
partial bar including beat 1 (ie before repeat mark)
|
static int |
Bartype_partial_first_bar
partial bar is first bar in score (ie anacrusis)
|
static int |
kDefaultCountInBars
the default count-in is 1 bar
|
Constructor and Description |
---|
PlayData(SScore score,
UserTempo userTempo)
construct PlayData with default count-in of 1 bar
|
PlayData(SScore score,
UserTempo userTempo,
int countInBars)
construct PlayData
|
Modifier and Type | Method and Description |
---|---|
TimeSig |
actualBeatsForBar(int barIndex)
get the actual number of beats in the bar and the beat type
This is normally the same as timeSigForBar, but will have fewer beats for a partial bar (eg anacrusis)
|
int |
barTypeForBar(int barIndex)
get the type of the bar
|
int |
convertTempoToBPM(Tempo tempo,
TimeSig timesig)
get a beats-per-minute value for a given Tempo and TimeSig
|
protected void |
finalize() |
boolean |
firstBarAnacrusis()
is the first bar an 'up-beat' or anacrusis partial bar?
|
BarBeats |
getBarBeats(int barIndex,
int bpm,
int bartype)
get the number of beats in a bar and the beat timing
|
boolean |
hasDefinedTempo()
does the score define any tempo at the start with metronome or sound tempo elements?
|
BarIterator |
iterator()
get an iterator to the set of bars in the score.
|
float |
maxSoundDynamic()
get the maximum value of any sound dynamic in any bar.
|
Tempo |
metronomeForBar(int barIndex)
get information about any metronome defined in the bar
|
int |
numParts()
get the number of playing parts in the score
|
Tempo |
tempoAtBar(int barIndex)
get the effective tempo at the bar accounting for any sound tempo elements and metronome elements
|
Tempo |
tempoAtStart()
get the effective tempo at start of the score accounting for any sound tempo elements and metronome elements
|
TimeSig |
timeSigForBar(int barIndex)
get the applicable time signature for a particular bar
|
void |
updateTempo()
call this on changing the user tempo to tell the interface to re-read the UserTempo and update the
note timings returned
|
public static final int kDefaultCountInBars
public static final int Bartype_full_bar
public static final int Bartype_partial_first_bar
public static final int Bartype_partial_bar_start
public static final int Bartype_partial_bar_end
public static final int Bartype_default
public PlayData(SScore score, UserTempo userTempo, int countInBars) throws ScoreException
score
- the scoreuserTempo
- an implementation of the UserTempo interface allowing the user eg with a slider
to define the tempo, or tempo scalingcountInBars
- the number of bars to count in before startScoreException
- any errorpublic PlayData(SScore score, UserTempo userTempo) throws ScoreException
score
- the scoreuserTempo
- user-defining tempo instanceScoreException
- any errorpublic int barTypeForBar(int barIndex)
barIndex
- public TimeSig timeSigForBar(int barIndex) throws ScoreException
barIndex
- the index of the bar. 0 is the first barScoreException
- on errorpublic TimeSig actualBeatsForBar(int barIndex) throws ScoreException
barIndex
- the index of the bar. 0 is the first barScoreException
- on errorpublic Tempo metronomeForBar(int barIndex) throws ScoreException
barIndex
- the index of the bar. 0 is the first barScoreException
- on errorpublic Tempo tempoAtBar(int barIndex) throws ScoreException
barIndex
- the index of the bar (0 is 1st)ScoreException
- on errorpublic Tempo tempoAtStart() throws ScoreException
ScoreException
- on errorpublic int convertTempoToBPM(Tempo tempo, TimeSig timesig)
tempo
- the score-defined or user-defined tempotimesig
- the effective time signaturepublic BarBeats getBarBeats(int barIndex, int bpm, int bartype) throws ScoreException
barIndex
- the index of the bar (0 is 1st)bpm
- the effective beats-per-minute valuebartype
- one of Bartype_?ScoreException
public boolean hasDefinedTempo()
public BarIterator iterator()
iterator
in interface java.lang.Iterable<BarIterator.Bar>
public int numParts()
public float maxSoundDynamic()
public boolean firstBarAnacrusis()
public void updateTempo()
protected void finalize()
finalize
in class java.lang.Object