Class 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
    • 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:
        updateHardwareVolume in class BasicVolumeControl
      • 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.