本文整理汇总了C++中MediaPlayer::Pause方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaPlayer::Pause方法的具体用法?C++ MediaPlayer::Pause怎么用?C++ MediaPlayer::Pause使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaPlayer
的用法示例。
在下文中一共展示了MediaPlayer::Pause方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCommand
BOOL TrayToolTipDlg::OnCommand(WPARAM wParam, LPARAM lParam)
{
//TRACEST(_T("TrayToolTipDlg::OnCommand"));
MediaPlayer* pPlayer = PRGAPI()->GetMediaPlayer();
switch (wParam)
{
case ID_BUTTONSID + BTN_Prev:
pPlayer->Previous();
break;
case ID_BUTTONSID + BTN_Play:
pPlayer->Start();
break;
case ID_BUTTONSID + BTN_Pause:
pPlayer->Pause();
break;
case ID_BUTTONSID + BTN_Next:
pPlayer->Next();
break;
case ID_BUTTONSID + BTN_Stop:
pPlayer->Stop();
break;
case ID_SYSTEMBUTTONSID + SBTN_QuickSearch:
{
PrgAPI* pAPI = PRGAPI();
QuickSearchDlg* pQSDlg = pAPI->GetQuickSearchDlg();
pQSDlg->SetSearchText(_T(""));
pQSDlg->ShowRelative(NULL, QuickSearchDlg::RP_Centered);
}
break;
case ID_CLOSEBUTTONID:
SetRealTransparency(0);
Hide();
break;
}
return __super::OnCommand(wParam, lParam);
}
示例2: WindowProc
LRESULT CTeenSpiritDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == WM_GETTEXT && wParam > GTB_First && wParam < GTB_Last && lParam != 0)//External commands interface
{
INT ret = 0;
LPCTSTR str = NULL;
LPTSTR externalBuffer = (LPTSTR) lParam;
externalBuffer[0] = 0;
MediaPlayer* pPlayer = PRGAPI()->GetMediaPlayer();
INT curTrack = pPlayer->GetPlayListPos();
if (curTrack >= 0)
{
MediaPlayListItem mpli;
if (pPlayer->GetPlayListItem(mpli, curTrack))
{
switch (wParam)
{
case GTB_Artist:
str = mpli.artist;
break;
case GTB_Title:
str = mpli.title;
break;
default:
ASSERT(0);
break;
}
}
}
if (str == NULL)
return 0;
_tcsncpy(externalBuffer, str, wParam);
return _tcslen(str);
}
else if (message == WM_COMMAND)//External commands interface
{
MediaPlayer* pPlayer = PRGAPI()->GetMediaPlayer();
if (pPlayer != NULL)
{
BOOL bHandled = TRUE;
switch (wParam)
{
case EXTERNALCOMMAND_Play: //Returns 0 on success
pPlayer->Start();
break;
case EXTERNALCOMMAND_Pause: //Returns 0 on success
pPlayer->Pause();
break;
case EXTERNALCOMMAND_Stop: //Returns 0 on success
pPlayer->Stop();
break;
case EXTERNALCOMMAND_Next: //Returns 0 on success
pPlayer->Next();
break;
case GTB_Artist:
case EXTERNALCOMMAND_Previous: //Returns 0 on success
pPlayer->Previous();
break;
case EXTERNALCOMMAND_ShowHidePlayer: //lparam=1 to show. 0 to hide. Returns 0 on success
if (IsWindowVisible() && lParam == 0)
PostMessage(WM_SYSCOMMAND, SC_MINIMIZE);
else if (!IsWindowVisible() && lParam == 1)
PostMessage(WM_SYSCOMMAND, SC_RESTORE);
break;
case EXTERNALCOMMAND_GetVolume: //Return vol 0-100. Returns 0-100 on success
return pPlayer->GetVolume();
case EXTERNALCOMMAND_SetVolume: //lParam is the new value(0-100) retunrns 0 on success
pPlayer->SetVolume(lParam);
PRGAPI()->GetStateManager()->SendMessage(SM_PlayerVolumeChanged);
break;
case EXTERNALCOMMAND_GetMute: //Returns 1 on mute ON. 0 on Mute off
return pPlayer->GetMute();
case EXTERNALCOMMAND_SetMute: //lparam=1 for mute ON. 0 Returns 0 on success
pPlayer->SetMute(lParam != 0);
PRGAPI()->GetStateManager()->PostMessage(SM_PlayerSettingsChanged);
break;
case EXTERNALCOMMAND_GetMediaLength: //returns the number of seconds
return INT(pPlayer->GetMediaLength());
case EXTERNALCOMMAND_GetMediaPos: //returns the number of seconds
return INT(pPlayer->GetMediaPos());
case EXTERNALCOMMAND_SetMediaPos: //lparam=1 for mute ON. 0 Returns 0 on success
pPlayer->SetMediaPos(lParam);
break;
default:
bHandled = FALSE;
}
if (bHandled)
return 0;
}
}
else if (message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
{
TRACE(_T("CTeenSpiritDlg::WindowProc. KeyDown: %d-%d\r\n"), wParam, lParam);
}
return CDialog::WindowProc(message, wParam, lParam);
}
示例3: HandlePlayerCommands
BOOL MenuManager::HandlePlayerCommands(MediaPlayer& player, MenuCommandsEnum cmd, INT playlistPos)
{
TRACEST(_T("MenuManager::HandlePlayerCommands"));
PrgAPI* pAPI = PRGAPI();
ActionManager* pAM = pAPI->GetActionManager();
switch (cmd)
{
//=== Play Control =========================================
case MENU_PlayControl:
player.Start();
break;
case MENU_PauseControl:
if (player.GetPlayState() == PS_Paused)
player.Start();
else
player.Pause();
break;
case MENU_StopControl:
player.Stop();
break;
case MENU_NextControl:
player.Next();
break;
case MENU_PrevControl:
player.Previous();
break;
//=== Playlist Serialization =========================================
case MENU_LoadList:
pAM->InsertPlayList(&player, -1);
break;
case MENU_SaveList:
pAM->SavePlayList(&player);
break;
case MENU_InsertList:
pAM->InsertPlayList(&player, playlistPos);
break;
default:
//=== PlayModes =========================================
if (cmd>= MENU_PlayModesHolder && cmd < MENU_PlayModesHolder + MPNM_Last)
player.SetNextMode(MediaPlayerNextMode(cmd - MENU_PlayModesHolder), -1);
else if (cmd >= MENU_AutoContinueModeHolder && cmd < MENU_AutoContinueModeHolder + RTM_Last)
{
player.SetNextMode(player.GetNextMode(NULL), cmd - MENU_AutoContinueModeHolder);
}
//=== Rating =========================================
else if (cmd>= MENU_RatingHolder && cmd <= MENU_RatingHolder + 5)
{
int idx = playlistPos;
if (idx >= 0)
{
SQLManager* pSM = PRGAPI()->GetSQLManager();
MediaPlayListItem mpli;
if (player.GetPlayListItem(mpli, idx))
{
FullTrackRecordSP rec;
if (pSM->GetFullTrackRecordByLocation(rec, mpli.url))
{
FullTrackRecordCollection col;
col.push_back(rec);
ActionManager* pAM = PRGAPI()->GetActionManager();
pAM->SetTrackRating(col, Stars2Rating((FLOAT)(cmd - MENU_RatingHolder)));
}
}
}
}
else
return FALSE;
}
return TRUE;
}