io.agora.rtc.internal

## Class AgoraAudioVadManager

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

-     public class AgoraAudioVadManager
      extends java.lang.Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private boolean` | `isInitialized` Flag indicating whether the manager has been initialized
    `private AgoraAudioVadConfigV2` | `vadConfig` VAD configuration
    `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)` 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 a new VAD instance
    `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
    `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

    - #### vadConfig

          private volatile AgoraAudioVadConfigV2 vadConfig

      VAD configuration

    - #### isInitialized

          private volatile boolean isInitialized

      Flag indicating whether the manager has been initialized

  - ### Constructor Detail

    - #### AgoraAudioVadManager

          public AgoraAudioVadManager(AgoraAudioVadConfigV2 configure)

      Constructor for AudioVadManager
      Parameters:
        `configure` - VAD configuration parameters, must not be null
      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

    - #### addVadInstance

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

      Adds a new VAD instance
      Parameters:
        `channelId` - Channel ID
        `userId` - User ID
      Returns:
        Newly created VAD instance, or existing instance if already exists, returns null if manager is destroyed or in an inconsistent state

    - #### 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