All Packages Class Hierarchy This Package Previous Next Index
Class guinea.player.Sample
java.lang.Object
|
+----guinea.player.Sample
- public abstract class Sample
- extends Object
- implements Cloneable, PropertyLoader, PropertySaver
The Sample class is an abstract base class for various types of
samples.
Variable Index
- ·
length
- Length of sample in frames.
- ·
looping
- Whether sample is looping or not (one shot play).
- ·
name
- Name of this sample for use as a label.
- ·
player
- The player this sample uses.
- ·
PositionListeners
- Sample position listeners.
- ·
rate
- Frame rate of this sample.
- ·
SampleListeners
- Sample listeners.
- ·
type
- Type of sample, "audio", "video", or something else.
Constructor Index
- ·
Sample()
-
Method Index
- ·
addSampleListener(SampleListener)
- Adds the specified sample listener to receive sample event
from this sample.
- ·
addSamplePositionListener(SamplePositionListener)
- Adds the specified sample position listener to receive
position events from this sample.
- ·
clone()
- Creates a new object of the same class as this object.
- ·
close()
- Close the sample.
Deprecated.
- ·
dispose()
-
- ·
finalize()
- Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
- ·
formatPosition(long)
- Returns a string representation of given position in sample.
- ·
getDuration()
- Get duration of sample in seconds.
- ·
getLooping()
- Get looping status of sample.
- ·
getName()
- Get name (or label) of sample.
- ·
getNumFrames()
- Get number of audio or video frames in this sample.
- ·
getPlayer()
- Get the player this sample is using.
- ·
getRate()
- Get frame rate of this sample.
- ·
getSampleID()
- Get the sample ID used with the player.
- ·
getType()
- Get type of sample.
- ·
isLoopable()
- Whether sample can be looped.
- ·
processSampleEvent(SampleEvent)
- Send sample event to interested listeners.
- ·
processSamplePositionEvent(SamplePositionEvent)
- Send sample position event to interested listeners.
- ·
propertyLoad(Properties, String)
-
- ·
propertySave(ExtProperties)
-
- ·
removeSampleListener(SampleListener)
- Removes the specified sample listener so it no longer receives
sample events from this sample.
- ·
removeSamplePositionListener(SamplePositionListener)
- Removes the specified sample position listener so it no longer
receives position events from this sample.
- ·
setLooping(boolean)
- Set looping status of sample.
- ·
setName(String)
- Set name of sample.
- ·
setPlayer(Player)
- Set the player this sample is using.
- ·
setPosition(long)
- Seek to a position in sample.
- ·
setVolume(double)
- Set volume of sample.
Deprecated.
- ·
setVolume(Volume)
- Set volume of sample.
- ·
start()
- Start playing the sample.
- ·
start(long)
- Start playing the sample at given time.
- ·
stop()
- Stop playing sample and rewind sample to beginning.
- ·
toString()
- Return string representation of sample.
Variables
·
rate
protected double rate
- Frame rate of this sample. For audio it is the sampling rate
of the sample. For video, it is the number of video frames
per second.
·
length
protected long length
- Length of sample in frames.
·
SampleListeners
protected transient Vector SampleListeners
- Sample listeners.
·
PositionListeners
protected transient Vector PositionListeners
- Sample position listeners.
·
player
protected transient Player player
- The player this sample uses.
·
name
protected String name
- Name of this sample for use as a label. Do not confuse with
file name.
·
looping
protected boolean looping
- Whether sample is looping or not (one shot play).
·
type
protected String type
- Type of sample, "audio", "video", or something else.
Constructors
·
Sample
public Sample()
Methods
·
getRate
public double getRate()
- Get frame rate of this sample. For audio it is the sampling
rate of the sample. For video, it is the number of video
frames per second.
·
getNumFrames
public long getNumFrames()
- Get number of audio or video frames in this sample.
- Returns:
- number of audio sample frames or video frames in
sample.
·
getDuration
public double getDuration()
- Get duration of sample in seconds.
- Returns:
- duration of sample in seconds.
·
getSampleID
public String getSampleID()
- Get the sample ID used with the player.
- Returns:
- the player sample ID or
null
if sample is
not loaded.
·
getName
public String getName()
- Get name (or label) of sample.
- Returns:
- the name or label for sample.
·
setName
public void setName(String name)
- Set name of sample. Name of this sample is for use as a
label. Do not confuse with file name.
- Parameters:
- name - the label for sample.
·
getType
public String getType()
- Get type of sample.
- Returns:
- type of sample as a string.
·
setVolume
public void setVolume(double volume)
- Note: setVolume() is deprecated.
use Volume object instead
- Set volume of sample.
- Parameters:
- volume - the volume level.
·
setVolume
public void setVolume(Volume volume)
- Set volume of sample.
- Parameters:
- volume - the volume level.
·
start
public abstract void start(long frame)
- Start playing the sample at given time.
- Parameters:
- frame - the timestamp (audio frame number) of when sample
should start coming out of the machine's output jacks. Zero
means start immediately (as soon as is possible).
·
start
public void start()
- Start playing the sample. Equivalent to start(0).
·
stop
public abstract void stop()
- Stop playing sample and rewind sample to beginning.
·
setPosition
public abstract void setPosition(long frame) throws SampleException
- Seek to a position in sample.
- Parameters:
- frame - the sample frame offset from start of sample.
For audio it is in audio frames (for example, position 44100
is one second from the start of a 44.1KHz sample) and for
video it is in video frames (25/s for PAL, 30/s for NTSC).
- Throws: SampleException
- throws an exception if seeking past
the end of sample is tried.
·
addSampleListener
public synchronized void addSampleListener(SampleListener l)
- Adds the specified sample listener to receive sample event
from this sample.
- Parameters:
- l - the sample listener.
·
removeSampleListener
public synchronized void removeSampleListener(SampleListener l)
- Removes the specified sample listener so it no longer receives
sample events from this sample.
- Parameters:
- l - the sample listener.
·
processSampleEvent
protected void processSampleEvent(SampleEvent event)
- Send sample event to interested listeners.
- Parameters:
- event - an event to send.
·
addSamplePositionListener
public synchronized void addSamplePositionListener(SamplePositionListener l)
- Adds the specified sample position listener to receive
position events from this sample.
- Parameters:
- l - the sample position listener.
·
removeSamplePositionListener
public synchronized void removeSamplePositionListener(SamplePositionListener l)
- Removes the specified sample position listener so it no longer
receives position events from this sample.
- Parameters:
- l - the sample position listener.
·
processSamplePositionEvent
protected void processSamplePositionEvent(SamplePositionEvent event)
- Send sample position event to interested listeners.
- Parameters:
- event - an event to send.
·
close
public void close()
- Note: close() is deprecated.
Use dispose() instead.
- Close the sample.
- See Also:
- dispose
·
formatPosition
public String formatPosition(long position)
- Returns a string representation of given position in sample.
The default is to show a position with like '1:23:50' where
first are minutes, then seconds and finally 1/100s of secods.
- Parameters:
- position - a position to be represented with a string.
·
setLooping
public void setLooping(boolean loop)
- Set looping status of sample.
- Parameters:
- loop - set to true if looping is wanted,
false otherwise.
·
getLooping
public boolean getLooping()
- Get looping status of sample.
- Returns:
- true if sample is set to loop, false
if not.
·
isLoopable
public boolean isLoopable()
- Whether sample can be looped.
- Returns:
- true if sample can loop, false if
not.
·
getPlayer
public Player getPlayer()
- Get the player this sample is using.
- Returns:
- the player this sample is using.
·
setPlayer
public void setPlayer(Player player)
- Set the player this sample is using.
- Parameters:
- player - the player to use.
·
clone
public Object clone()
- Creates a new object of the same class as this object.
- Overrides:
- clone in class Object
·
dispose
public void dispose()
·
finalize
protected void finalize() throws Throwable
- Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
- Overrides:
- finalize in class Object
·
propertySave
public void propertySave(ExtProperties p)
·
propertyLoad
public void propertyLoad(Properties p,
String name) throws IllegalArgumentException
·
toString
public String toString()
- Return string representation of sample.
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index