The code below works fine if I load wav’s but mp3’s gives me an “Unknown file format” error. The really weird thing is if I comment out the DoModal() line and instead set sPath directly it works fine with the mp3’s.
I have double checked and my code is setting sPath correctly.
CFileDialog vDlg(TRUE,NULL,NULL,OFN_NOCHANGEDIR,”Sound Files (.wav;.mp3)|.wav; *.mp3|All Files (.)|.*||”,NULL);
if(IDCANCEL == vDlg.DoModal())
sPath = vDlg.GetPathName();
//sPath = “C:\MSDev\Projects\B9Projects\FModTest\MP3Test.mp3”;
m_pVoice = FSOUND_Sample_Load(FSOUND_FREE, sPath, FSOUND_2D, 0);
sError.Format(“Error : %s\n”, FMOD_ErrorString(FSOUND_GetError()));
Yes, I assumed my code is confilicting with fmod somehow. Right now it very simple and I can’t see anything I’m doing wrong, compared to your example files.
I expect it is a mem overwrite issue. I’ve switched to playing the files via the STREAM commands and everything works fine. (same code using CFileDialog to select files)
Running in the debbuger showed no memory leaks. I don’t have a good boundschecker type tool (need to get one!)
Is there some type of mem allocation I should be doing before I attempt to use the load sample command?
It almost seems as if the CFileDialog::DoModal() overwrites some part of fmod memory when it is invoked.
Please login first to submit.