I am making a simple music playback program using the lame library and MCI. After decoding MP3 files into wav files, use MCIWndCreate and MCIWndPlay to play music. All functions are working fine, but there was a problem with setting the volume. I found and used a method called MCIWndSetVolume(hWnd, iVol) for setting the volume. But I get the error like below. If you know which part is the problem, please give me a little advice. Thank you so much for reading and answering my questions. Error Message -> The specified command is not recognized by the driver.
void CMP3PlayerDlg::Wav(CString strFileName)
{
m_hWav = NULL;
m_nowWav = strFileName;
CString strWav;
strWav.Format(WAV_FILE_PATH + strFileName);
if(m_hWav == NULL)
{
m_hWav = MCIWndCreate(this->GetSafeHwnd(), AfxGetInstanceHandle(), WS_CHILD | WS_VISIBLE | MCIWNDF_NOMENU , strWav);
}
else
{
MCIWndHome(m_hWav);
}
MCIWndPlay(m_hWav);
m_bPause = FALSE;
m_btnPlay.EnableWindow(FALSE);
}
void CMP3PlayerDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다.
if(IDC_SLIDER_VOLUM == pScrollBar->GetDlgCtrlID())
{
int nPos = m_SliderVol.GetPos();
CString strPos;
strPos.Format("%d", nPos);
m_EditVol.SetWindowText(strPos);
}
CDialogEx::OnHScroll(nSBCode, nPos, pScrollBar);
}
void CMP3PlayerDlg::OnEnChangeEditVolum()
{
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
CString strPos;
m_EditVol.GetWindowText(strPos);
int nPos = _ttoi(strPos);
m_SliderVol.SetPos(nPos);
MCIWndSetVolume(m_hWav, nPos);
}
This is a volume control method using playback and slider bar.