Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.audiolevel
Class AudioLevelEffect

java.lang.Object
  extended by net.java.sip.communicator.impl.neomedia.control.AbstractControls
      extended by net.java.sip.communicator.impl.neomedia.control.ControlsAdapter
          extended by net.java.sip.communicator.impl.neomedia.audiolevel.AudioLevelEffect
All Implemented Interfaces:
javax.media.Codec, javax.media.Controls, javax.media.Effect, javax.media.PlugIn

public class AudioLevelEffect
extends ControlsAdapter
implements javax.media.Effect

An effect that would pass data to the AudioLevelEventDispatcher so that it would calculate levels and dispatch changes to interested parties.

Author:
Damian Minkov, Emil Ivov, Lubomir Marinov

Field Summary
 
Fields inherited from class net.java.sip.communicator.impl.neomedia.control.ControlsAdapter
EMPTY_CONTROLS
 
Fields inherited from interface javax.media.PlugIn
BUFFER_PROCESSED_FAILED, BUFFER_PROCESSED_OK, INPUT_BUFFER_NOT_CONSUMED, OUTPUT_BUFFER_NOT_FILLED, PLUGIN_TERMINATED
 
Constructor Summary
AudioLevelEffect()
          The minimum and maximum values of the scale
 
Method Summary
 void close()
          Closes this effect.
 SimpleAudioLevelListener getAudioLevelListener()
          Returns audio level listener.
 String getName()
          Gets the name of this plug-in as a human-readable string.
 javax.media.Format[] getSupportedInputFormats()
          Lists all of the input formats that this codec accepts.
 javax.media.Format[] getSupportedOutputFormats(javax.media.Format input)
          Lists the output formats that this codec can generate.
 void open()
          Opens this effect.
 int process(javax.media.Buffer inputBuffer, javax.media.Buffer outputBuffer)
          Performs the media processing defined by this codec.
 void reset()
          Resets its state.
 void setAudioLevelListener(SimpleAudioLevelListener listener)
          Sets (or unsets if listener is null), the listener that is going to be notified of audio level changes detected by this effect.
 javax.media.Format setInputFormat(javax.media.Format format)
          Sets the format of the data to be input to this codec.
 javax.media.Format setOutputFormat(javax.media.Format format)
          Sets the format for the data this codec outputs.
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.control.ControlsAdapter
getControls
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.control.AbstractControls
getControl, getControl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.media.Controls
getControl, getControls
 

Constructor Detail

AudioLevelEffect

public AudioLevelEffect()
The minimum and maximum values of the scale

Method Detail

setAudioLevelListener

public void setAudioLevelListener(SimpleAudioLevelListener listener)
Sets (or unsets if listener is null), the listener that is going to be notified of audio level changes detected by this effect. Given the semantics of the AudioLevelEventDispatcher this effect would do no real work if no listener is set or if it is set to null.

Parameters:
listener - the SimplAudioLevelListener that we'd like to receive level changes or null if we'd like level measurements to stop.

getAudioLevelListener

public SimpleAudioLevelListener getAudioLevelListener()
Returns audio level listener.

Returns:
audio level listener or null if not exist

getSupportedInputFormats

public javax.media.Format[] getSupportedInputFormats()
Lists all of the input formats that this codec accepts.

Specified by:
getSupportedInputFormats in interface javax.media.Codec
Returns:
An array that contains the supported input Formats.

getSupportedOutputFormats

public javax.media.Format[] getSupportedOutputFormats(javax.media.Format input)
Lists the output formats that this codec can generate.

Specified by:
getSupportedOutputFormats in interface javax.media.Codec
Parameters:
input - The Format of the data to be used as input to the plug-in.
Returns:
An array that contains the supported output Formats.

setInputFormat

public javax.media.Format setInputFormat(javax.media.Format format)
Sets the format of the data to be input to this codec.

Specified by:
setInputFormat in interface javax.media.Codec
Parameters:
format - The Format to be set.
Returns:
The Format that was set.

setOutputFormat

public javax.media.Format setOutputFormat(javax.media.Format format)
Sets the format for the data this codec outputs.

Specified by:
setOutputFormat in interface javax.media.Codec
Parameters:
format - The Format to be set.
Returns:
The Format that was set.

process

public int process(javax.media.Buffer inputBuffer,
                   javax.media.Buffer outputBuffer)
Performs the media processing defined by this codec.

Specified by:
process in interface javax.media.Codec
Parameters:
inputBuffer - The Buffer that contains the media data to be processed.
outputBuffer - The Buffer in which to store the processed media data.
Returns:
BUFFER_PROCESSED_OK if the processing is successful.
See Also:
PlugIn

getName

public String getName()
Gets the name of this plug-in as a human-readable string.

Specified by:
getName in interface javax.media.PlugIn
Returns:
A String that contains the descriptive name of the plug-in.

open

public void open()
          throws javax.media.ResourceUnavailableException
Opens this effect.

Specified by:
open in interface javax.media.PlugIn
Throws:
javax.media.ResourceUnavailableException - If all of the required resources cannot be acquired.

close

public void close()
Closes this effect.

Specified by:
close in interface javax.media.PlugIn

reset

public void reset()
Resets its state.

Specified by:
reset in interface javax.media.PlugIn

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.