public interface Snapshot
An interface for probing details about the timeline established by a metronome, with respect to a particular
moment in time. The Metronome class implements this interface and provides answers with respect to the
moment at which you called each function, but if you need to work with more than one piece of information at a
time, be sure to use Metronome.getSnapshot() so that each of your calculations refer to the same moment.
Otherwise you risk getting misleading results, such as when you ask for a beat number in one call, and then
the beat phase, and you have moved on to a different beat in between the calls.
Snapshots in Afterglow also extend the notions of beat phase to enable oscillators with frequencies that are fractions or multiples of a beat. Since that is much more difficult in Java than Clojure, and unlikely to be needed outside the context of a lighting controller, it has not yet been ported. Open an issue if you need it!
| Modifier and Type | Method and Description |
|---|---|
long |
getBar()
Get the metronome's bar number.
|
long |
getBarInterval()
Get the metronome's bar length in time.
|
double |
getBarPhase()
Get the metronome's bar phase at the time of the snapshot, a value which starts at 0.0 at the very start of the
bar, but never quite reaches 1.0, because that would be the start of the next bar.
|
int |
getBarsPerPhrase()
Get the metronome's phrase length in bars.
|
int |
getBarWithinPhrase()
Return the bar number of the snapshot relative to the start of the phrase: the phrase starts with bar 1, and the
range goes up to the value of
getBarsPerPhrase(). |
long |
getBeat()
Get the metronome's beat number.
|
long |
getBeatInterval()
Get the metronome's beat length in time.
|
double |
getBeatPhase()
Get the metronome's beat phase at the time of the snapshot, a value which starts at 0.0 at the very start of the
beat, but never quite reaches 1.0, because that would be the start of the next beat.
|
int |
getBeatsPerBar()
Get the metronome's bar length in beats.
|
int |
getBeatWithinBar()
Return the beat number of the snapshot relative to the start of the bar: the down beat is 1, and the range
goes up to the value of
getBeatsPerBar(). |
int |
getBeatWithinPhrase()
Return the beat number of the snapshot relative to the start of the phrase: the phrase starts with beat 1, and
the range goes up to the value of
getBeatsPerBar() times getBarsPerPhrase(). |
long |
getInstant()
Get the point in time with respect to which the snapshot is computed.
|
String |
getMarker()
Returns the time represented by the snapshot as "phrase.bar.beat".
|
long |
getPhrase()
Get the metronome's phrase number.
|
long |
getPhraseInterval()
Get the metronome's phrase length in time.
|
double |
getPhrasePhase()
Get the metronome's phrase phase at the time of the snapshot, a value which starts at 0.0 at the very start of
the phrase, but never quite reaches 1.0, because that would be the start of the next phrase.
|
long |
getStartTime()
Get the metronome's timeline origin.
|
double |
getTempo()
Get the metronome's tempo.
|
long |
getTimeOfBar(long bar)
Determine the millisecond timestamp at which a particular bar will occur, given the metronome configuration when
the snapshot was taken.
|
long |
getTimeOfBeat(long beat)
Determine the millisecond timestamp at which a particular beat will occur, given the metronome configuration when
the snapshot was taken.
|
long |
getTimeOfPhrase(long phrase)
Determine the millisecond timestamp at which a particular phrase will occur, given the metronome configuration
when the snapshot was taken.
|
boolean |
isDownBeat()
Checks whether the current beat at the time of the snapshot was the first beat in its bar.
|
boolean |
isPhraseStart()
Checks whether the current beat at the time of the snapshot was the first beat in its phrase.
|
long getStartTime()
double getTempo()
int getBeatsPerBar()
int getBarsPerPhrase()
long getInstant()
getStartTime(), along with getTempo(), determine the other snapshot values.long getBeatInterval()
long getBarInterval()
long getPhraseInterval()
long getBeat()
long getBar()
long getPhrase()
double getBeatPhase()
double getBarPhase()
double getPhrasePhase()
long getTimeOfBeat(long beat)
beat - the number of the beat whose start time is desiredint getBeatWithinBar()
getBeatsPerBar().boolean isDownBeat()
true if the snapshot was taken during the first beat of a barint getBeatWithinPhrase()
getBeatsPerBar() times getBarsPerPhrase().boolean isPhraseStart()
true if the snapshot was taken during the first beat of a phraselong getTimeOfBar(long bar)
bar - the number of the bar whose start time is desiredint getBarWithinPhrase()
getBarsPerPhrase().long getTimeOfPhrase(long phrase)
phrase - the number of the phrase whose start time is desiredString getMarker()
Copyright © 2018 Deep Symmetry, LLC. All rights reserved.