forked from AgoraIO/API-Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCAgoraEffectDlg.h
More file actions
167 lines (158 loc) · 6.21 KB
/
CAgoraEffectDlg.h
File metadata and controls
167 lines (158 loc) · 6.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#pragma once
#include "AGVideoWnd.h"
class CAudioEffectEventHandler : public IRtcEngineEventHandler
{
public:
//set the message notify window handler
void SetMsgReceiver(HWND hWnd) { m_hMsgHanlder = hWnd; }
/*
note:
Join the channel callback.This callback method indicates that the client
successfully joined the specified channel.Channel ids are assigned based
on the channel name specified in the joinChannel. If IRtcEngine::joinChannel
is called without a user ID specified. The server will automatically assign one
parameters:
channel:channel name.
uid: user ID.If the UID is specified in the joinChannel, that ID is returned here;
Otherwise, use the ID automatically assigned by the Agora server.
elapsed: The Time from the joinChannel until this event occurred (ms).
*/
virtual void onJoinChannelSuccess(const char* channel, uid_t uid, int elapsed) override;
/*
note:
In the live broadcast scene, each anchor can receive the callback
of the new anchor joining the channel, and can obtain the uID of the anchor.
Viewers also receive a callback when a new anchor joins the channel and
get the anchor's UID.When the Web side joins the live channel, the SDK will
default to the Web side as long as there is a push stream on the
Web side and trigger the callback.
parameters:
uid: remote user/anchor ID for newly added channel.
elapsed: The joinChannel is called from the local user to the delay triggered
by the callback(ms).
*/
virtual void onUserJoined(uid_t uid, int elapsed) override;
/*
note:
Remote user (communication scenario)/anchor (live scenario) is called back from
the current channel.A remote user/anchor has left the channel (or dropped the line).
There are two reasons for users to leave the channel, namely normal departure and
time-out:When leaving normally, the remote user/anchor will send a message like
"goodbye". After receiving this message, determine if the user left the channel.
The basis of timeout dropout is that within a certain period of time
(live broadcast scene has a slight delay), if the user does not receive any
packet from the other side, it will be judged as the other side dropout.
False positives are possible when the network is poor. We recommend using the
Agora Real-time messaging SDK for reliable drop detection.
parameters:
uid: The user ID of an offline user or anchor.
reason:Offline reason: USER_OFFLINE_REASON_TYPE.
*/
virtual void onUserOffline(uid_t uid, USER_OFFLINE_REASON_TYPE reason) override;
/*
note:
When the App calls the leaveChannel method, the SDK indicates that the App
has successfully left the channel. In this callback method, the App can get
the total call time, the data traffic sent and received by THE SDK and other
information. The App obtains the call duration and data statistics received
or sent by the SDK through this callback.
parameters:
stats: Call statistics.
*/
virtual void onLeaveChannel(const RtcStats& stats) override;
/**
Occurs when the remote video state changes.
@note This callback does not work properly when the number of users (in the Communication profile) or broadcasters (in the Live-broadcast profile) in the channel exceeds 17.
@param uid ID of the remote user whose video state changes.
@param state State of the remote video. See #REMOTE_VIDEO_STATE.
@param reason The reason of the remote video state change. See
#REMOTE_VIDEO_STATE_REASON.
@param elapsed Time elapsed (ms) from the local user calling the
\ref agora::rtc::IRtcEngine::joinChannel "joinChannel" method until the
SDK triggers this callback.
*/
virtual void onRemoteVideoStateChanged(uid_t uid, REMOTE_VIDEO_STATE state, REMOTE_VIDEO_STATE_REASON reason, int elapsed) override;
private:
HWND m_hMsgHanlder;
};
class CAgoraEffectDlg : public CDialogEx
{
DECLARE_DYNAMIC(CAgoraEffectDlg)
public:
CAgoraEffectDlg(CWnd* pParent = nullptr);
virtual ~CAgoraEffectDlg();
enum { IDD = IDD_DIALOG_AUDIO_EFFECT };
public:
//Initialize the Ctrl Text.
void InitCtrlText();
//Initialize the Agora SDK
bool InitAgora();
//UnInitialize the Agora SDK
void UnInitAgora();
//render local video from SDK local capture.
void RenderLocalVideo();
//resume window status
void ResumeStatus();
private:
bool m_joinChannel = false;
bool m_initialize = false;
bool m_audioMixing = false;
IRtcEngine* m_rtcEngine = nullptr;
CAGVideoWnd m_localVideoWnd;
CAudioEffectEventHandler m_eventHandler;
protected:
virtual void DoDataExchange(CDataExchange* pDX);
DECLARE_MESSAGE_MAP()
LRESULT OnEIDJoinChannelSuccess(WPARAM wParam, LPARAM lParam);
LRESULT OnEIDLeaveChannel(WPARAM wParam, LPARAM lParam);
LRESULT OnEIDUserJoined(WPARAM wParam, LPARAM lParam);
LRESULT OnEIDUserOffline(WPARAM wParam, LPARAM lParam);
LRESULT OnEIDRemoteVideoStateChanged(WPARAM wParam, LPARAM lParam);
public:
CStatic m_staVideoArea;
CListBox m_lstInfo;
CStatic m_staChannel;
CEdit m_edtChannel;
CButton m_btnJoinChannel;
CStatic m_staEffectPath;
CEdit m_edtEffectPath;
CButton m_btnAddEffect;
CButton m_btnPreLoad;
CButton m_btnUnload;
CButton m_btnRemove;
CButton m_btnPause;
CButton m_btnResume;
CStatic m_staDetails;
CStatic m_staLoops;
CEdit m_edtLoops;
CStatic m_staGain;
CEdit m_edtGain;
CSpinButtonCtrl m_spinGain;
CStatic m_staPitch;
CEdit m_edtPitch;
CSpinButtonCtrl m_spinPitch;
CStatic m_staPan;
CComboBox m_cmbPan;
CButton m_chkPublish;
CButton m_btnPlay;
CButton m_btnPauseAll;
CButton m_btnStopAll;
afx_msg void OnBnClickedButtonJoinchannel();
afx_msg void OnBnClickedButtonAddEffect();
afx_msg void OnBnClickedButtonPreload();
afx_msg void OnBnClickedButtonUnloadEffect();
afx_msg void OnBnClickedButtonRemove();
afx_msg void OnBnClickedButtonPauseEffect();
afx_msg void OnBnClickedButtonResumeEffect();
afx_msg void OnBnClickedButtonPlayEffect();
afx_msg void OnBnClickedButtonPauseAllEffect();
afx_msg void OnBnClickedButtonStopAllEffect2();
afx_msg void OnDeltaposSpinGain(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnDeltaposSpinPitch(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnSelchangeListInfoBroadcasting();
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
virtual BOOL OnInitDialog();
virtual BOOL PreTranslateMessage(MSG* pMsg);
CButton m_btnStopEffect;
afx_msg void OnBnClickedButtonStopEffect();
};