Agora Java API Reference for Android

Public Types | Public Member Functions | List of all members
agora::rtc::IAudioTrack Class Referenceabstract

`#include <NGIAgoraAudioTrack.h>`

Inheritance diagram for agora::rtc::IAudioTrack:

## Public Types
enum | AudioFilterPosition { RecordingLocalPlayback, PostAudioProcessing, RemoteUserPlayback, PcmSource, PcmSourceSending, PcmSourceLocalPlayback, RemoteMixedPlayback }

## Public Member Functions
virtual int | adjustPlayoutVolume (int volume, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | getPlayoutVolume (int *volume)=0
virtual bool | addAudioFilter (agora_refptr< IAudioFilter > filter, AudioFilterPosition position, ExtensionContext *extContext=NULL, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual bool | removeAudioFilter (agora_refptr< IAudioFilter > filter, AudioFilterPosition position, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | enableAudioFilter (const char *id, bool enable, AudioFilterPosition position, aosl_ref_t ares=AOSL_REF_INVALID)
virtual int | setFilterProperty (const char *id, const char *key, const char *jsonValue, AudioFilterPosition position, aosl_ref_t ares=AOSL_REF_INVALID)
virtual int | getFilterProperty (const char *id, const char *key, char *jsonValue, size_t bufSize, AudioFilterPosition position)
virtual agora_refptr< IAudioFilter > | getAudioFilter (const char *name, AudioFilterPosition position) const =0
virtual bool | addAudioSink (agora_refptr< IAudioSinkBase > sink, const AudioSinkWants &wants, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual bool | removeAudioSink (agora_refptr< IAudioSinkBase > sink, aosl_ref_t ares=AOSL_REF_INVALID)=0
Public Member Functions inherited from agora::RefCountInterface
virtual void | AddRef () const =0
virtual RefCountReleaseStatus | Release () const =0
virtual bool | HasOneRef () const =0

## Detailed Description

The IAudioTrack class.

## Member Enumeration Documentation

## ◆ AudioFilterPosition

enum agora::rtc::IAudioTrack::AudioFilterPosition

The position of the audio filter in audio frame.

Enumerator
RecordingLocalPlayback | Work on the local playback
PostAudioProcessing | Work on the post audio processing.
RemoteUserPlayback | Work on the remote audio before mixing.
PcmSource | Work on the pcm source.
PcmSourceSending | Work on the sending branch of the pcm source.
PcmSourceLocalPlayback | Work on the local playback branch of the pcm source.
RemoteMixedPlayback | Work on the playback after remote-audio mix.

## Member Function Documentation

## ◆ adjustPlayoutVolume()

virtual int agora::rtc::IAudioTrack::adjustPlayoutVolume | ( | int | volume,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Adjusts the playback volume.

Parameters

  volume | The playback volume. The value ranges between 0 and 100 (default).

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getPlayoutVolume()

virtual int agora::rtc::IAudioTrack::getPlayoutVolume | ( | int * | volume | ) |
| pure virtual

Gets the current playback volume.

Parameters

  volume | A pointer to the playback volume.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ addAudioFilter()

virtual bool agora::rtc::IAudioTrack::addAudioFilter | ( | agora_refptr< IAudioFilter > | filter,
|  | AudioFilterPosition | position,
|  | ExtensionContext * | extContext = `NULL`,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Adds an audio filter.

By adding an audio filter, you can apply various audio effects to the audio, for example, voice change.

Parameters

  filter | A pointer to the audio filter. See IAudioFilter.
  position | The position of the audio filter. See AudioFilterPosition.
  extContext | The context of current filter. See ExtensionContext.

Returns
  - `true`: Success.
  - `false`: Failure.

## ◆ removeAudioFilter()

virtual bool agora::rtc::IAudioTrack::removeAudioFilter | ( | agora_refptr< IAudioFilter > | filter,
|  | AudioFilterPosition | position,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Removes the audio filter added by callling `addAudioFilter`.

Parameters

  filter | The pointer to the audio filter that you want to remove. See IAudioFilter.
  position | The position of the audio filter. See AudioFilterPosition.

Returns
  - `true`: Success.
  - `false`: Failure.

## ◆ enableAudioFilter()

virtual int agora::rtc::IAudioTrack::enableAudioFilter | ( | const char * | id,
|  | bool | enable,
|  | AudioFilterPosition | position,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| virtual

Enable / Disable specified audio filter

Parameters

  id | id of the filter
  enable | enable / disable the filter with given id
  position | The position of the audio filter. See AudioFilterPosition.

Returns
  - 0: success
  - <0: failure

## ◆ setFilterProperty()

virtual int agora::rtc::IAudioTrack::setFilterProperty | ( | const char * | id,
|  | const char * | key,
|  | const char * | jsonValue,
|  | AudioFilterPosition | position,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| virtual

set the properties of the specified audio filter

Parameters

  id | id of the filter
  key | key of the property
  jsonValue | json str value of the property
  position | The position of the audio filter. See AudioFilterPosition.

Returns
  - 0: success
  - <0: failure

## ◆ getFilterProperty()

virtual int agora::rtc::IAudioTrack::getFilterProperty | ( | const char * | id,
|  | const char * | key,
|  | char * | jsonValue,
|  | size_t | bufSize,
|  | AudioFilterPosition | position
| ) |  |
| virtual

get the properties of the specified video filter

Parameters

  id | id of the filter
  key | key of the property
  jsonValue | json str value of the property
  bufSize | max length of the json value buffer
  position | The position of the audio filter. See AudioFilterPosition.

Returns
  - 0: success
  - <0: failure

## ◆ getAudioFilter()

virtual agora_refptr<IAudioFilter> agora::rtc::IAudioTrack::getAudioFilter | ( | const char * | name,
|  | AudioFilterPosition | position
| ) |  | const
| pure virtual

Gets the audio filter by its name.

Parameters

  name | The name of the audio filter.
  position | The position of the audio filter. See AudioFilterPosition.

Returns
  - The pointer to the audio filter: Success.
  - A null pointer: Failure.

## ◆ addAudioSink()

virtual bool agora::rtc::IAudioTrack::addAudioSink | ( | agora_refptr< IAudioSinkBase > | sink,
|  | const AudioSinkWants & | wants,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Adds an audio sink to get PCM data from the audio track.

Parameters

  sink | The pointer to the audio sink. See IAudioSinkBase.
  wants | The properties an audio frame should have when it is delivered to the sink. See AudioSinkWants.

Returns
  - `true`: Success.
  - `false`: Failure.

## ◆ removeAudioSink()

virtual bool agora::rtc::IAudioTrack::removeAudioSink | ( | agora_refptr< IAudioSinkBase > | sink,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Removes an audio sink.

Parameters

  sink | The pointer to the audio sink to be removed. See IAudioSinkBase.

Returns
  - `true`: Success.
  - `false`: Failure.