Agora Java API Reference for Android

Public Member Functions | Public Attributes | List of all members
agora::media::IAudioFrameObserverBase::AudioParams Struct Reference

Audio data format. More...

`#include <AgoraMediaBase.h>`

## Public Member Functions
| AudioParams (int samplerate, int channel, rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE type, int samplesPerCall)

## Public Attributes
int | sample_rate
int | channels
rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE | mode
int | samples_per_call

## Detailed Description

Audio data format.

You can pass the `AudioParams` object in the following APIs to set the audio data format for the corresponding callback:

- `getRecordAudioParams`: Sets the audio data format for the `onRecordAudioFrame` callback.
- `getPlaybackAudioParams`: Sets the audio data format for the `onPlaybackAudioFrame` callback.
- `getMixedAudioParams`: Sets the audio data format for the `onMixedAudioFrame` callback.
- `getEarMonitoringAudioParams`: Sets the audio data format for the `onEarMonitoringAudioFrame` callback.

Note
  - The SDK calculates the sampling interval through the `samplesPerCall`, `sampleRate`, and `channel` parameters in `AudioParams`, and triggers the `onRecordAudioFrame`, `onPlaybackAudioFrame`, `onMixedAudioFrame`, and `onEarMonitoringAudioFrame` callbacks according to the sampling interval.
  - Sample interval (sec) = `samplePerCall` /( `sampleRate` × `channel` ).
  - Ensure that the sample interval ≥ 0.01 (s).

## Member Data Documentation

## ◆ sample_rate

int agora::media::IAudioFrameObserverBase::AudioParams::sample_rate

The audio sample rate (Hz), which can be set as one of the following values:

- 8000.
- (Default) 16000.
- 32000.
- 44100
- 48000

## ◆ channels

int agora::media::IAudioFrameObserverBase::AudioParams::channels

The number of audio channels, which can be set as either of the following values:

- 1: (Default) Mono.
- 2: Stereo.

## ◆ mode

rtc::RAW_AUDIO_FRAME_OP_MODE_TYPE agora::media::IAudioFrameObserverBase::AudioParams::mode

The use mode of the audio data. See `RAW_AUDIO_FRAME_OP_MODE_TYPE`.

## ◆ samples_per_call

int agora::media::IAudioFrameObserverBase::AudioParams::samples_per_call

The number of samples, such as 1024 for the media push.