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

net.java.sip.communicator.impl.media.device
Class DeviceConfiguration

java.lang.Object
  extended by net.java.sip.communicator.util.PropertyChangeNotifier
      extended by net.java.sip.communicator.impl.media.device.DeviceConfiguration

public class DeviceConfiguration
extends PropertyChangeNotifier

This class aims to provide a simple configuration interface for JMF. It retrieves stored configuration when started or listens to ConfigurationEvent for property changes and configures the JMF accordingly.

Author:
Martin Andre, Emil Ivov, Lubomir Marinov

Field Summary
static String AUDIO_CAPTURE_DEVICE
          The name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for audio capture.
static String AUDIO_NOTIFY_DEVICE
          The name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for audio notify.
static String AUDIO_PLAYBACK_DEVICE
          The name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for audio playback.
static String AUDIO_SYSTEM_JAVASOUND
          JavaSound sound system.
static String AUDIO_SYSTEM_NONE
          When audio is disabled the selected audio system is with name None.
static String AUDIO_SYSTEM_PORTAUDIO
          PortAudio sound system.
static String VIDEO_CAPTURE_DEVICE
          The name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for video capture.
 
Constructor Summary
DeviceConfiguration()
          Default constructor.
 
Method Summary
static void addAudioSystem(String audioSystemName)
          Adds audio system.
 javax.media.CaptureDeviceInfo getAudioCaptureDevice()
          Returns a device that we could use for audio capture.
 javax.media.CaptureDeviceInfo getAudioNotifyDevice()
           
 javax.media.CaptureDeviceInfo getAudioPlaybackDevice()
           
 String getAudioSystem()
          The current selected audio system.
 javax.media.CaptureDeviceInfo[] getAvailableAudioCaptureDevices()
          Gets the list of audio capture devices which are available through this DeviceConfiguration, amongst which is getAudioCaptureDevice() and represent acceptable values for setAudioCaptureDevice(CaptureDeviceInfo)
 javax.media.CaptureDeviceInfo[] getAvailableAudioCaptureDevices(String soundSystem)
          Gets the list of audio capture devices which are available through this DeviceConfiguration, amongst which is getAudioCaptureDevice() and represent acceptable values for setAudioCaptureDevice(CaptureDeviceInfo)
 javax.media.CaptureDeviceInfo[] getAvailableAudioPlaybackDevices()
          Lists all the playback devices.
 String[] getAvailableAudioSystems()
          Return the installed Audio Systems.
 javax.media.CaptureDeviceInfo[] getAvailableVideoCaptureDevices()
          Gets the list of video capture devices which are available through this DeviceConfiguration, amongst which is getVideoCaptureDevice() and represent acceptable values for setVideoCaptureDevice(CaptureDeviceInfo)
 javax.media.CaptureDeviceInfo getVideoCaptureDevice()
          Returns a device that we could use for video capture.
 void initialize()
          Initializes capture devices.
protected static void initPortAudioRenderer()
          Installs the PortAudio Renderer
 boolean isAudioCaptureSupported()
          Enable or disable Audio stream transmission.
 boolean isDenoiseEnabled()
          Returns the state of noise suppression configuration.
 boolean isEchoCancelEnabled()
          Returns the state of echo cancel configuration.
 boolean isVideoCaptureSupported()
          Enable or disable Video stream transmission.
 void setAudioCaptureDevice(javax.media.CaptureDeviceInfo device)
          Sets the device which is to be used by this DeviceConfiguration for audio capture.
 void setAudioNotifyDevice(javax.media.CaptureDeviceInfo audioNotifyDevice)
           
 void setAudioPlaybackDevice(javax.media.CaptureDeviceInfo audioPlaybackDevice)
           
 void setAudioSystem(String name, javax.media.CaptureDeviceInfo captureDevice)
          Changes the current audio system.
 void setDenoise(boolean enabled)
          Change the state of noise suppression configuration
 void setEchoCancel(boolean enabled)
          Change the state of echo cancel configuration
 void setVideoCaptureDevice(javax.media.CaptureDeviceInfo device)
          Sets the device which is to be used by this DeviceConfiguration for video capture.
 
Methods inherited from class net.java.sip.communicator.util.PropertyChangeNotifier
addPropertyChangeListener, firePropertyChange, getPropertyChangeSource, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUDIO_CAPTURE_DEVICE

public static final String AUDIO_CAPTURE_DEVICE
The name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for audio capture.

See Also:
Constant Field Values

AUDIO_PLAYBACK_DEVICE

public static final String AUDIO_PLAYBACK_DEVICE
The name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for audio playback.

See Also:
Constant Field Values

AUDIO_NOTIFY_DEVICE

public static final String AUDIO_NOTIFY_DEVICE
The name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for audio notify.

See Also:
Constant Field Values

VIDEO_CAPTURE_DEVICE

public static final String VIDEO_CAPTURE_DEVICE
The name of the DeviceConfiguration property which represents the device used by DeviceConfiguration for video capture.

See Also:
Constant Field Values

AUDIO_SYSTEM_NONE

public static final String AUDIO_SYSTEM_NONE
When audio is disabled the selected audio system is with name None.

See Also:
Constant Field Values

AUDIO_SYSTEM_JAVASOUND

public static final String AUDIO_SYSTEM_JAVASOUND
JavaSound sound system.

See Also:
Constant Field Values

AUDIO_SYSTEM_PORTAUDIO

