io.agora.rtc.audio3a

## Class AgoraAudioFrame

- java.lang.Object
- - io.agora.rtc.audio3a.AgoraAudioFrame

-     public class AgoraAudioFrame
      extends java.lang.Object

  Represents an audio frame with various properties such as type, sample rate, channels, etc.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private java.nio.ByteBuffer` | `buffer` The data buffer of the audio frame.
    `private int` | `bytesPerSample` The number of bytes per sample.
    `private int` | `channels` The number of audio channels (interleaved if stereo).
    `private int` | `sampleRate` The number of samples per channel in the audio frame, should be 8000, 16000, 24000, 32000, 44100 or 48000.
    `private int` | `samplesPerChannel` The number of samples per channel in this frame, should be (sampleRate / 100) corresponding to 10ms.
    `private int` | `type` The audio frame type.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AgoraAudioFrame()` Constructs an AgoraAudioFrame with default settings.
    `AgoraAudioFrame(int type, int sampleRate, int channels, int samplesPerChannel, int bytesPerSample, java.nio.ByteBuffer buffer)` Constructs an AgoraAudioFrame with the specified parameters.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.nio.ByteBuffer` | `getBuffer()` Gets the audio data buffer.
    `int` | `getBytesPerSample()` Gets the number of bytes per sample.
    `int` | `getChannels()` Gets the number of audio channels.
    `int` | `getSampleRate()` Gets the sample rate of the audio frame.
    `int` | `getSamplesPerChannel()` Gets the number of samples per channel.
    `int` | `getType()` Gets the audio frame type.
    `void` | `setBuffer(java.nio.ByteBuffer buffer)` Sets the audio data buffer.
    `void` | `setBytesPerSample(int bytesPerSample)` Sets the number of bytes per sample.
    `void` | `setChannels(int channels)` Sets the number of audio channels.
    `void` | `setSampleRate(int sampleRate)` Sets the sample rate of the audio frame.
    `void` | `setSamplesPerChannel(int samplesPerChannel)` Sets the number of samples per channel.
    `void` | `setType(int type)` Sets the audio frame type.
    `java.lang.String` | `toString()`

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

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

- - ### Field Detail

    - #### type

          private int type

      The audio frame type. See `Constants.AudioFrameType`. Default is PCM16.

    - #### sampleRate

          private int sampleRate

      The number of samples per channel in the audio frame, should be 8000, 16000, 24000, 32000, 44100 or 48000.

    - #### channels

          private int channels

      The number of audio channels (interleaved if stereo).
      - 1: Mono.
      - 2: Stereo.

    - #### samplesPerChannel

          private int samplesPerChannel

      The number of samples per channel in this frame, should be (sampleRate / 100) corresponding to 10ms.

    - #### bytesPerSample

          private int bytesPerSample

      The number of bytes per sample. See `Constants.BytesPerSample`, default is 2.

    - #### buffer

          private java.nio.ByteBuffer buffer

      The data buffer of the audio frame. When the audio frame uses a stereo channel, the data buffer is interleaved. Buffer size in bytes = channels * samplesPerChannel * bytesPerSample.

  - ### Constructor Detail

    - #### AgoraAudioFrame

          public AgoraAudioFrame()

      Constructs an AgoraAudioFrame with default settings.

    - #### AgoraAudioFrame

          public AgoraAudioFrame(int type,
                                 int sampleRate,
                                 int channels,
                                 int samplesPerChannel,
                                 int bytesPerSample,
                                 java.nio.ByteBuffer buffer)

      Constructs an AgoraAudioFrame with the specified parameters.
      Parameters:
        `type` - The audio frame type.
        `sampleRate` - The sample rate of the audio frame.
        `channels` - The number of audio channels.
        `samplesPerChannel` - The number of samples per channel in the audio frame.
        `bytesPerSample` - The number of bytes per sample in the audio frame.
        `buffer` - The data buffer of the audio frame.

  - ### Method Detail

    - #### getType

          public int getType()

      Gets the audio frame type.
      Returns:
        Audio frame type

    - #### setType

          public void setType(int type)

      Sets the audio frame type.
      Parameters:
        `type` - Audio frame type

    - #### getSampleRate

          public int getSampleRate()

      Gets the sample rate of the audio frame.
      Returns:
        Sample rate

    - #### setSampleRate

          public void setSampleRate(int sampleRate)

      Sets the sample rate of the audio frame.
      Parameters:
        `sampleRate` - Sample rate

    - #### getChannels

          public int getChannels()

      Gets the number of audio channels.
      Returns:
        Number of channels

    - #### setChannels

          public void setChannels(int channels)

      Sets the number of audio channels.
      Parameters:
        `channels` - Number of channels

    - #### getSamplesPerChannel

          public int getSamplesPerChannel()

      Gets the number of samples per channel.
      Returns:
        Samples per channel

    - #### setSamplesPerChannel

          public void setSamplesPerChannel(int samplesPerChannel)

      Sets the number of samples per channel.
      Parameters:
        `samplesPerChannel` - Samples per channel

    - #### getBytesPerSample

          public int getBytesPerSample()

      Gets the number of bytes per sample.
      Returns:
        Bytes per sample

    - #### setBytesPerSample

          public void setBytesPerSample(int bytesPerSample)

      Sets the number of bytes per sample.
      Parameters:
        `bytesPerSample` - Bytes per sample

    - #### getBuffer

          public java.nio.ByteBuffer getBuffer()

      Gets the audio data buffer.
      Returns:
        Audio data buffer

    - #### setBuffer

          public void setBuffer(java.nio.ByteBuffer buffer)

      Sets the audio data buffer.
      Parameters:
        `buffer` - Audio data buffer

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`