Windows7 cannot play mp3 music using Cocosdenshion

on winxp, it’ s ok to play .mp3 musics
but on win7, it crashes when preload the files

hello, my os is win7, and i tested it right now, it is ok.

you could replace your .mp3 file in CocosDenshionTest.cpp to try first.

i do replaced the .mid file in CocosDenshionTest.cpp, but crashed the same
maybe it’s the soundcard drive’s problem

it is curious,
you could paste some debug info here and somebody else may has encountered it before.

ok, i’ll debug it today when i back home and reply u ASAP

void MciPlayer::Open(const char* pFileName, UINT uId)
{
// WCHAR * pBuf = NULL;
do
{
BREAK_IF(! pFileName || ! m_hWnd);
int nLen = (int)strlen(pFileName);
BREAK_IF(! nLen);
// pBuf = new WCHAR[nLen + 1];
// BREAK_IF(! pBuf);
// MultiByteToWideChar(CP_ACP, 0, pFileName, nLen + 1, pBuf, nLen + 1);

Close();

MCI_OPEN_PARMS mciOpen = {0};
MCIERROR mciError;
mciOpen.lpstrDeviceType = (LPCTSTR)MCI_ALL_DEVICE_ID;
mciOpen.lpstrElementName = pFileName;

mciError = mciSendCommand(0,MCI_OPEN, MCI_OPEN_ELEMENT, (DWORD)&mciOpen);
BREAK_IF(mciError);

m_hDev = mciOpen.wDeviceID;
m_nSoundID = uId;
m_bPlaying = false;
} while (0);
}

i changed the MUSIC_FILE to “background.mp3” and it breaks at
mciError = mciSendCommand(0,MCI_OPEN, MCI_OPEN_ELEMENT, (DWORD)&mciOpen);

If anyone else gets stuck with a similar issue like I did but you find the samples working yet mciSendCommand returning MCIERR_FILENAME_REQUIRED in production:
rename your .wav files to less than eight characters… magic.

Hope this helps someone who might stumble across this thread like I did.