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.


Class Index

 o AudioPlayer.State
Inner class to provide typesafe enumerated audio states.

Variable Index

 o audioBuffer
 o audioDescription
 o defaultFormat
 o isCapturing
 o isPlaying
 o listenerList
 o nPlayers

Constructor Index

 o AudioPlayer()

Method Index

 o addAudioPlayerListener(AudioPlayerListener)
Allows other classes to listen for AudioPlayer events
 o captureAudio()
Record audio into the internal buffer.
 o getAudioDescription()
Return a String describing the audio currently stored in the internal buffer (file name or other source).
 o getFormat()
Return an AudioFormat object specifying the type of audio dealt with by this class.
 o getGraphData()
Get linearized data for graph.
 o hasAudio()
Return a boolean flag indicating whether the buffer is empty or not.
 o openAudioFile(File)
Read audio from a file to the internal buffer.
 o playAudio()
Play audio in the internal buffer.
 o removeAudioPlayerListener(AudioPlayerListener)
Allows other classes to stop listening to AudioPlayer events
 o saveAudioFile(File)
Save audio in the internal buffer to a file.
 o saveAudioFile(File, AudioFormat$Encoding)
Save audio in the internal buffer to a file after converting to the specified encoding.
 o stop()
Stop recording or playing.

Variables

 o isCapturing
 protected boolean isCapturing
 o isPlaying
 protected boolean isPlaying
 o nPlayers
 protected static short nPlayers
 o audioBuffer
 protected audio.AudioBuffer audioBuffer
 o audioDescription
 protected java.lang.String audioDescription
 o listenerList
 protected javax.swing.event.EventListenerList listenerList
 o defaultFormat
 protected static final javax.sound.sampled.AudioFormat defaultFormat

Constructors

 o AudioPlayer
 public AudioPlayer()

Methods

 o captureAudio
 public void captureAudio()
Record audio into the internal buffer. This runs in a separate thread.

 o openAudioFile
 public void openAudioFile(java.io.File readFile)
Read audio from a file to the internal buffer. This runs in a separate thread.

 o playAudio
 public void playAudio()
Play audio in the internal buffer. This runs in a separate thread.

 o 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.

 o 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.

 o hasAudio
 public boolean hasAudio()
Return a boolean flag indicating whether the buffer is empty or not.

 o getFormat
 public javax.sound.sampled.AudioFormat getFormat()
Return an AudioFormat object specifying the type of audio dealt with by this class.

 o getAudioDescription
 public java.lang.String getAudioDescription()
Return a String describing the audio currently stored in the internal buffer (file name or other source).

 o stop
 public void stop()
Stop recording or playing.

 o getGraphData
 public short[] getGraphData()
Get linearized data for graph.

 o addAudioPlayerListener
 public void addAudioPlayerListener(audio.AudioPlayerListener o)
Allows other classes to listen for AudioPlayer events

 o 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