All Packages Class Hierarchy This Package Previous Next Index
Class audio.AudioPlayer
audio.AudioPlayer
- public class AudioPlayer
- extends java.lang.Object
An AudioPlayer knows how to access audio hardware to capture
and playback sound. It also knows how to access the file system
to read and write audio files. It can read and write audio
files in multiple formats and with multiple audio data encodings.
-
AudioPlayer.State
- Inner class to provide typesafe enumerated audio states.
-
audioBuffer
-
-
audioDescription
-
-
defaultFormat
-
-
isCapturing
-
-
isPlaying
-
-
listenerList
-
-
nPlayers
-
-
AudioPlayer()
-
-
addAudioPlayerListener(AudioPlayerListener)
-
Allows other classes to listen for AudioPlayer events
-
captureAudio()
- Record audio into the internal buffer.
-
getAudioDescription()
- Return a String describing the audio currently stored
in the internal buffer (file name or other source).
-
getFormat()
- Return an AudioFormat object specifying the type of
audio dealt with by this class.
-
getGraphData()
- Get linearized data for graph.
-
hasAudio()
- Return a boolean flag indicating whether the buffer is
empty or not.
-
openAudioFile(File)
- Read audio from a file to the internal buffer.
-
playAudio()
- Play audio in the internal buffer.
-
removeAudioPlayerListener(AudioPlayerListener)
-
Allows other classes to stop listening to AudioPlayer events
-
saveAudioFile(File)
- Save audio in the internal buffer to a file.
-
saveAudioFile(File, AudioFormat$Encoding)
- Save audio in the internal buffer to a file after converting to
the specified encoding.
-
stop()
- Stop recording or playing.
isCapturing
protected boolean isCapturing
isPlaying
protected boolean isPlaying
nPlayers
protected static short nPlayers
audioBuffer
protected audio.AudioBuffer audioBuffer
audioDescription
protected java.lang.String audioDescription
listenerList
protected javax.swing.event.EventListenerList listenerList
defaultFormat
protected static final javax.sound.sampled.AudioFormat defaultFormat
AudioPlayer
public AudioPlayer()
captureAudio
public void captureAudio()
- Record audio into the internal buffer.
This runs in a separate thread.
openAudioFile
public void openAudioFile(java.io.File readFile)
- Read audio from a file to the internal buffer. This runs
in a separate thread.
playAudio
public void playAudio()
- Play audio in the internal buffer.
This runs in a separate thread.
saveAudioFile
public void saveAudioFile(java.io.File writeFile,
javax.sound.sampled.AudioFormat$Encoding writeEncoding)
- Save audio in the internal buffer to a file after converting to
the specified encoding. This runs in a separate thread.
saveAudioFile
public void saveAudioFile(java.io.File writeFile) throws audio.AudioPlayerException
- Save audio in the internal buffer to a file. This runs
in a separate thread.
hasAudio
public boolean hasAudio()
- Return a boolean flag indicating whether the buffer is
empty or not.
getFormat
public javax.sound.sampled.AudioFormat getFormat()
- Return an AudioFormat object specifying the type of
audio dealt with by this class.
getAudioDescription
public java.lang.String getAudioDescription()
- Return a String describing the audio currently stored
in the internal buffer (file name or other source).
stop
public void stop()
- Stop recording or playing.
getGraphData
public short[] getGraphData()
- Get linearized data for graph.
addAudioPlayerListener
public void addAudioPlayerListener(audio.AudioPlayerListener o)
- Allows other classes to listen for AudioPlayer events
removeAudioPlayerListener
public void removeAudioPlayerListener(audio.AudioPlayerListener o)
- Allows other classes to stop listening to AudioPlayer events
All Packages Class Hierarchy This Package Previous Next Index