Package com.tagtraum.audiokern.beats
Class Beat
- java.lang.Object
-
- com.tagtraum.audiokern.beats.Beat
-
- All Implemented Interfaces:
Cloneable,org.json.simple.JSONAware
public class Beat extends Object implements Cloneable, org.json.simple.JSONAware
Beat.- Author:
- Hendrik Schreiber
-
-
Constructor Summary
Constructors Constructor Description Beat(long time)Beat withUNKNOWNbeat number.Beat(long time, int number)Beat with known beat number.Beat(long time, TimeUnit timeUnit)Beat withUNKNOWNbeat number.Beat(long time, TimeUnit timeUnit, int number)Beat with known beat number.Beat(String jsonString)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()booleanequals(Object o)intgetNumber()Beat number.longgetTime()Beat time.longgetTime(TimeUnit timeUnit)Beat time.inthashCode()StringtoJSONString()StringtoString()
-
-
-
Field Detail
-
UNKNOWN
public static final int UNKNOWN
- See Also:
- Constant Field Values
-
DOWNBEAT
public static final int DOWNBEAT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Beat
public Beat(long time, int number)Beat with known beat number.- Parameters:
time- time in millisecondsnumber- beat number, e.g.1for a downbeat
-
Beat
public Beat(long time)
Beat withUNKNOWNbeat number.- Parameters:
time- time in milliseconds
-
Beat
public Beat(long time, TimeUnit timeUnit, int number)Beat with known beat number.- Parameters:
time- timetimeUnit- time unitnumber- beat number, e.g.1for a downbeat
-
Beat
public Beat(long time, TimeUnit timeUnit)Beat withUNKNOWNbeat number.- Parameters:
time- timetimeUnit- time unit
-
Beat
public Beat(String jsonString)
-
-
Method Detail
-
getNumber
public int getNumber()
Beat number. The number is 1-based, so the downbeat is usually1.- Returns:
- beat number, 1-based
-
getTime
public long getTime()
Beat time.- Returns:
- time in milliseconds
-
getTime
public long getTime(TimeUnit timeUnit)
Beat time.- Parameters:
timeUnit- desired time unit- Returns:
- time in desired unit
-
toJSONString
public String toJSONString()
- Specified by:
toJSONStringin interfaceorg.json.simple.JSONAware
-
clone
public Object clone() throws CloneNotSupportedException
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
-