public static final String AUDIO_SYSTEM_PORTAUDIO
PortAudio sound system.

See Also:
Constant Field Values
Constructor Detail

DeviceConfiguration

public DeviceConfiguration()
Default constructor.

Method Detail

initialize

public void initialize()
Initializes capture devices.


getAudioCaptureDevice

public javax.media.CaptureDeviceInfo getAudioCaptureDevice()
Returns a device that we could use for audio capture.

Returns:
the CaptureDeviceInfo of a device that we could use for audio capture.

getAvailableAudioCaptureDevices

public javax.media.CaptureDeviceInfo[] getAvailableAudioCaptureDevices()
Gets the list of audio capture devices which are available through this DeviceConfiguration, amongst which is getAudioCaptureDevice() and represent acceptable values for setAudioCaptureDevice(CaptureDeviceInfo)

Returns:
an array of CaptureDeviceInfo describing the audio capture devices available through this DeviceConfiguration

getAvailableAudioCaptureDevices

public javax.media.CaptureDeviceInfo[] getAvailableAudioCaptureDevices(String soundSystem)
Gets the list of audio capture devices which are available through this DeviceConfiguration, amongst which is getAudioCaptureDevice() and represent acceptable values for setAudioCaptureDevice(CaptureDeviceInfo)

Parameters:
soundSystem - filter capture devices only from the supplied audio system.
Returns:
an array of CaptureDeviceInfo describing the audio capture devices available through this DeviceConfiguration

getAvailableAudioPlaybackDevices

public javax.media.CaptureDeviceInfo[] getAvailableAudioPlaybackDevices()
Lists all the playback devices. These are only portaudio devices as we can only set particular device for playback when using portaudio.

Returns:
the devices that can be used for playback.

getAvailableVideoCaptureDevices

public javax.media.CaptureDeviceInfo[] getAvailableVideoCaptureDevices()
Gets the list of video capture devices which are available through this DeviceConfiguration, amongst which is getVideoCaptureDevice() and represent acceptable values for setVideoCaptureDevice(CaptureDeviceInfo)

Returns:
an array of CaptureDeviceInfo describing the video capture devices available through this DeviceConfiguration

getVideoCaptureDevice

public javax.media.CaptureDeviceInfo getVideoCaptureDevice()
Returns a device that we could use for video capture.

Returns:
the CaptureDeviceInfo of a device that we could use for video capture.

setVideoCaptureDevice

public void setVideoCaptureDevice(javax.media.CaptureDeviceInfo device)
Sets the device which is to be used by this DeviceConfiguration for video capture.

Parameters:
device - a CaptureDeviceInfo describing device to be used by this DeviceConfiguration for video capture

setAudioCaptureDevice

public void setAudioCaptureDevice(javax.media.CaptureDeviceInfo device)
Sets the device which is to be used by this DeviceConfiguration for audio capture.

Parameters:
device - a CaptureDeviceInfo describing the device to be used by this DeviceConfiguration for audio capture

isAudioCaptureSupported

public boolean isAudioCaptureSupported()
Enable or disable Audio stream transmission.

Returns:
true if audio capture is supported and false otherwise.

isVideoCaptureSupported

public boolean isVideoCaptureSupported()
Enable or disable Video stream transmission.

Returns:
true if audio capture is supported and false otherwise.

getAvailableAudioSystems

public String[] getAvailableAudioSystems()
Return the installed Audio Systems.

Returns:
the audio systems names.

addAudioSystem

public static void addAudioSystem(String audioSystemName)
Adds audio system.

Parameters:
audioSystemName - the name of the audio system.

getAudioSystem

public String getAudioSystem()
The current selected audio system.

Returns:
the name of the current audio system.

setAudioSystem

public void setAudioSystem(String name,
                           javax.media.CaptureDeviceInfo captureDevice)
Changes the current audio system. When javasound is selected we also change the capture device.

Parameters:
name - the name of the audio system.
captureDevice - the selected capture device, if is null we will choose a default one. Param used when first time initing and extracting config.

initPortAudioRenderer

protected static void initPortAudioRenderer()
Installs the PortAudio Renderer


getAudioPlaybackDevice

public javax.media.CaptureDeviceInfo getAudioPlaybackDevice()
Returns:
the audioPlaybackDevice

getAudioNotifyDevice

public javax.media.CaptureDeviceInfo getAudioNotifyDevice()
Returns:
the audioNotifyDevice

setAudioPlaybackDevice

public void setAudioPlaybackDevice(javax.media.CaptureDeviceInfo audioPlaybackDevice)
Parameters:
audioPlaybackDevice - the audioPlaybackDevice to set

setAudioNotifyDevice

public void setAudioNotifyDevice(javax.media.CaptureDeviceInfo audioNotifyDevice)
Parameters:
audioNotifyDevice - the audioNotifyDevice to set

setEchoCancel

public void setEchoCancel(boolean enabled)
Change the state of echo cancel configuration

Parameters:
enabled - true if enabled

setDenoise

public void setDenoise(boolean enabled)
Change the state of noise suppression configuration

Parameters:
enabled - true if enabled

isEchoCancelEnabled

public boolean isEchoCancelEnabled()
Returns the state of echo cancel configuration.

Returns:
state of echo cancel.

isDenoiseEnabled

public boolean isDenoiseEnabled()
Returns the state of noise suppression configuration.

Returns:
state of noise suppression.

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

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