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 withUNKNOWN
beat number.Beat(long time, int number)
Beat with known beat number.Beat(long time, TimeUnit timeUnit)
Beat withUNKNOWN
beat 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 Object
clone()
boolean
equals(Object o)
int
getNumber()
Beat number.long
getTime()
Beat time.long
getTime(TimeUnit timeUnit)
Beat time.int
hashCode()
String
toJSONString()
String
toString()
-
-
-
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.1
for a downbeat
-
Beat
public Beat(long time)
Beat withUNKNOWN
beat 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.1
for a downbeat
-
Beat
public Beat(long time, TimeUnit timeUnit)
Beat withUNKNOWN
beat 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:
toJSONString
in interfaceorg.json.simple.JSONAware
-
clone
public Object clone() throws CloneNotSupportedException
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
-