Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.neomedia.jmfext.media.renderer.audio
Class PortAudioRenderer

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.jmfext.media.renderer.AbstractRenderer<javax.media.format.AudioFormat>
              extended by net.java.sip.communicator.impl.neomedia.jmfext.media.renderer.audio.PortAudioRenderer
All Implemented Interfaces:
javax.media.Controls, javax.media.PlugIn, javax.media.Renderer

public class PortAudioRenderer
extends AbstractRenderer<javax.media.format.AudioFormat>

Implements an audio Renderer which uses PortAudio.

Author:
Damian Minkov, Lyubomir Marinov

Field Summary
 
Fields inherited from class net.java.sip.communicator.impl.neomedia.jmfext.media.renderer.AbstractRenderer
inputFormat
 
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
PortAudioRenderer()
          Initializes a new PortAudioRenderer instance.
PortAudioRenderer(boolean enableVolumeControl)
          Initializes a new PortAudioRenderer instance.
 
Method Summary
 void close()
          Closes this PlugIn.
 Object[] getControls()
          Implements Controls.getControls().
 javax.media.MediaLocator getLocator()
          Gets the MediaLocator which specifies the device index of the PortAudio device used by this instance for rendering.
 String getName()
          Gets the descriptive/human-readable name of this JMF plug-in.
 javax.media.Format[] getSupportedInputFormats()
          Gets the list of JMF Formats of audio data which this Renderer is capable of rendering.
 void open()
          Opens the PortAudio device and output stream represented by this instance which are to be used to render audio.
 int process(javax.media.Buffer buffer)
          Renders the audio data contained in a specific Buffer onto the PortAudio device represented by this Renderer.
static void setDefaultLocator(javax.media.MediaLocator defaultLocator)
          Sets the MediaLocator which specifies the device index of the PortAudio device to be used by PortAudioRenderer instances which are to be opened later on and which don't have a specified MediaLocator at the time of opening.
 void setLocator(javax.media.MediaLocator locator)
          Sets the MediaLocator which specifies the device index of the PortAudio device to be used by this instance for rendering.
 void start()
          Starts the rendering process.
 void stop()
          Stops the rendering process.
 
Methods inherited from class net.java.sip.communicator.impl.neomedia.jmfext.media.renderer.AbstractRenderer
reset, setInputFormat
 
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
 

Constructor Detail

PortAudioRenderer

public PortAudioRenderer()
Initializes a new PortAudioRenderer instance.


PortAudioRenderer

public PortAudioRenderer(boolean enableVolumeControl)
Initializes a new PortAudioRenderer instance.

Parameters:
enableVolumeControl - true to enable volume control; false, otherwise
Method Detail

close

public void close()
Closes this PlugIn.


getControls

public Object[] getControls()
Implements Controls.getControls(). Gets the controls available for the owner of this instance. The current implementation returns an empty array because it has no available controls.

Specified by:
getControls in interface javax.media.Controls
Overrides:
getControls in class ControlsAdapter
Returns:
an array of Objects which represent the controls available for the owner of this instance

getLocator

public javax.media.MediaLocator getLocator()
Gets the MediaLocator which specifies the device index of the PortAudio device used by this instance for rendering.

Returns:
the MediaLocator which specifies the device index of the PortAudio device used by this instance for rendering

getName

public String getName()
Gets the descriptive/human-readable name of this JMF plug-in.

Returns:
the descriptive/human-readable name of this JMF plug-in

getSupportedInputFormats

public javax.media.Format[] getSupportedInputFormats()
Gets the list of JMF Formats of audio data which this Renderer is capable of rendering.

Returns:
an array of JMF Formats of audio data which this Renderer is capable of rendering

open

public void open()
          throws javax.media.ResourceUnavailableException
Opens the PortAudio device and output stream represented by this instance which are to be used to render audio.

Throws:
javax.media.ResourceUnavailableException - if the PortAudio device or output stream cannot be created or opened

process

public int process(javax.media.Buffer buffer)
Renders the audio data contained in a specific Buffer onto the PortAudio device represented by this Renderer.

Parameters:
buffer - the Buffer which contains the audio data to be rendered
Returns:
BUFFER_PROCESSED_OK if the specified buffer has been successfully processed

setDefaultLocator

public static void setDefaultLocator(javax.media.MediaLocator defaultLocator)
Sets the MediaLocator which specifies the device index of the PortAudio device to be used by PortAudioRenderer instances which are to be opened later on and which don't have a specified MediaLocator at the time of opening.

Parameters:
defaultLocator - the MediaLocator which specifies the device index of the PortAudio device to be used by PortAudioRenderer instances which are to be opened later on and which don't have a specified MediaLocator at the time of opening

setLocator

public void setLocator(javax.media.MediaLocator locator)
Sets the MediaLocator which specifies the device index of the PortAudio device to be used by this instance for rendering.

Parameters:
locator - a MediaLocator which specifies the device index of the PortAudio device to be used by this instance for rendering

start

public void start()
Starts the rendering process. Any audio data available in the internal resources associated with this PortAudioRenderer will begin being rendered.


stop

public void stop()
Stops the rendering process.


Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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