Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
agora::base::AudioSessionConfiguration Struct Reference

`#include <IAgoraService.h>`

## Public Member Functions
void | SetAll (const AudioSessionConfiguration &change)
bool | operator== (const AudioSessionConfiguration &o) const
bool | operator!= (const AudioSessionConfiguration &o) const

## Public Attributes
Optional< bool > | playbackAndRecord
Optional< bool > | chatMode
Optional< bool > | defaultToSpeaker
Optional< bool > | overrideSpeaker
Optional< bool > | allowMixWithOthers
Optional< bool > | allowDuckOthers
Optional< bool > | allowBluetooth
Optional< bool > | allowBluetoothA2DP
Optional< double > | sampleRate
Optional< double > | ioBufferDuration
Optional< int > | inputNumberOfChannels
Optional< int > | outputNumberOfChannels
Optional< int > | category

## Detailed Description

The audio session configurations.

Set these configurations when calling setAudioSessionConfiguration.

## Member Function Documentation

## ◆ SetAll()

void agora::base::AudioSessionConfiguration::SetAll | ( | const AudioSessionConfiguration & | change | ) |
| inline

## ◆ operator==()

bool agora::base::AudioSessionConfiguration::operator== | ( | const AudioSessionConfiguration & | o | ) | const
| inline

## ◆ operator!=()

bool agora::base::AudioSessionConfiguration::operator!= | ( | const AudioSessionConfiguration & | o | ) | const
| inline

## Member Data Documentation

## ◆ playbackAndRecord

Optional<bool> agora::base::AudioSessionConfiguration::playbackAndRecord

Whether to enable audio input (recording) and audio output (playback):

- `true`: Enable audio recording and playback.
- `false`: Disable audio recording and playback, which prevents audio input and output.

Note
  - For the recording function to work, the user must grant permission for audio recording.
  - By default, the audio of your app is nonmixable, which means activating audio sessions in your app interrupts other nonmixable audio sessions. Set `allowMixWithOthers` as `true` to allow audio mixing.

## ◆ chatMode

Optional<bool> agora::base::AudioSessionConfiguration::chatMode

Whether to enable chat mode:

- `true`: Enable chat mode. This mode is for apps that are engaged in two-way real-time communication, such as a voice or video chat.
- `false`: Disable chat mode.

For a video chat, set this member as `true` and set the audio route to the speaker.

## ◆ defaultToSpeaker

Optional<bool> agora::base::AudioSessionConfiguration::defaultToSpeaker

Whether the audio defaults to the built-in speaker:

- `true`: The audio defaults to the built-in speaker.
- `false`: The audio does not default to the built-in speaker.

Note
  This member is available only when `playbackAndRecord` is set as `true`.

## ◆ overrideSpeaker

Optional<bool> agora::base::AudioSessionConfiguration::overrideSpeaker

Whether to temporarily change the current audio route to the built-in speaker:

- `true`: Set the current audio route to the built-in speaker.
- `false`: Do not set the current audio route to the built-in speaker.

Note
  This member is available only when the `playbackAndRecord` member is set as `true`.

## ◆ allowMixWithOthers

Optional<bool> agora::base::AudioSessionConfiguration::allowMixWithOthers

Whether to mix the audio from this session with the audio from active audio sessions in other apps.

- `true`: Mix the audio sessions.
- `false`: Do not mix the audio session.

Note
  This member is available only when the `playbackAndRecord` member is set as `true`.

## ◆ allowDuckOthers

Optional<bool> agora::base::AudioSessionConfiguration::allowDuckOthers

Whether to duck the audio from this session with the audio from active audio sessions in other apps.

- `true`: Duck the audio sessions.
- `false`: Do not duck the audio session.

Note
  This member is available only when the `playbackAndRecord` member is set as `true`.

## ◆ allowBluetooth

Optional<bool> agora::base::AudioSessionConfiguration::allowBluetooth

Whether to allow Bluetooth handsfree devices to appear as available audio input devices:

- `true`: Allow Bluetooth handsfree devices to appear as available audio input routes.
- `false`: Do not allow Bluetooth handsfree devices to appear as available audio input routes.

Note
  This member is available only when the `playbackAndRecord` member is set as `true`.

## ◆ allowBluetoothA2DP

Optional<bool> agora::base::AudioSessionConfiguration::allowBluetoothA2DP

Whether to allow the audio from this session to be routed to Bluetooth devices that support the Advanced Audio Distribution Profile (A2DP).

- `true`: Allow the audio from this session to be routed to Bluetooth devices that support the Advanced Audio Distribution Profile (A2DP).
- `false`: Do not allow the audio from this session to be routed to Bluetooth devices that support the Advanced Audio Distribution Profile (A2DP).

Note
  This member is available only when the `playbackAndRecord` member is set as `true`.

## ◆ sampleRate

Optional<double> agora::base::AudioSessionConfiguration::sampleRate

The expected audio sample rate (kHz) of this session.

The value range is [8,48]. The actual sample rate may differ based on the audio sampling device in use.

## ◆ ioBufferDuration

Optional<double> agora::base::AudioSessionConfiguration::ioBufferDuration

The expected input and output buffer duration (ms) of this session.

The value range is [0,93]. The actual I/O buffer duration might be lower than the set value based on the hardware in use.

## ◆ inputNumberOfChannels

Optional<int> agora::base::AudioSessionConfiguration::inputNumberOfChannels

The expected number of input audio channels of this session.

## ◆ outputNumberOfChannels

Optional<int> agora::base::AudioSessionConfiguration::outputNumberOfChannels

The expected number of output audio channels of this session.

## ◆ category

Optional<int> agora::base::AudioSessionConfiguration::category

Initialize the AudioSession with the value for category. (iOS only)