THE WHYTELEAFE FC SUPPORTERS' DISCUSSION FORUM

WHYTELEAFE FC HOMEPAGE | WHYTELEAFE FC FACEBOOK PAGE | WHYTELEAFE FC TWITTER

NOTE: All postings from persons calling themselves "Anonymous", "anon" or similar will be deleted

Return to front page

Newest article: Re: A pattern emerging by Alicia HedisionToday 06:36Today at 06:36:41view thread

Oldest article: New grounds 2014/15 by Lee Farmie22/5/2014 12:36Thu May 22 12:36:46 2014view thread

MenuSearch

Next thread: Cannabis by Usnopani22/9 08:09Wed Sep 22 08:09:37 2021view thread

PlaySound() mmslib does not play existing sound

By Ogburn6521/10 10:13Fri Oct 1 10:13:04 2021

Views: 54

EDIT: Solved. Simply the .wav file was not accepted by Windows. I plucked one of Windows own files and renamed it to what my previous file was called and it plays without problem.

I don't know why this can't play the existing file. Windows gives a chime in that something is wrong but I have no clue what.

I added a check right before to make sure it exists. I have also tried absolute paths.

string wavPath = "c:\\frog.wav";

struct stat stFileInfo;
bool blnReturn = (stat(wavPath.c_str(), &stFileInfo) == 0); //this returns true

FILE* fp = fopen(wavPath.c_str(), "r");
if (fp) {
fclose(fp); //this triggers
}

PlaySound(wavPath.c_str(), NULL, SND_FILENAME | SND_ASYNC); //m_hinstance
//C:\\Users\\Wollan\\My Code\\A\\Debug\\frog.wav
//TEXT("frog.wav")
//TEXT(wavPath.c_str())
//(LPCSTR)"frog.wav¨
The file plays fine in WMP.

MyMileStoneCard

reply to this article | return to the front page

Previous thread: Best Way To Write Professional Essay Writing by TomGiles28/9 11:43Tue Sep 28 11:43:45 2021view thread

Follow us on Twitter @WhyteleafeFC. Visit the Twitter page for the full picture.