Package ipsk.audio
Interface AudioController
-
- All Known Implementing Classes:
J2AudioController
public interface AudioControllerDeprecated.Please useAudioController2instead.Manages audio recording and playback. This interface allows easy recording of playback and recording auf audio. It supports simultanous recording/playback of more than one line. Implementations should try to synchronize this lines. Audio lines and channels are sometimes confused: A line is a way for an audio stream. The audio stream can have one or more channels, determined by the audio format setting. After the number of lines (usingsetNumLines(int)) and the audio format (usingsetAudioFormat(AudioFormat)) are set, you must configure (configure()) the controller. If the controller is not able to find matching audio lines it will throw an exception. Before starting playback or recording (or capturing) you have to open the controller.
Summary of features:- looks for matching audio mixers and lines
- configures and opens the lines
- handles synchronized starting and stopping
A typical scenario for a session:
- Set audio format for the session.
- Optionally set the mixer and/or number of lines to use.
- Configure the session.
- Open the session.
- Prepare recording.
- Start recording.
- Stop recording.
- Prepare playback.
- Optionally set start/stop position.
- Start playback.
- Pause playback.
- Start playback.
- Stop playback or the playback finishes at the end of file(s)
- Repeat several times from Nr. 5.
- Close session.
- Version:
- $Id: AudioController.java,v 1.15 2011/04/07 19:49:01 klausj Exp $
- Author:
- Klaus Jänsch, klausj@phonetik.uni-muenchen.de
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classAudioController.CaptureStatusDeprecated.Represents status of the capture engine.static classAudioController.PlaybackStatusDeprecated.Represents status of the playback engine.
-
Field Summary
Fields Modifier and Type Field Description static longAUDIO_ENDDeprecated.static longDISABLE_CAPTUREDeprecated.static longFULLDUPLEXDeprecated.static longHOLD_OPENDeprecated.static longOPEN_ON_DEMANDDeprecated.static longPOS_UNKNOWNDeprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddAudioControllerListener(AudioControllerListener acl)Deprecated.Adds controller listener.voidclose()Deprecated.Closes this session.voidconfigure()Deprecated.Configures a session.javax.sound.sampled.AudioFormatgetAudioFormat()Deprecated.Get audio format.AudioController.CaptureStatusgetCaptureStatus()Deprecated.Gets current status of the capturer.float[]getLevels()Deprecated.Gets levels of all channels. maximum level is 1.0 representing 0dB
minimum level is 0
array has channels * numLines entrieslonggetMode()Deprecated.intgetNumLines()Deprecated.Get number of lines.javax.sound.sampled.AudioFormatgetPlaybackAudioFormat()Deprecated.Get audio format for playback.java.io.File[]getPlaybackFiles()Deprecated.Gets playback files.longgetPlaybackFrameLength()Deprecated.Gets length of largest playback file in frames, -1 if not availablelonggetPlaybackFramePosition()Deprecated.Get playback position.longgetPlaybackStartFramePosition()Deprecated.Gets the start position.AudioController.PlaybackStatusgetPlaybackStatus()Deprecated.Gets current status of playback.longgetPlaybackStopFramePosition()Deprecated.Gets the stop position.java.lang.StringgetProperty(java.lang.String propertyName)Deprecated.Get an implementation specific property.java.lang.StringgetPropertyDescription(java.lang.String propertyName)Deprecated.Get a description of the property.java.lang.String[]getPropertyNames()Deprecated.Get an implementation specific property names.java.io.File[]getRecordingFiles()Deprecated.Gets recording files.longgetRecordingFramePosition()Deprecated.Get recording position.javax.sound.sampled.Mixer.InfogetSourceMixerInfo()Deprecated.Get current used source mixer (playback) info.javax.sound.sampled.Mixer.InfogetTargetMixerInfo()Deprecated.Get current used target mixer (recording) info.booleanisOverwrite()Deprecated.Gets overwrite flag.booleanisPlaybackRandomPositioningSupported()Deprecated.Get random positioning capability of the playback engine.voidopen()Deprecated.Opens the session.voidpausePlayback()Deprecated.Pauses playback.voidpreparePlayback()Deprecated.Prepares playback.voidprepareRecording()Deprecated.Prepares recording.voidremoveAudioControllerListener(AudioControllerListener acl)Deprecated.Removes controller listener.voidsetAudioFormat(javax.sound.sampled.AudioFormat audioFormat)Deprecated.Use audio format audioFormat..voidsetMode(long modeBits)Deprecated.voidsetNumLines(int numLines)Deprecated.Use numLines lines.voidsetOverwrite(boolean overwrite)Deprecated.Sets overwrite flag.voidsetPlaybackAudioSources(AudioSource[] sources)Deprecated.voidsetPlaybackFiles(java.io.File[] playbackFiles)Deprecated.Sets playback files to use.longsetPlaybackFramePosition(long newPosition)Deprecated.Sets the new frame position of playback.voidsetPlaybackInputStreams(java.io.InputStream[] inputStreams)Deprecated.Sets playback Inputstreams to use.longsetPlaybackStartFramePosition(long startPosition)Deprecated.Sets the start position.longsetPlaybackStopFramePosition(long stopPosition)Deprecated.Sets the stop position.voidsetPlaybackURLs(java.net.URL[] urls)Deprecated.Sets playback URL's to use.voidsetProperty(java.lang.String propertyName, java.lang.String value)Deprecated.Set a property for a specific implementation.voidsetRecordingFiles(java.io.File[] recordingFiles)Deprecated.Sets recording files to use.voidsetRecordingOutputStreams(java.io.OutputStream[] streams)Deprecated.Sets recording OutputStreams to use.voidsetSettings()Deprecated.Call the graphical user interface of the controller implementation to set the configuration.voidsetSourceMixer(javax.sound.sampled.Mixer.Info mixerInfo)Deprecated.Use the source mixer (playback) described by mixerInfo.voidsetSourceMixerName(java.lang.String mixerName)Deprecated.Use the source mixer (playback) with the given name.voidsetTargetMixer(javax.sound.sampled.Mixer.Info mixerInfo)Deprecated.Use the target mixer (recording) described by mixerInfo.voidsetTargetMixerName(java.lang.String mixerName)Deprecated.Use the target mixer (recording) with the given name.voidstartCapture()Deprecated.Starts the capturing of data.voidstartPlayback()Deprecated.Starts the playback.voidstartRecording()Deprecated.Starts recording to the given files.voidstopCapture()Deprecated.Stops capturing.voidstopPlayback()Deprecated.Stops playback.voidstopRecording()Deprecated.Stops recording. the method blocks until all files are written
-
-
-
Field Detail
-
AUDIO_END
static final long AUDIO_END
Deprecated.- See Also:
- Constant Field Values
-
POS_UNKNOWN
static final long POS_UNKNOWN
Deprecated.- See Also:
- Constant Field Values
-
FULLDUPLEX
static final long FULLDUPLEX
Deprecated.- See Also:
- Constant Field Values
-
OPEN_ON_DEMAND
static final long OPEN_ON_DEMAND
Deprecated.- See Also:
- Constant Field Values
-
DISABLE_CAPTURE
static final long DISABLE_CAPTURE
Deprecated.- See Also:
- Constant Field Values
-
HOLD_OPEN
static final long HOLD_OPEN
Deprecated.- See Also:
- Constant Field Values
-
-
Method Detail
-
setSourceMixerName
void setSourceMixerName(java.lang.String mixerName)
Deprecated.Use the source mixer (playback) with the given name.- Parameters:
mixerName- the name of the source mixer
-
setSourceMixer
void setSourceMixer(javax.sound.sampled.Mixer.Info mixerInfo)
Deprecated.Use the source mixer (playback) described by mixerInfo.- Parameters:
mixerInfo- the info (name) of the mixer
-
getSourceMixerInfo
javax.sound.sampled.Mixer.Info getSourceMixerInfo()
Deprecated.Get current used source mixer (playback) info.- Returns:
- mixerInfo the info of the source mixer
-
setTargetMixerName
void setTargetMixerName(java.lang.String mixerName)
Deprecated.Use the target mixer (recording) with the given name.- Parameters:
mixerName- the name of the target mixer
-
setTargetMixer
void setTargetMixer(javax.sound.sampled.Mixer.Info mixerInfo)
Deprecated.Use the target mixer (recording) described by mixerInfo.- Parameters:
mixerInfo- the info of the target mixer
-
getTargetMixerInfo
javax.sound.sampled.Mixer.Info getTargetMixerInfo()
Deprecated.Get current used target mixer (recording) info.- Returns:
- mixerInfo the info (name) of the target mixer
-
setMode
void setMode(long modeBits)
Deprecated.
-
getMode
long getMode()
Deprecated.
-
setNumLines
void setNumLines(int numLines)
Deprecated.Use numLines lines. For each line a recording file will be created.- Parameters:
numLines- number of lines to use
-
getNumLines
int getNumLines()
Deprecated.Get number of lines.- Returns:
- number of lines to use
-
setAudioFormat
void setAudioFormat(javax.sound.sampled.AudioFormat audioFormat)
Deprecated.Use audio format audioFormat..- Parameters:
audioFormat- audio format
-
getAudioFormat
javax.sound.sampled.AudioFormat getAudioFormat()
Deprecated.Get audio format.- Returns:
- audio format
-
getPlaybackAudioFormat
javax.sound.sampled.AudioFormat getPlaybackAudioFormat()
Deprecated.Get audio format for playback. The controller sets the audio format according to the set playback files. So it can differ from the chosen foprmat.- Returns:
- audio format
-
configure
void configure() throws AudioControllerExceptionDeprecated.Configures a session.- Throws:
AudioControllerException
-
open
void open() throws AudioControllerException
Deprecated.Opens the session.- Throws:
AudioControllerException
-
close
void close() throws AudioControllerExceptionDeprecated.Closes this session.- Throws:
AudioControllerException
-
setPlaybackFiles
void setPlaybackFiles(java.io.File[] playbackFiles)
Deprecated.Sets playback files to use.the size of the array must equal the number of lines opened.
- Parameters:
playbackFiles- the file array to play
-
getPlaybackFiles
java.io.File[] getPlaybackFiles()
Deprecated.Gets playback files.the size of the array is equal the number of lines opened.
- Returns:
- the file array of playbackfiles set
-
setPlaybackURLs
void setPlaybackURLs(java.net.URL[] urls)
Deprecated.Sets playback URL's to use.the size of the array must equal the number of lines opened.
- Parameters:
urls- the URL array to play
-
setPlaybackInputStreams
void setPlaybackInputStreams(java.io.InputStream[] inputStreams)
Deprecated.Sets playback Inputstreams to use.the size of the array must equal the number of lines opened.
- Parameters:
inputStreams- the inputstream array to play
-
setPlaybackAudioSources
void setPlaybackAudioSources(AudioSource[] sources)
Deprecated.
-
setOverwrite
void setOverwrite(boolean overwrite)
Deprecated.Sets overwrite flag. If the overwrite flag is set, existing recording files are overwritten without any exception or warning.- Parameters:
overwrite- overwrite flag
-
isOverwrite
boolean isOverwrite()
Deprecated.Gets overwrite flag. If the overwrite flag is set, existing recording files are overwritten without any exception or warning.- Returns:
- overwrite flag
-
setRecordingFiles
void setRecordingFiles(java.io.File[] recordingFiles)
Deprecated.Sets recording files to use.the size of the array must equal the number of lines opened.
- Parameters:
recordingFiles-
-
getRecordingFiles
java.io.File[] getRecordingFiles()
Deprecated.Gets recording files.the size of the array is equal the number of lines opened.
- Returns:
- recordingFiles
-
setRecordingOutputStreams
void setRecordingOutputStreams(java.io.OutputStream[] streams)
Deprecated.Sets recording OutputStreams to use.the size of the array must equal the number of lines opened.
- Parameters:
streams- recording OutputStreams
-
preparePlayback
void preparePlayback() throws AudioControllerExceptionDeprecated.Prepares playback.- Throws:
AudioControllerException
-
prepareRecording
void prepareRecording() throws AudioControllerExceptionDeprecated.Prepares recording.- Throws:
AudioControllerException
-
startPlayback
void startPlayback() throws AudioControllerExceptionDeprecated.Starts the playback.- Throws:
AudioControllerException
-
startCapture
void startCapture() throws AudioControllerExceptionDeprecated.Starts the capturing of data. Can be used to capture data from the line without writing to files- Throws:
AudioControllerException
-
startRecording
void startRecording() throws AudioControllerExceptionDeprecated.Starts recording to the given files.- Throws:
AudioControllerException- See Also:
prepareRecording()
-
pausePlayback
void pausePlayback() throws AudioControllerExceptionDeprecated.Pauses playback.- Throws:
AudioControllerException
-
stopPlayback
void stopPlayback() throws AudioControllerExceptionDeprecated.Stops playback.- Throws:
AudioControllerException
-
stopCapture
void stopCapture() throws AudioControllerExceptionDeprecated.Stops capturing.- Throws:
AudioControllerException
-
stopRecording
void stopRecording() throws AudioControllerExceptionDeprecated.Stops recording. the method blocks until all files are written- Throws:
AudioControllerException
-
getLevels
float[] getLevels()
Deprecated.Gets levels of all channels. maximum level is 1.0 representing 0dB
minimum level is 0
array has channels * numLines entries- Returns:
- current audio levels
-
isPlaybackRandomPositioningSupported
boolean isPlaybackRandomPositioningSupported()
Deprecated.Get random positioning capability of the playback engine.- Returns:
- random positioning capability
-
getPlaybackFrameLength
long getPlaybackFrameLength()
Deprecated.Gets length of largest playback file in frames, -1 if not available- Returns:
- length of largest playback file in frames
-
setPlaybackFramePosition
long setPlaybackFramePosition(long newPosition)
Deprecated.Sets the new frame position of playback.- Parameters:
newPosition- the requested position- Returns:
- the actually set position or POS_UNKNOWN (-1) if not supported
-
getPlaybackFramePosition
long getPlaybackFramePosition()
Deprecated.Get playback position.- Returns:
- current playback position in audio frames or POS_UNKNOWN (-1) if not supported
-
setPlaybackStartFramePosition
long setPlaybackStartFramePosition(long startPosition)
Deprecated.Sets the start position. Used to play only a segment of an audio file.- Parameters:
startPosition- position in audio frames from where to start- Returns:
- the actually set start position
-
getPlaybackStartFramePosition
long getPlaybackStartFramePosition()
Deprecated.Gets the start position.- Returns:
- start position
-
setPlaybackStopFramePosition
long setPlaybackStopFramePosition(long stopPosition)
Deprecated.Sets the stop position. Used to play only a segment of an audio file. To play the whole audio file set the position to AUDIO_END (-1).- Parameters:
stopPosition- position in audio frames to stop- Returns:
- the actually set stop position
-
getPlaybackStopFramePosition
long getPlaybackStopFramePosition()
Deprecated.Gets the stop position.- Returns:
- stop position
-
getRecordingFramePosition
long getRecordingFramePosition()
Deprecated.Get recording position.- Returns:
- current recording position in audio frames or -1 if not supported
-
getPropertyNames
java.lang.String[] getPropertyNames()
Deprecated.Get an implementation specific property names.- Returns:
- property names
-
getPropertyDescription
java.lang.String getPropertyDescription(java.lang.String propertyName)
Deprecated.Get a description of the property.- Parameters:
propertyName-- Returns:
- description
-
setProperty
void setProperty(java.lang.String propertyName, java.lang.String value)Deprecated.Set a property for a specific implementation.- Parameters:
propertyName-value-
-
getProperty
java.lang.String getProperty(java.lang.String propertyName)
Deprecated.Get an implementation specific property.- Parameters:
propertyName-- Returns:
- value of the property or null if there is no such property
-
setSettings
void setSettings()
Deprecated.Call the graphical user interface of the controller implementation to set the configuration.
-
getCaptureStatus
AudioController.CaptureStatus getCaptureStatus()
Deprecated.Gets current status of the capturer.- Returns:
- capture status
-
getPlaybackStatus
AudioController.PlaybackStatus getPlaybackStatus()
Deprecated.Gets current status of playback.- Returns:
- playback status
-
addAudioControllerListener
void addAudioControllerListener(AudioControllerListener acl)
Deprecated.Adds controller listener.- Parameters:
acl- controller listener
-
removeAudioControllerListener
void removeAudioControllerListener(AudioControllerListener acl)
Deprecated.Removes controller listener.- Parameters:
acl- controller listener
-
-