io.agora.rtc

## Class PcmConsumeStateUtils

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

-     class PcmConsumeStateUtils
      extends java.lang.Object

  Utility class for tracking PCM consumption state.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private int` | `audioScenario` Audio scenario
    `private int` | `duration` Duration in milliseconds
    `private static int` | `E2E_DELAY_MS` End-to-end delay in milliseconds
    `private long` | `startTime` Start time in milliseconds
    `private long` | `totalLength` Total length of PCM data

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PcmConsumeStateUtils()` Default constructor for PcmConsumeStateUtils.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPcmData(int dataLen, int samplerate, int channels)` Adds PCM data and updates duration.
    `int` | `getAudioScenario()` Gets the audio scenario.
    `int` | `getDuration()` Gets the duration in milliseconds.
    `long` | `getStartTime()` Gets the start time in milliseconds.
    `long` | `getTotalLength()` Gets the total length of PCM data.
    `boolean` | `isNewRound()` Checks if it's a new round.
    `boolean` | `isPushCompleted()` Checks if push is completed.
    `void` | `reset()` Resets the state.
    `void` | `setAudioScenario(int audioScenario)` Sets the audio scenario.
    `void` | `setDuration(int duration)` Sets the duration in milliseconds.
    `void` | `setStartTime(long startTime)` Sets the start time in milliseconds.
    `void` | `setTotalLength(long totalLength)` Sets the total length of PCM data.

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

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

- - ### Field Detail

    - #### E2E_DELAY_MS

          private static final int E2E_DELAY_MS

      End-to-end delay in milliseconds
      See Also:
        Constant Field Values

    - #### startTime

          private long startTime

      Start time in milliseconds

    - #### totalLength

          private long totalLength

      Total length of PCM data

    - #### duration

          private int duration

      Duration in milliseconds

    - #### audioScenario

          private int audioScenario

      Audio scenario

  - ### Constructor Detail

    - #### PcmConsumeStateUtils

          public PcmConsumeStateUtils()

      Default constructor for PcmConsumeStateUtils.

  - ### Method Detail

    - #### getStartTime

          public long getStartTime()

      Gets the start time in milliseconds.
      Returns:
        Start time in milliseconds

    - #### setStartTime

          public void setStartTime(long startTime)

      Sets the start time in milliseconds.
      Parameters:
        `startTime` - Start time in milliseconds

    - #### getTotalLength

          public long getTotalLength()

      Gets the total length of PCM data.
      Returns:
        Total length of PCM data

    - #### setTotalLength

          public void setTotalLength(long totalLength)

      Sets the total length of PCM data.
      Parameters:
        `totalLength` - Total length of PCM data

    - #### getDuration

          public int getDuration()

      Gets the duration in milliseconds.
      Returns:
        Duration in milliseconds

    - #### setDuration

          public void setDuration(int duration)

      Sets the duration in milliseconds.
      Parameters:
        `duration` - Duration in milliseconds

    - #### getAudioScenario

          public int getAudioScenario()

      Gets the audio scenario.
      Returns:
        Audio scenario

    - #### setAudioScenario

          public void setAudioScenario(int audioScenario)

      Sets the audio scenario.
      Parameters:
        `audioScenario` - Audio scenario

    - #### reset

          public void reset()

      Resets the state.

    - #### addPcmData

          public void addPcmData(int dataLen,
                                 int samplerate,
                                 int channels)

      Adds PCM data and updates duration.
      Parameters:
        `dataLen` - Data length
        `samplerate` - Sample rate (Hz)
        `channels` - Number of channels

    - #### isNewRound

          public boolean isNewRound()

      Checks if it's a new round.
      Returns:
        true if it's a new round, false otherwise

    - #### isPushCompleted

          public boolean isPushCompleted()

      Checks if push is completed.
      Returns:
        true if push is completed, false otherwise