Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
audio_track_i.h
1//
2// Agora Media SDK
3//
4// Created by Rao Qi in 2019.
5// Copyright (c) 2019 Agora IO. All rights reserved.
6//
7#pragma once
8
9#include <memory>
10
11#include "AgoraRefPtr.h"
12#include "AgoraBase.h"
13
14#include "NGIAgoraAudioTrack.h"
15
16#include "track_stat_i.h"
17#include "video_config_i.h"
18
19 namespace agora {
20 namespace rtc {
21
22 class AudioState;
23 class AudioNodeBase;
24 struct PacketStats;
25
26 class ILocalAudioTrackEx : public ILocalAudioTrack {
27 public:
28 enum DetachReason { MANUAL, TRACK_DESTROY, MIXER_DESTROY };
29 struct DetachOption {
30 Optional<bool> sync_destroy;
31 Optional<bool> detach_default_audio_state;
32 };
33
34 public:
35 ILocalAudioTrackEx() {}
36 virtual ~ILocalAudioTrackEx() {}
37
38 virtual void attach(agora_refptr<agora::rtc::AudioState> audioState,
39 std::shared_ptr<AudioNodeBase> audioNetworkSink, uint32_t sourceId) = 0;
40 virtual void detach(DetachReason reason) = 0;
41
42 virtual int ClearSenderBuffer() {
43 return -ERR_NOT_SUPPORTED;
44 }
45
46 virtual int setExtraDelay(int delay_ms) {
47 return -ERR_NOT_SUPPORTED;
48 }
49
50 virtual bool getStatistics(PacketStats& stats) { return true; }
51
52 virtual bool isMediaPacketTrack() { return false; }
53
54 virtual bool isEncodedFrameTrack() { return false; }
55
56 virtual int enableMusicMode(bool enable) {
57 return -ERR_NOT_SUPPORTED;
58 }
59
60 virtual int setDetachOption(DetachOption& option) {
61 return -ERR_NOT_SUPPORTED;
62 }
63 virtual int enableEarMonitorLLApiInternal(bool enable, int includeAudioFilters) = 0;
64 virtual ILocalAudioTrack::LocalAudioTrackStats GetStatsLLApiInternal() = 0;
65 virtual int setEnabledLLApiInternal(bool enable) = 0;
66 virtual bool isEnabledLLApiInternal() const = 0;
67 virtual bool addAudioFilterLLApiInternal(agora_refptr<IAudioFilter> filter, AudioFilterPosition position, const ExtensionContext& extContext = {}) = 0;
68 virtual bool removeAudioFilterLLApiInternal(agora_refptr<IAudioFilter> filter, AudioFilterPosition position) = 0;
69 virtual int enableAudioFilterLLApiInternal(const char* id, bool enable, AudioFilterPosition position) {return -1;};
70 virtual int setFilterPropertyLLApiInternal(const char* id, const char* key, const char* jsonValue, AudioFilterPosition position){return -1;};
71 virtual int getFilterPropertyLLApiInternal(const char* id, const char* key, char* jsonValue, size_t bufSize, AudioFilterPosition position){return -1;};
72 virtual agora_refptr<IAudioFilter> getAudioFilterLLApiInternal(const char* name, AudioFilterPosition position) const = 0;
73 virtual int adjustPlayoutVolumeLLApiInternal(int volume) = 0;
74 virtual int getPlayoutVolumeLLApiInternal(int* volume) = 0;
75 virtual int adjustPublishVolumeLLApiInternal(int volume) = 0;
76 virtual int getPublishVolumeLLApiInternal(int* volume) = 0;
77 virtual int enableLocalPlaybackLLApiInternal(bool enable, bool sync = true) = 0;
78 virtual bool addAudioSinkLLApiInternal(agora_refptr<IAudioSinkBase> sink, const AudioSinkWants& wants) = 0;
79 virtual bool removeAudioSinkLLApiInternal(agora_refptr<IAudioSinkBase> sink) = 0;
80 virtual LOCAL_AUDIO_STREAM_STATE getStateLLApiInternal() = 0;
81 virtual int registerTrackObserverLLApiInternal(ILocalAudioTrackObserver* observer) = 0;
82 virtual int unregisterTrackObserverLLApiInternal(ILocalAudioTrackObserver* observer) = 0;
83 virtual bool enforceFilterCompositesReadyLLApiInternal() = 0;
84 virtual AUDIO_SOURCE_TYPE audioSourceType() = 0;
85 virtual void setMaxBufferedAudioFrameNumberApiInternal(int number) = 0;
86 virtual void attachAudioDeviceLLApiInternal() = 0;
87 virtual void detachAudioDeviceLLApiInternal() = 0;
88};
89
90 class IRemoteAudioTrackEx : public IRemoteAudioTrack {
91 using RemoteAudioEvents = StateEvents<REMOTE_AUDIO_STATE, REMOTE_AUDIO_STATE_REASON>;
92 public:
93 IRemoteAudioTrackEx() : notifier_(REMOTE_AUDIO_STATE_STOPPED) {}
94
95 virtual ~IRemoteAudioTrackEx() {}
96
97 void NotifyTrackStateChange(uint64_t ts, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason) {
98 notifier_.Notify(ts, state, reason);
99 }
100
101 virtual void SetExternalJitterInfo(int32_t audio_jitter95, int32_t video_jitter95, bool receiving_video) = 0;
102
103 RemoteAudioEvents GetEvents() {
104 return notifier_.GetEvents();
105 }
106
107 virtual int GetAudioLevel() { return 0; }
108 virtual REMOTE_AUDIO_STATE getStateLLApiInternal() = 0;
109 virtual bool getStatisticsLLApiInternal(RemoteAudioTrackStats& stats) = 0;
110 virtual int adjustPlayoutVolumeLLApiInternal(int volume) = 0;
111 virtual int getPlayoutVolumeLLApiInternal(int* volume) = 0;
112 virtual int setPlayoutSignalLoudnessLLApiInternal(float loudness) = 0;
113 virtual bool addAudioFilterLLApiInternal(agora_refptr<IAudioFilter> filter, AudioFilterPosition position, const ExtensionContext &extConetxt = {}) = 0;
114 virtual bool removeAudioFilterLLApiInternal(agora_refptr<IAudioFilter> filter, AudioFilterPosition position) = 0;
115 virtual agora_refptr<IAudioFilter> getAudioFilterLLApiInternal(const char* name, AudioFilterPosition position) const = 0;
116 virtual int registerMediaPacketReceiverLLApiInternal(IMediaPacketReceiver* packetReceiver) = 0;
117 virtual int unregisterMediaPacketReceiverLLApiInternal(IMediaPacketReceiver* packetReceiver) = 0;
118 virtual int registerAudioEncodedFrameReceiverLLApiInternal(IAudioEncodedFrameReceiver* packetReceiver, const AudioEncFrameRecvParams& recvParams) = 0;
119 virtual int unregisterAudioEncodedFrameReceiverLLApiInternal(IAudioEncodedFrameReceiver* packetReceiver) = 0;
120 virtual int setRemoteVoicePositionLLApiInternal(float pan, float gain) = 0;
121 virtual int adjustAudioAccelerationLLApiInternal(int percentage) = 0;
122 virtual int adjustAudioDecelerationLLApiInternal(int percentage) = 0;
123 virtual int adjustDecodedAudioVolumeLLApiInternal(int decoded_index, int volume) = 0;
124 virtual int enableSpatialAudioLLApiInternal(bool enabled) = 0;
125 virtual bool addAudioSinkLLApiInternal(agora_refptr<IAudioSinkBase> sink, const AudioSinkWants& wants) = 0;
126 virtual bool removeAudioSinkLLApiInternal(agora_refptr<IAudioSinkBase> sink) = 0;
127 virtual int setRemoteUserSpatialAudioParamsLLApiInternal(const agora::SpatialAudioParams& params) = 0;
128 virtual int enableAudioFilterLLApiInternal(const char* id, bool enable, AudioFilterPosition position) = 0;
129 virtual int setFilterPropertyLLApiInternal(const char* id, const char* key, const char* jsonValue, AudioFilterPosition position) = 0;
130 virtual int getFilterPropertyLLApiInternal(const char* id, const char* key, char* jsonValue, size_t bufSize, AudioFilterPosition position) = 0;
131 protected:
132 StateNotifier<REMOTE_AUDIO_STATE, REMOTE_AUDIO_STATE_REASON> notifier_;
133};
134
135} // namespace rtc
136} // namespace agora
agora::Optional
Definition AgoraOptional.h:413
agora::agora_refptr
Definition AgoraRefPtr.h:44
agora::rtc::IAudioEncodedFrameReceiver
Definition NGIAgoraMediaNode.h:298
agora::rtc::IAudioTrack::AudioFilterPosition
AudioFilterPosition
Definition NGIAgoraAudioTrack.h:64
agora::rtc::ILocalAudioTrackEx::enableAudioFilterLLApiInternal
virtual int enableAudioFilterLLApiInternal(const char *id, bool enable, AudioFilterPosition position)
Definition audio_track_i.h:69
agora::rtc::ILocalAudioTrackEx::adjustPublishVolumeLLApiInternal
virtual int adjustPublishVolumeLLApiInternal(int volume)=0
agora::rtc::ILocalAudioTrackEx::isEnabledLLApiInternal
virtual bool isEnabledLLApiInternal() const =0
agora::rtc::ILocalAudioTrackEx::getFilterPropertyLLApiInternal
virtual int getFilterPropertyLLApiInternal(const char *id, const char *key, char *jsonValue, size_t bufSize, AudioFilterPosition position)
Definition audio_track_i.h:71
agora::rtc::ILocalAudioTrackEx::ClearSenderBuffer
virtual int ClearSenderBuffer()
Definition audio_track_i.h:42
agora::rtc::ILocalAudioTrackEx::getAudioFilterLLApiInternal
virtual agora_refptr< IAudioFilter > getAudioFilterLLApiInternal(const char *name, AudioFilterPosition position) const =0
agora::rtc::ILocalAudioTrackEx::detachAudioDeviceLLApiInternal
virtual void detachAudioDeviceLLApiInternal()=0
agora::rtc::ILocalAudioTrackEx::getPublishVolumeLLApiInternal
virtual int getPublishVolumeLLApiInternal(int *volume)=0
agora::rtc::ILocalAudioTrackEx::removeAudioFilterLLApiInternal
virtual bool removeAudioFilterLLApiInternal(agora_refptr< IAudioFilter > filter, AudioFilterPosition position)=0
agora::rtc::ILocalAudioTrackEx::attachAudioDeviceLLApiInternal
virtual void attachAudioDeviceLLApiInternal()=0
agora::rtc::ILocalAudioTrackEx::DetachReason
DetachReason
Definition audio_track_i.h:28
agora::rtc::ILocalAudioTrackEx::MIXER_DESTROY
@ MIXER_DESTROY
Definition audio_track_i.h:28
agora::rtc::ILocalAudioTrackEx::MANUAL
@ MANUAL
Definition audio_track_i.h:28
agora::rtc::ILocalAudioTrackEx::TRACK_DESTROY
@ TRACK_DESTROY
Definition audio_track_i.h:28
agora::rtc::ILocalAudioTrackEx::attach
virtual void attach(agora_refptr< agora::rtc::AudioState > audioState, std::shared_ptr< AudioNodeBase > audioNetworkSink, uint32_t sourceId)=0
agora::rtc::ILocalAudioTrackEx::getStatistics
virtual bool getStatistics(PacketStats &stats)
Definition audio_track_i.h:50
agora::rtc::ILocalAudioTrackEx::removeAudioSinkLLApiInternal
virtual bool removeAudioSinkLLApiInternal(agora_refptr< IAudioSinkBase > sink)=0
agora::rtc::ILocalAudioTrackEx::audioSourceType
virtual AUDIO_SOURCE_TYPE audioSourceType()=0
agora::rtc::ILocalAudioTrackEx::getPlayoutVolumeLLApiInternal
virtual int getPlayoutVolumeLLApiInternal(int *volume)=0
agora::rtc::ILocalAudioTrackEx::~ILocalAudioTrackEx
virtual ~ILocalAudioTrackEx()
Definition audio_track_i.h:36
agora::rtc::ILocalAudioTrackEx::addAudioFilterLLApiInternal
virtual bool addAudioFilterLLApiInternal(agora_refptr< IAudioFilter > filter, AudioFilterPosition position, const ExtensionContext &extContext={})=0
agora::rtc::ILocalAudioTrackEx::setDetachOption
virtual int setDetachOption(DetachOption &option)
Definition audio_track_i.h:60
agora::rtc::ILocalAudioTrackEx::enableMusicMode
virtual int enableMusicMode(bool enable)
Definition audio_track_i.h:56
agora::rtc::ILocalAudioTrackEx::enforceFilterCompositesReadyLLApiInternal
virtual bool enforceFilterCompositesReadyLLApiInternal()=0
agora::rtc::ILocalAudioTrackEx::GetStatsLLApiInternal
virtual ILocalAudioTrack::LocalAudioTrackStats GetStatsLLApiInternal()=0
agora::rtc::ILocalAudioTrackEx::setEnabledLLApiInternal
virtual int setEnabledLLApiInternal(bool enable)=0
agora::rtc::ILocalAudioTrackEx::setFilterPropertyLLApiInternal
virtual int setFilterPropertyLLApiInternal(const char *id, const char *key, const char *jsonValue, AudioFilterPosition position)
Definition audio_track_i.h:70
agora::rtc::ILocalAudioTrackEx::isEncodedFrameTrack
virtual bool isEncodedFrameTrack()
Definition audio_track_i.h:54
agora::rtc::ILocalAudioTrackEx::ILocalAudioTrackEx
ILocalAudioTrackEx()
Definition audio_track_i.h:35
agora::rtc::ILocalAudioTrackEx::getStateLLApiInternal
virtual LOCAL_AUDIO_STREAM_STATE getStateLLApiInternal()=0
agora::rtc::ILocalAudioTrackEx::adjustPlayoutVolumeLLApiInternal
virtual int adjustPlayoutVolumeLLApiInternal(int volume)=0
agora::rtc::ILocalAudioTrackEx::setMaxBufferedAudioFrameNumberApiInternal
virtual void setMaxBufferedAudioFrameNumberApiInternal(int number)=0
agora::rtc::ILocalAudioTrackEx::addAudioSinkLLApiInternal
virtual bool addAudioSinkLLApiInternal(agora_refptr< IAudioSinkBase > sink, const AudioSinkWants &wants)=0
agora::rtc::ILocalAudioTrackEx::enableEarMonitorLLApiInternal
virtual int enableEarMonitorLLApiInternal(bool enable, int includeAudioFilters)=0
agora::rtc::ILocalAudioTrackEx::unregisterTrackObserverLLApiInternal
virtual int unregisterTrackObserverLLApiInternal(ILocalAudioTrackObserver *observer)=0
agora::rtc::ILocalAudioTrackEx::registerTrackObserverLLApiInternal
virtual int registerTrackObserverLLApiInternal(ILocalAudioTrackObserver *observer)=0
agora::rtc::ILocalAudioTrackEx::setExtraDelay
virtual int setExtraDelay(int delay_ms)
Definition audio_track_i.h:46
agora::rtc::ILocalAudioTrackEx::enableLocalPlaybackLLApiInternal
virtual int enableLocalPlaybackLLApiInternal(bool enable, bool sync=true)=0
agora::rtc::ILocalAudioTrackEx::isMediaPacketTrack
virtual bool isMediaPacketTrack()
Definition audio_track_i.h:52
agora::rtc::ILocalAudioTrackEx::detach
virtual void detach(DetachReason reason)=0
agora::rtc::ILocalAudioTrack
Definition NGIAgoraAudioTrack.h:262
agora::rtc::ILocalAudioTrackObserver
Definition NGIAgoraAudioTrack.h:234
agora::rtc::IMediaPacketReceiver
Definition NGIAgoraMediaNode.h:318
agora::rtc::IRemoteAudioTrackEx::getStatisticsLLApiInternal
virtual bool getStatisticsLLApiInternal(RemoteAudioTrackStats &stats)=0
agora::rtc::IRemoteAudioTrackEx::removeAudioFilterLLApiInternal
virtual bool removeAudioFilterLLApiInternal(agora_refptr< IAudioFilter > filter, AudioFilterPosition position)=0
agora::rtc::IRemoteAudioTrackEx::adjustAudioDecelerationLLApiInternal
virtual int adjustAudioDecelerationLLApiInternal(int percentage)=0
agora::rtc::IRemoteAudioTrackEx::NotifyTrackStateChange
void NotifyTrackStateChange(uint64_t ts, REMOTE_AUDIO_STATE state, REMOTE_AUDIO_STATE_REASON reason)
Definition audio_track_i.h:97
agora::rtc::IRemoteAudioTrackEx::notifier_
StateNotifier< REMOTE_AUDIO_STATE, REMOTE_AUDIO_STATE_REASON > notifier_
Definition audio_track_i.h:132
agora::rtc::IRemoteAudioTrackEx::getAudioFilterLLApiInternal
virtual agora_refptr< IAudioFilter > getAudioFilterLLApiInternal(const char *name, AudioFilterPosition position) const =0
agora::rtc::IRemoteAudioTrackEx::getFilterPropertyLLApiInternal
virtual int getFilterPropertyLLApiInternal(const char *id, const char *key, char *jsonValue, size_t bufSize, AudioFilterPosition position)=0
agora::rtc::IRemoteAudioTrackEx::SetExternalJitterInfo
virtual void SetExternalJitterInfo(int32_t audio_jitter95, int32_t video_jitter95, bool receiving_video)=0
agora::rtc::IRemoteAudioTrackEx::enableSpatialAudioLLApiInternal
virtual int enableSpatialAudioLLApiInternal(bool enabled)=0
agora::rtc::IRemoteAudioTrackEx::registerAudioEncodedFrameReceiverLLApiInternal
virtual int registerAudioEncodedFrameReceiverLLApiInternal(IAudioEncodedFrameReceiver *packetReceiver, const AudioEncFrameRecvParams &recvParams)=0
agora::rtc::IRemoteAudioTrackEx::removeAudioSinkLLApiInternal
virtual bool removeAudioSinkLLApiInternal(agora_refptr< IAudioSinkBase > sink)=0
agora::rtc::IRemoteAudioTrackEx::unregisterMediaPacketReceiverLLApiInternal
virtual int unregisterMediaPacketReceiverLLApiInternal(IMediaPacketReceiver *packetReceiver)=0
agora::rtc::IRemoteAudioTrackEx::~IRemoteAudioTrackEx
virtual ~IRemoteAudioTrackEx()
Definition audio_track_i.h:95
agora::rtc::IRemoteAudioTrackEx::addAudioFilterLLApiInternal
virtual bool addAudioFilterLLApiInternal(agora_refptr< IAudioFilter > filter, AudioFilterPosition position, const ExtensionContext &extConetxt={})=0
agora::rtc::IRemoteAudioTrackEx::unregisterAudioEncodedFrameReceiverLLApiInternal
virtual int unregisterAudioEncodedFrameReceiverLLApiInternal(IAudioEncodedFrameReceiver *packetReceiver)=0
agora::rtc::IRemoteAudioTrackEx::GetEvents
RemoteAudioEvents GetEvents()
Definition audio_track_i.h:103
agora::rtc::IRemoteAudioTrackEx::registerMediaPacketReceiverLLApiInternal
virtual int registerMediaPacketReceiverLLApiInternal(IMediaPacketReceiver *packetReceiver)=0
agora::rtc::IRemoteAudioTrackEx::getPlayoutVolumeLLApiInternal
virtual int getPlayoutVolumeLLApiInternal(int *volume)=0
agora::rtc::IRemoteAudioTrackEx::adjustPlayoutVolumeLLApiInternal
virtual int adjustPlayoutVolumeLLApiInternal(int volume)=0
agora::rtc::IRemoteAudioTrackEx::adjustAudioAccelerationLLApiInternal
virtual int adjustAudioAccelerationLLApiInternal(int percentage)=0
agora::rtc::IRemoteAudioTrackEx::setPlayoutSignalLoudnessLLApiInternal
virtual int setPlayoutSignalLoudnessLLApiInternal(float loudness)=0
agora::rtc::IRemoteAudioTrackEx::setRemoteVoicePositionLLApiInternal
virtual int setRemoteVoicePositionLLApiInternal(float pan, float gain)=0
agora::rtc::IRemoteAudioTrackEx::GetAudioLevel
virtual int GetAudioLevel()
Definition audio_track_i.h:107
agora::rtc::IRemoteAudioTrackEx::IRemoteAudioTrackEx
IRemoteAudioTrackEx()
Definition audio_track_i.h:93
agora::rtc::IRemoteAudioTrackEx::enableAudioFilterLLApiInternal
virtual int enableAudioFilterLLApiInternal(const char *id, bool enable, AudioFilterPosition position)=0
agora::rtc::IRemoteAudioTrackEx::getStateLLApiInternal
virtual REMOTE_AUDIO_STATE getStateLLApiInternal()=0
agora::rtc::IRemoteAudioTrackEx::addAudioSinkLLApiInternal
virtual bool addAudioSinkLLApiInternal(agora_refptr< IAudioSinkBase > sink, const AudioSinkWants &wants)=0
agora::rtc::IRemoteAudioTrackEx::adjustDecodedAudioVolumeLLApiInternal
virtual int adjustDecodedAudioVolumeLLApiInternal(int decoded_index, int volume)=0
agora::rtc::IRemoteAudioTrackEx::setFilterPropertyLLApiInternal
virtual int setFilterPropertyLLApiInternal(const char *id, const char *key, const char *jsonValue, AudioFilterPosition position)=0
agora::rtc::IRemoteAudioTrackEx::setRemoteUserSpatialAudioParamsLLApiInternal
virtual int setRemoteUserSpatialAudioParamsLLApiInternal(const agora::SpatialAudioParams &params)=0
agora::rtc::IRemoteAudioTrack
Definition NGIAgoraAudioTrack.h:778
agora::rtc::StateNotifier
Definition track_stat_i.h:24
agora::rtc
Definition AgoraExtensions.h:5
agora::rtc::LOCAL_AUDIO_STREAM_STATE
LOCAL_AUDIO_STREAM_STATE
The state of the local audio.
Definition AgoraBase.h:3404
agora::rtc::AUDIO_SOURCE_TYPE
AUDIO_SOURCE_TYPE
The audio source type.
Definition AgoraMediaBase.h:151
agora::rtc::REMOTE_AUDIO_STATE_REASON
REMOTE_AUDIO_STATE_REASON
The reason for the remote audio state change.
Definition AgoraBase.h:3730
agora::rtc::StateEvents
std::vector< StateEvent< STATE_TYPE, REASON_TYPE > > StateEvents
Definition track_stat_i.h:21
agora::rtc::REMOTE_AUDIO_STATE
REMOTE_AUDIO_STATE
Remote audio states.
Definition AgoraBase.h:3696
agora::rtc::REMOTE_AUDIO_STATE_STOPPED
@ REMOTE_AUDIO_STATE_STOPPED
Definition AgoraBase.h:3702
agora
Definition AgoraAtomicOps.h:21
agora::ERR_NOT_SUPPORTED
@ ERR_NOT_SUPPORTED
Definition AgoraBase.h:488
agora::SpatialAudioParams
The spatial audio parameters.
Definition AgoraBase.h:8055
agora::rtc::AudioEncFrameRecvParams
Definition NGIAgoraAudioTrack.h:709
agora::rtc::AudioSinkWants
Definition NGIAgoraAudioTrack.h:37
agora::rtc::ExtensionContext
The context information of the extension.
Definition AgoraMediaBase.h:41
agora::rtc::ILocalAudioTrack::LocalAudioTrackStats
Definition NGIAgoraAudioTrack.h:267
agora::rtc::ILocalAudioTrackEx::DetachOption
Definition audio_track_i.h:29
agora::rtc::ILocalAudioTrackEx::DetachOption::sync_destroy
Optional< bool > sync_destroy
Definition audio_track_i.h:30
agora::rtc::ILocalAudioTrackEx::DetachOption::detach_default_audio_state
Optional< bool > detach_default_audio_state
Definition audio_track_i.h:31
agora::rtc::RemoteAudioTrackStats
Definition NGIAgoraAudioTrack.h:454