Class AudioSystem

    • Field Detail

      • FEATURE_AGC

        public static final int FEATURE_AGC
        The constant/flag (to be) returned by DeviceSystem.getFeatures() in order to indicate that the respective AudioSystem supports toggling its automatic gain control (AGC) functionality between on and off. The UI will look for the presence of the flag in order to determine whether a check box is to be shown to the user to enable toggling the automatic gain control (AGC) functionality.
        See Also:
        Constant Field Values
      • FEATURE_DENOISE

        public static final int FEATURE_DENOISE
        The constant/flag (to be) returned by DeviceSystem.getFeatures() in order to indicate that the respective AudioSystem supports toggling its denoise functionality between on and off. The UI will look for the presence of the flag in order to determine whether a check box is to be shown to the user to enable toggling the denoise functionality.
        See Also:
        Constant Field Values
      • FEATURE_ECHO_CANCELLATION

        public static final int FEATURE_ECHO_CANCELLATION
        The constant/flag (to be) returned by DeviceSystem.getFeatures() in order to indicate that the respective AudioSystem supports toggling its echo cancellation functionality between on and off. The UI will look for the presence of the flag in order to determine whether a check box is to be shown to the user to enable toggling the echo cancellation functionality.
        See Also:
        Constant Field Values
      • FEATURE_NOTIFY_AND_PLAYBACK_DEVICES

        public static final int FEATURE_NOTIFY_AND_PLAYBACK_DEVICES
        The constant/flag (to be) returned by DeviceSystem.getFeatures() in order to indicate that the respective AudioSystem differentiates between playback and notification audio devices. The UI, for example, will look for the presence of the flag in order to determine whether separate combo boxes are to be shown to the user to allow the configuration of the preferred playback and notification audio devices.
        See Also:
        Constant Field Values
      • LOCATOR_PROTOCOL_MACCOREAUDIO

        public static final String LOCATOR_PROTOCOL_MACCOREAUDIO
        The protocol of the MediaLocators identifying CaptureDeviceInfos contributed by MacCoreaudioSystem.
        See Also:
        Constant Field Values
      • LOCATOR_PROTOCOL_WASAPI

        public static final String LOCATOR_PROTOCOL_WASAPI
        The protocol of the MediaLocators identifying CaptureDeviceInfos contributed by WASAPISystem.
        See Also:
        Constant Field Values
      • PNAME_DENOISE

        protected static final String PNAME_DENOISE
        The (base) name of the ConfigurationService property which indicates whether noise suppression is to be performed for the captured audio.
        See Also:
        Constant Field Values
      • PNAME_ECHOCANCEL

        protected static final String PNAME_ECHOCANCEL
        The (base) name of the ConfigurationService property which indicates whether noise cancellation is to be performed for the captured audio.
        See Also:
        Constant Field Values
    • Method Detail

      • getAudioSystem

        public static AudioSystem getAudioSystem​(String locatorProtocol)
      • getAudioSystems

        public static AudioSystem[] getAudioSystems()
      • createRenderer

        public javax.media.Renderer createRenderer()
        Initializes a new Renderer instance which is to perform playback on a device contributed by this system. Delegates to createRenderer(boolean) with the value of the playback argument set to true.
        Overrides:
        createRenderer in class DeviceSystem
        Returns:
        a new Renderer instance which is to perform playback on a device contributed by this system or null
      • createRenderer

        public javax.media.Renderer createRenderer​(boolean playback)
        Initializes a new Renderer instance which is to either perform playback on or sound a notification through a device contributed by this system. The (default) implementation of AudioSystem ignores the value of the playback argument and delegates to DeviceSystem.createRenderer().
        Parameters:
        playback - true if the new instance is to perform playback or false if the new instance is to sound a notification
        Returns:
        a new Renderer instance which is to either perform playback on or sound a notification through a device contributed by this system
      • getAudioInputStream

        public InputStream getAudioInputStream​(String uri)
                                        throws IOException
        Obtains an audio input stream from the URL provided.
        Parameters:
        uri - a valid uri to a sound resource.
        Returns:
        the input stream to audio data.
        Throws:
        IOException - if an I/O exception occurs
      • getDevice

        public CaptureDeviceInfo2 getDevice​(AudioSystem.DataFlow dataFlow,
                                            javax.media.MediaLocator locator)
        Gets a CaptureDeviceInfo2 which has been contributed by this AudioSystem, supports a specific flow of media data (i.e. capture, notify or playback) and is identified by a specific MediaLocator.
        Parameters:
        dataFlow - the flow of the media data supported by the CaptureDeviceInfo2 to be returned
        locator - the MediaLocator of the CaptureDeviceInfo2 to be returned
        Returns:
        a CaptureDeviceInfo2 which has been contributed by this instance, supports the specified dataFlow and is identified by the specified locator
      • getDevices

        public List<CaptureDeviceInfo2> getDevices​(AudioSystem.DataFlow dataFlow)
        Gets the list of devices with a specific data flow: capture, notify or playback.
        Parameters:
        dataFlow - the data flow of the devices to retrieve: capture, notify or playback
        Returns:
        the list of devices with the specified dataFlow
      • getFormat

        public javax.media.format.AudioFormat getFormat​(InputStream audioInputStream)
        Returns the FMJ format of a specific InputStream providing audio media.
        Parameters:
        audioInputStream - the InputStream providing audio media to determine the FMJ format of
        Returns:
        the FMJ format of the specified audioInputStream or null if such an FMJ format could not be determined
      • getPropertyName

        protected String getPropertyName​(String basePropertyName)
        Gets the (full) name of the ConfigurationService property which is associated with a (base) AudioSystem-specific property name.
        Parameters:
        basePropertyName - the (base) AudioSystem-specific property name of which the associated (full) ConfigurationService property name is to be returned
        Returns:
        the (full) name of the ConfigurationService property which is associated with the (base) AudioSystem-specific property name
      • getSelectedDevice

        public CaptureDeviceInfo2 getSelectedDevice​(AudioSystem.DataFlow dataFlow)
        Gets the selected device for a specific data flow: capture, notify or playback.
        Parameters:
        dataFlow - the data flow of the selected device to retrieve: capture, notify or playback.
        Returns:
        the selected device for the specified dataFlow
      • isAutomaticGainControl

        public boolean isAutomaticGainControl()
        Gets the indicator which determines whether automatic gain control (AGC) is to be performed for captured audio.
        Returns:
        true if automatic gain control (AGC) is to be performed for captured audio; otherwise, false
      • isDenoise

        public boolean isDenoise()
        Gets the indicator which determines whether noise suppression is to be performed for captured audio.
        Returns:
        true if noise suppression is to be performed for captured audio; otherwise, false
      • isEchoCancel

        public boolean isEchoCancel()
        Gets the indicator which determines whether echo cancellation is to be performed for captured audio.
        Returns:
        true if echo cancellation is to be performed for captured audio; otherwise, false
      • postInitialize

        protected void postInitialize()
                               throws Exception
        Invoked as part of the execution of DeviceSystem.initialize() after the execution of DeviceSystem.doInitialize() regardless of whether the latter completed successfully. The implementation of DeviceSystem fires a new PropertyChangeEvent to notify that the value of the property DeviceSystem.PROP_DEVICES of this instance may have changed i.e. that the list of devices detected by this instance may have changed. Because AudioSystem may support playback and notification audio devices apart from capture audio devices, fires more specific PropertyChangeEvents than DeviceSystem
        Overrides:
        postInitialize in class DeviceSystem
        Throws:
        Exception
      • postInitializeSpecificDevices

        protected void postInitializeSpecificDevices​(AudioSystem.DataFlow dataFlow)
        Sets the device lists after the different audio systems (PortAudio, PulseAudio, etc) have finished detecting their devices.
        Parameters:
        dataFlow - the data flow of the devices to perform post-initialization on
      • setAutomaticGainControl

        public void setAutomaticGainControl​(boolean automaticGainControl)
        Sets the indicator which determines whether automatic gain control (AGC) is to be performed for captured audio.
        Parameters:
        automaticGainControl - true if automatic gain control (AGC) is to be performed for captured audio; otherwise, false
      • setCaptureDevices

        protected void setCaptureDevices​(List<CaptureDeviceInfo2> captureDevices)
        Sets the list of a kind of devices: capture, notify or playback.
        Parameters:
        captureDevices - The list of a kind of devices: capture, notify or playback.
      • setDenoise

        public void setDenoise​(boolean denoise)
        Sets the indicator which determines whether noise suppression is to be performed for captured audio.
        Parameters:
        denoise - true if noise suppression is to be performed for captured audio; otherwise, false
      • setDevice

        public void setDevice​(AudioSystem.DataFlow dataFlow,
                              CaptureDeviceInfo2 device,
                              boolean save)
        Selects the active device.
        Parameters:
        dataFlow - the data flow of the device to set: capture, notify or playback
        device - The selected active device.
        save - Flag set to true in order to save this choice in the configuration. False otherwise.
      • setEchoCancel

        public void setEchoCancel​(boolean echoCancel)
        Sets the indicator which determines whether echo cancellation is to be performed for captured audio.
        Parameters:
        echoCancel - true if echo cancellation is to be performed for captured audio; otherwise, false
      • setPlaybackDevices

        protected void setPlaybackDevices​(List<CaptureDeviceInfo2> playbackDevices)
        Sets the list of the active devices.
        Parameters:
        playbackDevices - The list of the active devices.