本文整理汇总了C++中ActionManager::GetRandomTrackCollection方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionManager::GetRandomTrackCollection方法的具体用法?C++ ActionManager::GetRandomTrackCollection怎么用?C++ ActionManager::GetRandomTrackCollection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionManager
的用法示例。
在下文中一共展示了ActionManager::GetRandomTrackCollection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DisplayNextQuestion
BOOL CQuizRunningDlg::DisplayNextQuestion()
{
TRACEST(_T("CQuizRunningDlg::DisplayNextQuestion"));
PrgAPI* pAPI = PRGAPI();
ActionManager* pAM = pAPI->GetActionManager();
TracksFilter tf;
tf.Duration.match = NUMM_Over;
tf.Duration.val = 30;
FullTrackRecordCollection col;
if (!pAM->GetRandomTrackCollection(col, tf, 4))
return FALSE;
UINT trackLength = 0;
TCHAR trackPath[MAX_PATH];
m_correctAnswer = INT((rand() * 4) / RAND_MAX);
FullTrackRecordSP rec;
for (int i = 0; i < 4; i++)
{
TCHAR txt[1000];
_sntprintf(txt, 1000, _T("%d. %s - %s"), i + 1, col[i]->artist.name.c_str(),col[i]->track.name.c_str());
m_pButtons[i + BT_Answer1]->SetWindowText(txt);
if (m_correctAnswer == i)
{
_tcsncpy(trackPath, col[i]->track.location.c_str(), MAX_PATH);
trackLength = col[i]->track.duration;
}
m_pButtons[i + BT_Answer1]->ShowWindow(TRUE);
}
m_subTitle.SetWindowText(PRGAPI()->GetString(IDS_RECOGNISESONG));
if (!m_pPlayer->Play(trackPath))
{
TRACE(_T("@1CQuizRunningDlg::DisplayNextQuestion. Cannot play the file '%s'\r\n"), trackPath);
return FALSE;
}
m_pPlayer->Pause();
trackLength = INT(m_pPlayer->GetMediaLength());
if (trackLength < 20)
{
TRACE(_T("@1CQuizRunningDlg::DisplayNextQuestion. trackLength is %d '%s'\r\n"), trackLength, trackPath);
return FALSE;
}
m_subTitle.SetColor(CLabelEx::COL_Text, RGB(200,200,200));
UINT startSec = (trackLength - 40) * rand() / RAND_MAX + 20;//Select 20sec in the track after the first 20 sec
m_pPlayer->SetVolume(95);
m_pPlayer->SetMediaPos((DOUBLE) startSec);
return TRUE;
}