Class AudioConfig

  • All Implemented Interfaces:
    AutoCloseable

    public final class AudioConfig
    extends Object
    implements AutoCloseable
    Represents audio input or output configuration. Audio input can be from a microphone, file, or input stream. Audio output can be to a speaker, audio file output in WAV format, or output stream. Note: close() must be called in order to release underlying resources held by the object. Updated in version 1.7.0
    • Method Detail

      • fromDefaultMicrophoneInput

        public static AudioConfig fromDefaultMicrophoneInput()
        Creates an AudioConfig object representing the default microphone on the system.
        Returns:
        The audio input configuration being created.
      • fromDefaultMicrophoneInput

        public static AudioConfig fromDefaultMicrophoneInput​(AudioProcessingOptions audioProcessingOptions)
        Creates an AudioConfig object representing the default microphone on the system.
        Parameters:
        audioProcessingOptions - Specifies the audio processing options.
        Returns:
        The audio input configuration being created.
      • fromMicrophoneInput

        public static AudioConfig fromMicrophoneInput​(String deviceName)
        Creates an AudioConfig object representing a specific microphone on the system.
        Parameters:
        deviceName - Specifies the platform-specific id of the audio input device. Please refer to the the online documentation about how to retrieve that id on different platforms. This functionality was added in version 1.3.0.
        Returns:
        The audio input configuration being created.
      • fromMicrophoneInput

        public static AudioConfig fromMicrophoneInput​(String deviceName,
                                                      AudioProcessingOptions audioProcessingOptions)
        Creates an AudioConfig object representing a specific microphone on the system.
        Parameters:
        deviceName - Specifies the platform-specific id of the audio input device. Please refer to the the online documentation about how to retrieve that id on different platforms.
        audioProcessingOptions - Specifies the audio processing options.
        Returns:
        The audio input configuration being created.
      • fromWavFileInput

        public static AudioConfig fromWavFileInput​(String fileName)
        Creates an AudioConfig object representing the specified file.
        Parameters:
        fileName - Specifies the audio input file.
        Returns:
        The audio input configuration being created.
      • fromWavFileInput

        public static AudioConfig fromWavFileInput​(String fileName,
                                                   AudioProcessingOptions audioProcessingOptions)
        Creates an AudioConfig object representing the specified file.
        Parameters:
        fileName - Specifies the audio input file.
        audioProcessingOptions - Specifies the audio processing options.
        Returns:
        The audio input configuration being created.
      • fromStreamInput

        public static AudioConfig fromStreamInput​(AudioInputStream audioStream)
        Creates an AudioConfig object representing the specified stream.
        Parameters:
        audioStream - Specifies the custom audio input stream.
        Returns:
        The audio input configuration being created.
      • fromStreamInput

        public static AudioConfig fromStreamInput​(AudioInputStream audioStream,
                                                  AudioProcessingOptions audioProcessingOptions)
        Creates an AudioConfig object representing the specified stream.
        Parameters:
        audioStream - Specifies the custom audio input stream.
        audioProcessingOptions - Specifies the audio processing options.
        Returns:
        The audio input configuration being created.
      • fromStreamInput

        public static AudioConfig fromStreamInput​(PullAudioInputStreamCallback callback)
        Creates an AudioConfig object representing the specified stream.
        Parameters:
        callback - Specifies the pull audio input stream callback.
        Returns:
        The audio input configuration being created.
      • fromStreamInput

        public static AudioConfig fromStreamInput​(PullAudioInputStreamCallback callback,
                                                  AudioProcessingOptions audioProcessingOptions)
        Creates an AudioConfig object representing the specified stream.
        Parameters:
        callback - Specifies the pull audio input stream callback.
        audioProcessingOptions - Specifies the audio processing options.
        Returns:
        The audio input configuration being created.
      • fromDefaultSpeakerOutput

        public static AudioConfig fromDefaultSpeakerOutput()
        Creates an AudioConfig object representing the default speaker on the system. Added in version 1.7.0
        Returns:
        The audio output configuration being created.
      • fromSpeakerOutput

        public static AudioConfig fromSpeakerOutput​(String deviceName)
        Creates an AudioConfig object representing a specific speaker on the system.
        Parameters:
        deviceName - Specifies the platform-specific id of the audio output device. Added in version 1.17.0
        Returns:
        The audio output configuration being created.
      • fromWavFileOutput

        public static AudioConfig fromWavFileOutput​(String fileName)
        Creates an AudioConfig object representing the specified file. Added in version 1.7.0
        Parameters:
        fileName - Specifies the audio output file. The parent directory must already exist.
        Returns:
        The audio output configuration being created.
      • fromStreamOutput

        public static AudioConfig fromStreamOutput​(AudioOutputStream audioStream)
        Creates an AudioConfig object representing the specified stream. Added in version 1.7.0
        Parameters:
        audioStream - Specifies the custom audio output stream.
        Returns:
        The audio output configuration being created.
      • getAudioProcessingOptions

        public AudioProcessingOptions getAudioProcessingOptions()
        Returns an AudioProcessingOptions object which contains the parameters used for audio processing.
        Returns:
        The audio processing options.
      • close

        public void close()
        Explicitly frees any external resource attached to the object
        Specified by:
        close in interface AutoCloseable
      • setProperty

        public void setProperty​(String name,
                                String value)
        Sets a named property as value.
        Parameters:
        name - the name of the property.
        value - the value.
      • setProperty

        public void setProperty​(PropertyId id,
                                String value)
        Sets the property by propertyId.
        Parameters:
        id - PropertyId of the property.
        value - The value.
      • getImpl

        public SafeHandle getImpl()
        Returns the audio input configuration.
        Returns:
        The implementation of the config.