Class AudioParams

java.lang.Object
io.agora.rtc2.audio.AudioParams

public class AudioParams extends Object
The `AudioParams` class. You can pass the `AudioParams` object in the return value of the following callbacks to set the audio data format for the corresponding callbacks: - getRecordAudioParams: Sets the audio recording format for the onRecordFrame callback. - getPlaybackAudioParams: Sets the audio playback format for the onPlaybackFrame callback. - getMixedAudioParams: Sets the audio mixing format for the onMixedFrame callback.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
    The number of audio channels, which can be set as either of the following values: - `1`: Mono (Default) - `2`: Stereo
    int
    The use mode of the audio data: - RAW_AUDIO_FRAME_OP_MODE_READ_ONLY(0): (Default) Read-only mode, in which users can only read the AudioFrame without modifying anything.
    int
    The audio sample rate (Hz), which can be set as one of the following values: - `8000` - `16000` (Default) - `32000` - `44100` - `48000`
    int
    The number of samples.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AudioParams(int sampleRate, int channelCnt, int mode, int samplesPerCall)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    int
     
    int
     
    int
     
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • sampleRate

      public int sampleRate
      The audio sample rate (Hz), which can be set as one of the following values: - `8000` - `16000` (Default) - `32000` - `44100` - `48000`
    • channel

      public int channel
      The number of audio channels, which can be set as either of the following values: - `1`: Mono (Default) - `2`: Stereo
    • mode

      public int mode
      The use mode of the audio data: - RAW_AUDIO_FRAME_OP_MODE_READ_ONLY(0): (Default) Read-only mode, in which users can only read the AudioFrame without modifying anything. For example, this mode applies when users acquire data with the Agora SDK and then push the RTMP or RTMPS streams. - RAW_AUDIO_FRAME_OP_MODE_READ_WRITE(2): Read and write mode, in which users read the AudioFrame, modify it, and then play it. For example, this mode applies when users have their own sound-effect processing module to pre-process the audio (such as a voice changer).
    • samplesPerCall

      public int samplesPerCall
      The number of samples. For example, set it as 1024 for RTMP or RTMPS streaming.
  • Constructor Details

    • AudioParams

      public AudioParams(int sampleRate, int channelCnt, int mode, int samplesPerCall)
  • Method Details

    • getSampleRate

      public int getSampleRate()
    • getChannel

      public int getChannel()
    • getMode

      public int getMode()
    • getSamplesPerCall

      public int getSamplesPerCall()
    • toString

      public String toString()
      Overrides:
      toString in class Object