Package org.jitsi.impl.neomedia
Class HardwareVolumeControl
- java.lang.Object
-
- org.jitsi.service.neomedia.BasicVolumeControl
-
- org.jitsi.impl.neomedia.HardwareVolumeControl
-
- All Implemented Interfaces:
javax.media.Control,javax.media.GainControl,VolumeControl
public class HardwareVolumeControl extends BasicVolumeControl
Implementation of VolumeControl which uses system sound architecture (MacOsX or Windows CoreAudio) to change input/output hardware volume.- Author:
- Vincent Lucas
-
-
Field Summary
-
Fields inherited from class org.jitsi.service.neomedia.BasicVolumeControl
MAX_VOLUME_LEVEL, MAX_VOLUME_PERCENT, MIN_VOLUME_LEVEL, MIN_VOLUME_PERCENT, volumeLevel
-
Fields inherited from interface org.jitsi.service.neomedia.VolumeControl
CAPTURE_VOLUME_LEVEL_PROPERTY_NAME, PLAYBACK_VOLUME_LEVEL_PROPERTY_NAME
-
-
Constructor Summary
Constructors Constructor Description HardwareVolumeControl(MediaServiceImpl mediaServiceImpl, String volumeLevelConfigurationPropertyName)Creates volume control instance and initializes initial level value if stored in the configuration service.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgetCaptureDeviceUID()Returns the selected input device UID.protected static floatgetDefaultVolumeLevel()Returns the default volume level.protected static floatgetGainReferenceLevel()Returns the reference volume level for computing the gain.protected floatgetInputDeviceVolume(String deviceUID)Returns the device volume via the system API.floatgetVolume()Current volume value.protected intsetInputDeviceVolume(String deviceUID, float volume)Changes the device volume via the system API.protected voidupdateHardwareVolume()Modifies the hardware microphone sensibility (hardware amplification).-
Methods inherited from class org.jitsi.service.neomedia.BasicVolumeControl
addGainChangeListener, addVolumeChangeListener, applyGain, getControlComponent, getDB, getLevel, getMaxValue, getMinValue, getMute, loadVolume, removeGainChangeListener, removeVolumeChangeListener, setDB, setLevel, setMute, setVolume
-
-
-
-
Constructor Detail
-
HardwareVolumeControl
public HardwareVolumeControl(MediaServiceImpl mediaServiceImpl, String volumeLevelConfigurationPropertyName)
Creates volume control instance and initializes initial level value if stored in the configuration service.- Parameters:
mediaServiceImpl- The media service implementation.volumeLevelConfigurationPropertyName- the name of the configuration property which specifies the value of the volume level of the new instance
-
-
Method Detail
-
getDefaultVolumeLevel
protected static float getDefaultVolumeLevel()
Returns the default volume level.- Returns:
- The default volume level.
-
getGainReferenceLevel
protected static float getGainReferenceLevel()
Returns the reference volume level for computing the gain.- Returns:
- The reference volume level for computing the gain.
-
updateHardwareVolume
protected void updateHardwareVolume()
Modifies the hardware microphone sensibility (hardware amplification).- Overrides:
updateHardwareVolumein classBasicVolumeControl
-
getCaptureDeviceUID
protected String getCaptureDeviceUID()
Returns the selected input device UID.- Returns:
- The selected input device UID. Or null if not found.
-
setInputDeviceVolume
protected int setInputDeviceVolume(String deviceUID, float volume)
Changes the device volume via the system API.- Parameters:
deviceUID- The device ID.volume- The volume requested.- Returns:
- 0 if everything works fine.
-
getInputDeviceVolume
protected float getInputDeviceVolume(String deviceUID)
Returns the device volume via the system API.- Parameters:
deviceUID- The device ID.- Returns:
- A scalar value between 0 and 1 if everything works fine. -1 if an error occurred.
-
getVolume
public float getVolume()
Current volume value.- Specified by:
getVolumein interfaceVolumeControl- Overrides:
getVolumein classBasicVolumeControl- Returns:
- the current volume level.
- See Also:
VolumeControl
-
-