io.agora.rtc

## Class AgoraAudioVadManager

- java.lang.Object
- - io.agora.rtc.AgoraAudioVadManager

-     class AgoraAudioVadManager
      extends java.lang.Object

  Manages the lifecycle of VAD instances and optional dump utilities.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private java.lang.String` | `apmDumpPath` Base path for VAD dump files.
    `private boolean` | `enableApmDump` Indicates whether APM dump output is enabled.
    `private boolean` | `isInitialized` Flag indicating whether the manager has been initialized
    `private AgoraAudioVadConfigV2` | `vadConfig` VAD configuration
    `private java.util.Map<java.lang.String,VadDumpUtils>` | `vadDumpUtilsMap` Map storing dump utilities for each VAD instance when dumping is enabled.
    `private java.util.Map<java.lang.String,AgoraAudioVadV2>` | `vadInstanceMap` Map to store VAD instances for different channels and users

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AgoraAudioVadManager(AgoraAudioVadConfigV2 configure, boolean enableApmDump, java.lang.String apmDumpPath)` Constructor for AudioVadManager

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private AgoraAudioVadV2` | `addVadInstance(java.lang.String channelId, java.lang.String userId)` Adds (or retrieves) a VAD instance for the specified channel and user.
    `void` | `delVadInstance(java.lang.String channelId, java.lang.String userId)` Removes and destroys the specified VAD instance
    `void` | `destroy()` Destroys the manager Cleans up all VAD instances and releases resources Thread-safe method
    `private VadDumpUtils` | `getVadDumpUtils(java.lang.String channelId, java.lang.String userId)` Retrieves the dump utility associated with a VAD instance.
    `AgoraAudioVadV2` | `getVadInstance(java.lang.String channelId, java.lang.String userId)` Retrieves the VAD instance for specified channel and user
    `private java.lang.String` | `makeKey(java.lang.String channelId, java.lang.String userId)` Generates a unique key for VAD instance identification
    `VadProcessResult` | `process(java.lang.String channelId, java.lang.String userId, AudioFrame frame)` Processes an audio frame through VAD

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### vadInstanceMap

          private volatile java.util.Map<java.lang.String,AgoraAudioVadV2> vadInstanceMap

      Map to store VAD instances for different channels and users

    - #### vadDumpUtilsMap

          private volatile java.util.Map<java.lang.String,VadDumpUtils> vadDumpUtilsMap

      Map storing dump utilities for each VAD instance when dumping is enabled.

    - #### vadConfig

          private volatile AgoraAudioVadConfigV2 vadConfig

      VAD configuration

    - #### isInitialized

          private volatile boolean isInitialized

      Flag indicating whether the manager has been initialized

    - #### enableApmDump

          private volatile boolean enableApmDump

      Indicates whether APM dump output is enabled.

    - #### apmDumpPath

          private volatile java.lang.String apmDumpPath

      Base path for VAD dump files.

  - ### Constructor Detail

    - #### AgoraAudioVadManager

          public AgoraAudioVadManager(AgoraAudioVadConfigV2 configure,
                                      boolean enableApmDump,
                                      java.lang.String apmDumpPath)

      Constructor for AudioVadManager
      Parameters:
        `configure` - VAD configuration parameters, must not be null
        `enableApmDump` - whether to enable APM dump for debugging
        `apmDumpPath` - the path to save APM dump files
      Throws:
        `java.lang.IllegalArgumentException` - when configure is null

  - ### Method Detail

    - #### makeKey

          private java.lang.String makeKey(java.lang.String channelId,
                                           java.lang.String userId)

      Generates a unique key for VAD instance identification
      Parameters:
        `channelId` - Channel ID
        `userId` - User ID
      Returns:
        A unique string identifier composed of channelId and userId

    - #### getVadInstance

          public AgoraAudioVadV2 getVadInstance(java.lang.String channelId,
                                                java.lang.String userId)

      Retrieves the VAD instance for specified channel and user
      Parameters:
        `channelId` - Channel ID
        `userId` - User ID
      Returns:
        The corresponding VAD instance, or null if manager is destroyed or parameters are invalid

    - #### getVadDumpUtils

          private VadDumpUtils getVadDumpUtils(java.lang.String channelId,
                                               java.lang.String userId)

      Retrieves the dump utility associated with a VAD instance.
      Parameters:
        `channelId` - Channel identifier
        `userId` - User identifier
      Returns:
        Dump utility or `null` if dumping is disabled or parameters are invalid

    - #### addVadInstance

          private AgoraAudioVadV2 addVadInstance(java.lang.String channelId,
                                                 java.lang.String userId)

      Adds (or retrieves) a VAD instance for the specified channel and user.
      Parameters:
        `channelId` - Channel identifier
        `userId` - User identifier
      Returns:
        Existing or newly created VAD instance, or `null` if initialization failed

    - #### delVadInstance

          public void delVadInstance(java.lang.String channelId,
                                     java.lang.String userId)

      Removes and destroys the specified VAD instance
      Parameters:
        `channelId` - Channel ID
        `userId` - User ID

    - #### process

          public VadProcessResult process(java.lang.String channelId,
                                          java.lang.String userId,
                                          AudioFrame frame)

      Processes an audio frame through VAD
      Parameters:
        `channelId` - Channel ID
        `userId` - User ID
        `frame` - Audio frame to be processed
      Returns:
        VAD processing result containing processed frame and VAD state

    - #### destroy

          public void destroy()

      Destroys the manager Cleans up all VAD instances and releases resources Thread-safe method