SIP Communicator: 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.audio.PortAudioRenderer
All Implemented Interfaces:
javax.media.Controls, javax.media.PlugIn, javax.media.Renderer

public class PortAudioRenderer
extends ControlsAdapter
implements javax.media.Renderer

Implements an audio Renderer which uses PortAudio.

Author:
Damian Minkov, 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
PortAudioRenderer()
          Initializes a new PortAudioRenderer instance.
 
Method Summary
 void close()
          Closes this PlugIn.
 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.
 void reset()
          Resets this PlugIn.
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.
 javax.media.Format setInputFormat(javax.media.Format format)
          Sets the JMF Format of the audio data to be rendered by this Renderer.
 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.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

PortAudioRenderer

public PortAudioRenderer()
Initializes a new PortAudioRenderer instance.

Method Detail

close

public void close()
Closes this PlugIn.

Specified by:
close in interface javax.media.PlugIn

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.

Specified by:
getName in interface javax.media.PlugIn
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.

Specified by:
getSupportedInputFormats in interface javax.media.Renderer
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.

Specified by:
open in interface javax.media.PlugIn
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.

Specified by:
process in interface javax.media.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

reset

public void reset()
Resets this PlugIn.

Specified by:
reset in interface javax.media.PlugIn

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

setInputFormat

public javax.media.Format setInputFormat(javax.media.Format format)
Sets the JMF Format of the audio data to be rendered by this Renderer.

Specified by:
setInputFormat in interface javax.media.Renderer
Parameters:
format - the JMF Format of the audio data to be redered by this instance
Returns:
null if the specified format is not compatible with this Renderer; otherwise, the JMF Format which has been successfully set

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.

Specified by:
start in interface javax.media.Renderer

stop

public void stop()
Stops the rendering process.

Specified by:
stop in interface javax.media.Renderer

SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

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