0
0

Newbie here…

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.

Any ideas?

MikeJ


[quote:r1ruqguf]
void CFModTestDlg::OnBUTTONPlay()
{

CString sError;
CString sPath;

CFileDialog vDlg(TRUE,NULL,NULL,OFN_NOCHANGEDIR,”Sound Files (.wav;.mp3)|.wav; *.mp3|All Files (.)|.*||”,NULL);
if(IDCANCEL == vDlg.DoModal())
return;
sPath = vDlg.GetPathName();

//sPath = “C:\MSDev\Projects\B9Projects\FModTest\MP3Test.mp3”;

m_pVoice = FSOUND_Sample_Load(FSOUND_FREE, sPath, FSOUND_2D, 0);
if (!m_pVoice)
{
sError.Format(“Error : %s\n”, FMOD_ErrorString(FSOUND_GetError()));
AfxMessageBox(sError);
return;
}
FSOUND_PlaySound(0, m_pVoice);
}
[/quote:r1ruqguf]

  • You must to post comments
0
0

More info:
This is only an issue with the MFC CFileDialog class. I tried a few other CDialog derived classes without any errors.
Is this a known issue?

  • You must to post comments
0
0

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.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.