|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsound.player.LiveSound
public class LiveSound
Created by IntelliJ IDEA. User: Douglas Lyon Date: Dec 13, 2004 Time: 8:25:22 PM Copyright DocJava, Inc.
Constructor Summary | |
---|---|
LiveSound()
|
Method Summary | |
---|---|
static void |
addLiveSoundListener(LiveSoundListener listener)
Add a live sound listener. |
static int |
getBitsPerSample()
Return the number of bits per audio sample, which is set by the setBitsPerSample() method. |
static int |
getBufferSize()
Return the size of the internal capture and playback audio buffers, in samples per channel. |
static int |
getChannels()
Return the number of audio channels, which is set by the setChannels() method. |
static int |
getSampleRate()
Return the current sampling rate in Hz, which is set by the setSampleRate() method. |
static double[][] |
getSamples(java.lang.Object consumer)
Return an array of captured audio samples. |
static int |
getTransferSize()
Get the array length (in samples per channel) to use for capturing and playing samples via the putSamples() and getSamples() methods. |
static boolean |
isCaptureActive()
Return true if audio capture is currently active. |
static boolean |
isPlaybackActive()
Return true if audio playback is currently active. |
static void |
putSamples(java.lang.Object producer,
double[][] samplesArray)
Play an array of audio samples. |
static void |
removeLibeSoundListener(LiveSoundListener listener)
Remove a live sound listener. |
static void |
resetCapture()
Stop audio capture. |
static void |
resetPlayback()
Stop audio playback. |
static void |
setBitsPerSample(int bitsPerSample)
Set the number of bits per sample to use for audio capture and playback and notify an registered listeners of the change. |
static void |
setBufferSize(int bufferSize)
Set the size of the internal capture and playback audio buffers, in samples per channel and notify an registered listeners of the change. |
static void |
setChannels(int channels)
Set the number of audio channels to use for capture and playback and notify an registered listeners of the change. |
static void |
setSampleRate(int sampleRate)
Set the sample rate to use for audio capture and playback and notify an registered listeners of the change. |
static void |
setTransferSize(int transferSize)
Set the array length (in samples per channel) to use for capturing and playing samples via the putSamples() and getSamples() methods. |
static void |
startCapture(java.lang.Object consumer)
Start audio capture. |
static void |
startPlayback(java.lang.Object producer)
Start audio playback. |
static void |
stopCapture(java.lang.Object consumer)
Stop audio capture. |
static void |
stopPlayback(java.lang.Object producer)
Stop audio playback. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LiveSound()
Method Detail |
---|
public static void addLiveSoundListener(LiveSoundListener listener)
listener
- The LiveSoundListener to add.public static void removeLibeSoundListener(LiveSoundListener listener)
listener
- The LiveSoundListener to remove.public static int getSampleRate()
public static int getBitsPerSample()
public static int getChannels()
public static int getBufferSize()
public static boolean isCaptureActive()
public static boolean isPlaybackActive()
public static void setSampleRate(int sampleRate) throws java.io.IOException
sampleRate
- Sample rate in Hz.
java.io.IOException
- If the specified sample rate is
not supported by the audio hardware or by Java.public static void setBitsPerSample(int bitsPerSample) throws java.io.IOException
bitsPerSample
- The number of bits per sample.
java.io.IOException
- If the specified bits per sample is
not supported by the audio hardware or by Java.public static void setChannels(int channels) throws java.io.IOException
channels
- The number audio channels.
java.io.IOException
- If the specified number of channels is
not supported by the audio hardware or by Java.public static void setBufferSize(int bufferSize) throws java.io.IOException
bufferSize
- The size of the internal capture and
playback audio buffers, in samples per channel.
java.io.IOException
- If the specified number of channels is
not supported by the audio hardware or by Java.public static void setTransferSize(int transferSize) throws java.lang.IllegalStateException
transferSize
- The size of the 2nd dimension of
the 2-dimensional array used by the putSamples() and
getSamples() methods
java.lang.IllegalStateException
- If this method is called
while audio capture or playback are active.public static int getTransferSize()
public static void resetCapture()
public static void resetPlayback()
public static void startCapture(java.lang.Object consumer) throws java.io.IOException, java.lang.IllegalStateException
consumer
- The object to be given exclusive access
to the captured audio resources.
java.lang.IllegalStateException
- If this method is called
while audio capture is already active.
java.io.IOException
public static void stopCapture(java.lang.Object consumer) throws java.io.IOException, java.lang.IllegalStateException
consumer
- The object that held on exclusive
lock on the captured audio resources when this
method was invoked.
java.lang.IllegalStateException
- If the specified
object did not hold an exclusive lock on the
captured audio resources when this method was invoked.
java.io.IOException
public static void startPlayback(java.lang.Object producer) throws java.io.IOException, java.lang.IllegalStateException
producer
- The object to be given exclusive access
to the playback playback resources.
java.lang.IllegalStateException
- If this method is called
while audio playback is already active.
java.io.IOException
public static void stopPlayback(java.lang.Object producer) throws java.io.IOException, java.lang.IllegalStateException
producer
- The object that held on exclusive
lock on the playback audio resources when this
method was invoked.
java.lang.IllegalStateException
- If the specified
object did not hold an exclusive lock on the
playback audio resources when this method was invoked.
java.io.IOException
public static double[][] getSamples(java.lang.Object consumer) throws java.io.IOException, java.lang.IllegalStateException
consumer
- The object that has an exclusive lock on
the captured audio resources.
java.io.IOException
- If there is a problem capturing
audio.
java.lang.IllegalStateException
- If audio capture is
currently inactive, or if the specified object does
not hold the lock on the captured audio resources.public static void putSamples(java.lang.Object producer, double[][] samplesArray) throws java.io.IOException, java.lang.IllegalStateException
producer
- The object that has an exclusive lock on
the playback audio resources.samplesArray
- A two dimensional array containing
the samples to play or write to a file.
java.io.IOException
- If there is a problem playing audio.
java.lang.IllegalStateException
- If audio playback is currently
inactive. That is, If startPlayback() has not yet been called
or if stopPlayback() has already been called.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |