我用VC编一个MP3播放器,其中快进和快退怎么实现啊?

来源:百度知道 编辑:UC知道 时间:2024/06/25 02:32:21
播放,暂停和停止我都弄好了,就是不知道快进和快退怎么写。麻烦哪位高手帮忙看下,谢谢
下面是我的播放,暂停和停止的代码
BOOL CMp3Player::Play(CString &strPath)
{
m_hVideo = NULL;
if(m_hVideo == NULL)
{
m_hVideo = MCIWndCreate(AfxGetMainWnd()->GetSafeHwnd(),
AfxGetInstanceHandle(),
WS_CHILD |MCIWNDF_NOMENU,strPath);

}
else
{
MCIWndHome(m_hVideo);
}
MCIWndPlay(m_hVideo);
m_bPause = FALSE;
return TRUE;
}

BOOL CMp3Player::Pause()
{
if(m_bPause)
{
//m_Pause.SetWindowText("Pause");
MCIWndResume(m_hVideo);
m_bPause = FALSE;
}
else
{
//m_Pause.SetWindowText("UnPause");
MCIWndPause(m_hVideo);
m_bPause = TRUE;
}

return m_bPause;
}

BOOL CMp3Player::Stop()
{
MCIWndStop(m_hVideo);
if(m_hVideo !=NULL)
{
MCIWndDestroy(m_hVideo);

}

return TRUE;

MCIWndGetPosition
The MCIWndGetPosition macro retrieves the numerical value of the current position within the content of the MCI device. You can use this macro or explicitly send the MCIWNDM_GETPOSITION message.

LONG MCIWndGetPosition(
hwnd
);

Parameters
hwnd
Handle of the MCIWnd window.
Return Values
Returns an integer corresponding to the current position. The units for the position value depend on the current time format.

这个是用来设置播放进度的

MCIWndSetSpeed(m_Hwnd, MCIWNDM_SETSPEED,0,2000);
1000是默认速度,2000就是2倍速度

用MCIWndXXXXX可能实现起来比较困难。
我以前做过一个工具软件《音楽示波器》。我用的方法是把mp3转换成wav数据,播放wav数据就相对底层一点的程序,使用waveOutXXXXX寒暑,虽然代码多点,可是我可以实现很多功能。