Package com.tagtraum.audiokern
Class AudioClip
- java.lang.Object
-
- com.tagtraum.audiokern.AudioClip
-
public class AudioClip extends Object
Audio clip represents a part of an actual audio track. It's immutable by design.- Author:
- Hendrik Schreiber
-
-
Field Summary
Fields Modifier and Type Field Description static AudioClip
EMPTY_CLIP
static AudioClip
UNDEFINED_CLIP
static int
UNDEFINED_TOTAL_TIME
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
int
getStartTime()
int
getStopTime()
int
getTotalTime()
boolean
isEmpty()
Indicates whether this is a zero length clip.boolean
isUndefined()
AudioClip
merge(AudioClip that)
Creates a third AudioClip that contains both this AudioClip and the given AudioClip.String
toString()
-
-
-
Field Detail
-
UNDEFINED_TOTAL_TIME
public static final int UNDEFINED_TOTAL_TIME
- See Also:
- Constant Field Values
-
UNDEFINED_CLIP
public static final AudioClip UNDEFINED_CLIP
-
EMPTY_CLIP
public static final AudioClip EMPTY_CLIP
-
-
Constructor Detail
-
AudioClip
public AudioClip(int startTime, int stopTime)
Constructor for immutable instance.- Parameters:
startTime
- start time in msstopTime
- stop time in ms
-
AudioClip
public AudioClip(int startTime, int stopTime, int totalTime)
Constructor for immutable instance.- Parameters:
startTime
- start time in msstopTime
- stop time in ms
-
-
Method Detail
-
merge
public AudioClip merge(AudioClip that)
Creates a third AudioClip that contains both this AudioClip and the given AudioClip. The new AudioClip may also contain data from sections between the two AudioClips. So strictly speaking it is not a union.- Parameters:
that
- AudioClip to merge with- Returns:
- merged AudioClip
-
getTotalTime
public int getTotalTime()
- Returns:
- the total duration of the original audiosource that this is a clip of
-
getStartTime
public int getStartTime()
- Returns:
- Start time in ms.
-
getStopTime
public int getStopTime()
- Returns:
- Stop time in ms.
-
isEmpty
public boolean isEmpty()
Indicates whether this is a zero length clip.- Returns:
- true or false
-
isUndefined
public boolean isUndefined()
- Returns:
- true, if the clip is undefined, meaning the whole source is meant
-
-