Class Time
java.lang.Object
games.stendhal.client.sound.facade.Time
- All Implemented Interfaces:
Cloneable
A time class that helps converting different time units
to and from samples per sample rate
internally this class will calculate in nanosecond resolution only
- Author:
- silvio
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()doubledoubledoublelongdoublegetInSamples(int sampleRate) Calculates the number of samples for a given sample rate that would fit into this time rangedoublefinal voidset(long samples, int sampleRate) final void
-
Constructor Details
-
Time
public Time() -
Time
public Time(long nanos) -
Time
Creates an instance of the Time class from a time value and a time unit- Parameters:
value- the time valueunit- the time unit (e.g. NANO, MILLI, SEC, ...)
-
Time
public Time(long samples, int sampleRate) Creates an instance of the Time class from a given number of samples and a sample rate- Parameters:
samples-sampleRate-
-
-
Method Details
-
set
-
set
public final void set(long samples, int sampleRate) -
getInNanoSeconds
public long getInNanoSeconds() -
getInMilliSeconds
public double getInMilliSeconds() -
getInSeconds
public double getInSeconds() -
getInMinutes
public double getInMinutes() -
getInHours
public double getInHours() -
getInSamples
public double getInSamples(int sampleRate) Calculates the number of samples for a given sample rate that would fit into this time range- Parameters:
sampleRate- any sample rate- Returns:
- number of samples
-
clone
-