All Packages Class Hierarchy This Package Previous Next Index
Class guinea.player.ParallelSamples
java.lang.Object
|
+----guinea.player.Sample
|
+----guinea.player.ParallelSamples
- public class ParallelSamples
- extends Sample
- implements SampleListener, SamplePositionListener, Serializable
The ParallelSamples sample object plays several samples at the
same time but only one of them is heard. When switching to
another sample, a crossfade is used.
Constructor Index
- ·
ParallelSamples()
-
- ·
ParallelSamples(Sample[])
-
- ·
ParallelSamples(SoundSample[])
-
Method Index
- ·
addSamplePositionListener(SamplePositionListener)
- Adds the specified sample position listener to receive
position events from this sample.
- ·
dispose()
-
- ·
getChannels()
- Get number of channels in sample.
- ·
getFadeLength()
- Get the length of crossfade.
- ·
getFadeType()
- Get fade type.
- ·
getPlaying()
- Get the currently playing sample.
- ·
getPlayingIndex()
- Get the index of currently playing sample.
- ·
getPositionNotifyInterval()
-
- ·
getSampleID()
- Get player sample ID.
- ·
getSamples()
- Get component samples of the parallel sample.
- ·
isLoopable()
- Whether sample can be looped.
- ·
removeSamplePositionListener(SamplePositionListener)
- Removes the specified sample position listener so it no longer
receives position events from this sample.
- ·
sampleLooped(SampleEvent)
- Called when sample has looped.
- ·
samplePositionChanged(SamplePositionEvent)
- Called when sample position has changed.
- ·
sampleStarted(SampleEvent)
- Called when sample has started.
- ·
sampleStopped(SampleEvent)
- Called when sample has stopped or was stopped.
- ·
setFadeLength(double)
- Set the length of the crossfade from one sample to another.
- ·
setFadeType(String)
- Set fade type.
- ·
setLooping(boolean)
- Set looping status of sample.
- ·
setPlayer(Player)
- Set sample's player.
- ·
setPlaying(int)
- Switch to one of the samples contained in this parallel
sample.
- ·
setPlaying(SoundSample)
- Switch to one of the samples contained in this parallel
sample.
- ·
setPosition(long)
- Seek to a given sample frame.
- ·
setPositionNotifyInterval(double)
- Set sample position notification interval.
- ·
setPositionNotifyInterval(int)
- Set sample position notification interval.
- ·
setVolume(Volume)
- Set volume of sample.
- ·
start(long)
- Start playing the sample at given time.
- ·
startWait()
- Start playing the sample and wait for it to start before
returning.
- ·
startWait(long)
- Start playing the sample at a given time and wait for it to
start before returning.
- ·
stop()
- Stop playing.
- ·
unload()
- Unload sample.
- ·
waitForStart()
- Wait for sample to start.
- ·
waitForStop()
- Wait for sample to stop.
Constructors
·
ParallelSamples
public ParallelSamples()
·
ParallelSamples
public ParallelSamples(Sample samples[])
·
ParallelSamples
public ParallelSamples(SoundSample samples[])
Methods
·
getSampleID
public String getSampleID()
- Get player sample ID.
- Returns:
- In parallel sample,
null
is always
returned.
- Overrides:
- getSampleID in class Sample
·
setPlayer
public void setPlayer(Player player)
- Set sample's player. In parallel sample, setting the player
has no effect.
- Parameters:
- player - Player to use.
- Overrides:
- setPlayer in class Sample
·
getSamples
public Sample[] getSamples()
- Get component samples of the parallel sample.
- Returns:
- Component samples as an array.
·
getChannels
public int getChannels()
- Get number of channels in sample. The number of channels in
parallel sample is the same as the width of the widest sample.
- Returns:
- Number of channels.
·
setPlaying
public void setPlaying(SoundSample s)
- Switch to one of the samples contained in this parallel
sample.
- Parameters:
- s - The sample to which to switch.
·
setPlaying
public void setPlaying(int index)
- Switch to one of the samples contained in this parallel
sample.
- Parameters:
- index - The index of the sample to which to switch. The
order is the same as when constructing this sample.
·
getPlayingIndex
public int getPlayingIndex()
- Get the index of currently playing sample.
- Returns:
- Number of current sample or -1 if sample is not yet
set.
·
getPlaying
public Sample getPlaying()
- Get the currently playing sample.
- Returns:
- Current sample or null if sample is not yet set.
·
setFadeLength
public void setFadeLength(double length)
- Set the length of the crossfade from one sample to another.
- Parameters:
- length - the length of fade in seconds.
·
getFadeLength
public double getFadeLength()
- Get the length of crossfade.
- Returns:
- the length of crossfade in seconds.
·
setFadeType
public void setFadeType(String type)
- Set fade type.
- Parameters:
- type - the type of fade, 'linear' or 'exp'.
·
getFadeType
public String getFadeType()
- Get fade type.
- Returns:
- the fade type, 'linear' or 'exp'.
·
unload
public synchronized void unload()
- Unload sample.
·
dispose
public void dispose()
- Overrides:
- dispose in class Sample
·
start
public void start(long frame)
- Start playing the sample at given time.
- Parameters:
- frame - Output frame number.
- Overrides:
- start in class Sample
·
startWait
public long startWait(long frame) throws InterruptedException
- Start playing the sample at a given time and wait for it to
start before returning.
- Parameters:
- frame - Output frame number.
- Returns:
- The timestamp indicating the starting time of sample.
If frame was non-zero, the same value should be
returned unless framedrops occured. Values less that zero
indicate errors.
- Throws: InterruptedException
- If the wait was interrupted.
·
startWait
public long startWait() throws InterruptedException
- Start playing the sample and wait for it to start before
returning.
- Returns:
- The timestamp indicating the starting time of sample.
Values less that zero indicate errors.
- Throws: InterruptedException
- If the wait was interrupted.
·
waitForStart
public synchronized long waitForStart() throws InterruptedException
- Wait for sample to start.
- Returns:
- Timestamp of samples start.
- Throws: InterruptedException
- If the wait was interrupted.
·
stop
public void stop()
- Stop playing.
- Overrides:
- stop in class Sample
·
waitForStop
public synchronized long waitForStop() throws InterruptedException
- Wait for sample to stop.
- Returns:
- Timestamp of samples ending.
- Throws: InterruptedException
- If the wait was interrupted.
·
setPosition
public void setPosition(long pos) throws SampleException
- Seek to a given sample frame.
- Parameters:
- pos - the sample frame number where to seek
- Throws: SampleException
- thrown if position was out of bounds
- Overrides:
- setPosition in class Sample
·
setVolume
public void setVolume(Volume vol)
- Set volume of sample. Sets volume of all channels.
- Parameters:
- vol - Volume of sample.
- Overrides:
- setVolume in class Sample
·
setLooping
public void setLooping(boolean loop)
- Set looping status of sample.
- Parameters:
- loop - set to true if looping is wanted,
false otherwise.
- Overrides:
- setLooping in class Sample
·
isLoopable
public boolean isLoopable()
- Whether sample can be looped.
- Overrides:
- isLoopable in class Sample
·
setPositionNotifyInterval
public void setPositionNotifyInterval(int numFrames)
- Set sample position notification interval.
- Parameters:
- numFrames - The interval in sample frames.
·
setPositionNotifyInterval
public void setPositionNotifyInterval(double millis)
- Set sample position notification interval.
- Parameters:
- numFrames - the interval in milliseconds.
·
getPositionNotifyInterval
public int getPositionNotifyInterval()
·
addSamplePositionListener
public void addSamplePositionListener(SamplePositionListener l)
- Adds the specified sample position listener to receive
position events from this sample.
- Parameters:
- l - the sample position listener.
- Overrides:
- addSamplePositionListener in class Sample
·
removeSamplePositionListener
public 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.
- Overrides:
- removeSamplePositionListener in class Sample
·
sampleStarted
public void sampleStarted(SampleEvent e)
- Called when sample has started. Event's timestamp tells when
sample started playing.
- Parameters:
- e - A sample event.
·
sampleStopped
public void sampleStopped(SampleEvent e)
- Called when sample has stopped or was stopped. Event's
timestamp tells when sample stopped playing.
- Parameters:
- e - A sample event.
·
sampleLooped
public void sampleLooped(SampleEvent e)
- Called when sample has looped. Event's timestamp tells when
sample looped and started playing from start.
- Parameters:
- e - A sample event.
·
samplePositionChanged
public void samplePositionChanged(SamplePositionEvent e)
- Called when sample position has changed.
- Parameters:
- e - A sample position change event.
All Packages Class Hierarchy This Package Previous Next Index