@@ -107,7 +107,7 @@ bool CAgoraEffectDlg::InitAgora()
107107 // create Agora RTC engine
108108 m_rtcEngine = createAgoraRtcEngine ();
109109 if (!m_rtcEngine) {
110- m_lstInfo.InsertString (m_lstInfo.GetCount () - 1 , _T (" createAgoraRtcEngine failed" ));
110+ m_lstInfo.InsertString (m_lstInfo.GetCount (), _T (" createAgoraRtcEngine failed" ));
111111 return false ;
112112 }
113113 // set message notify receiver window
@@ -345,12 +345,14 @@ void CAgoraEffectDlg::OnBnClickedButtonPlayEffect()
345345 }
346346 CString strEffect;
347347 m_cmbEffect.GetWindowText (strEffect);
348- std::string strFile;
349- strFile = cs2utf8 (strEffect).c_str ();
348+ std::string strFile = cs2utf8 (strEffect);
350349 CString strLoops;
351350 m_edtLoops.GetWindowText (strLoops);
352351 int loops = _ttol (strLoops);
353-
352+ if (loops == 0 ) {
353+ m_edtLoops.SetWindowText (_T (" 1" ));
354+ loops = 1 ;
355+ }
354356 CString strPitch;
355357 m_edtPitch.GetWindowText (strPitch);
356358 double pitch = _ttof (strPitch);
@@ -365,11 +367,13 @@ void CAgoraEffectDlg::OnBnClickedButtonPlayEffect()
365367
366368 BOOL publish = m_chkPublish.GetCheck ();
367369 // play effect by effect path.
368- m_rtcEngine->playEffect (m_mapEffect[strEffect], strFile.c_str (), loops, pitch, pan, gain, publish);
370+ int ret = m_rtcEngine->playEffect (m_mapEffect[strEffect], strFile.c_str (), loops, pitch, pan, gain, publish);
369371
370372 CString strInfo;
371- strInfo.Format (_T (" play effect :path:%s,loops:%d,pitch:%.1f,pan:%.0f,gain:%d,publish:%d" ),
372- strEffect, loops, pitch, pan, gain, publish);
373+ strInfo.Format (_T (" play effect :path:%s, ret:%d" ), strEffect, ret);
374+ m_lstInfo.InsertString (m_lstInfo.GetCount (), strInfo);
375+ strInfo.Format (_T (" loops:%d,pitch:%.1f,pan:%.0f,gain:%d,publish:%d" ),
376+ loops, pitch, pan, gain, publish);
373377 m_lstInfo.InsertString (m_lstInfo.GetCount (), strInfo);
374378}
375379
0 commit comments