public class Player
extends java.lang.Object
implements be.tarsos.dsp.AudioProcessor
Modifier and Type | Method and Description |
---|---|
void |
addProcessorBeforeTimeStrechting(be.tarsos.dsp.AudioProcessor processor)
Adds an audio processor to the chain before time stretching kicks in.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds a change listener.
|
void |
eject()
Ejects the currently loaded file.
|
double |
getCurrentTime() |
double |
getDurationInSeconds()
If no file is loaded a illegal state exception is fired.
|
static Player |
getInstance() |
double |
getStartAt() |
PlayerState |
getState() |
double |
getStopAt()
Returns the time at which the audio play back stops automatically.
|
void |
increaseGain(double percent)
Increase the gain by a defined percentage.
|
void |
increaseTempo(double percent)
Increase the tempo by a defined percentage.
|
void |
load(java.io.File file)
Loads a new audio file.
|
void |
pauze()
Stops the play back at current time.
|
void |
pauze(double pauzeAt)
Stops the play back.
|
void |
play()
Plays the currently loaded file.
|
void |
play(double startTime) |
boolean |
process(be.tarsos.dsp.AudioEvent audioEvent) |
void |
processingFinished() |
boolean |
removeProcessorBeforeTimeStretching(be.tarsos.dsp.AudioProcessor processor)
Removes an audio processor to the chain before time stretching kicks in.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a change listener.
|
void |
setGain(double newGain)
Set the gain for the current stream.
|
void |
setStopAt(double stopAt)
At this point the sound that is played stops automatically.
|
void |
setTempo(double newTempo)
Set the tempo for the current stream.
|
void |
stop()
Stops the play back.
|
public void setStopAt(double stopAt)
stopAt
- The time at which the player stops (in seconds).public double getStopAt()
public void load(java.io.File file)
file
- The audio file to load.public void eject()
public void play()
public void play(double startTime)
public void pauze()
public void pauze(double pauzeAt)
pauzeAt
- The time at which to resume playing after calling play (in
seconds).public void stop()
public void setGain(double newGain)
newGain
- The gain to apply to the current stream, 1 is no change, 0.8
is 80% of the volume and 2 double (watch out for clipping when
using values > 1)public void setTempo(double newTempo)
newTempo
- The new tempo for the current stream. 1 is no change, 2 is double tempo, 0.5 half.public double getDurationInSeconds()
public PlayerState getState()
public double getStartAt()
public double getCurrentTime()
public void addProcessorBeforeTimeStrechting(be.tarsos.dsp.AudioProcessor processor)
processor
- the processor to add.public boolean removeProcessorBeforeTimeStretching(be.tarsos.dsp.AudioProcessor processor)
processor
- the processor to remove.public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
l
- The listener to add.public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
l
- The listener to remove.public boolean process(be.tarsos.dsp.AudioEvent audioEvent)
process
in interface be.tarsos.dsp.AudioProcessor
public void processingFinished()
processingFinished
in interface be.tarsos.dsp.AudioProcessor
public static Player getInstance()
public void increaseGain(double percent)
percent
- To increase the gain.public void increaseTempo(double percent)
percent
- To increase the tempo.