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: How to choose a quality cbd vaping? by NickNicks39Today 17:06Today at 17:06:24view thread

Oldest article: Opening hours by WFC2/12/2014 17:09Tue Dec 2 17:09:32 2014view thread

MenuSearch

Next thread: Technology by Salman1/10/2021 14:15Fri Oct 1 14:15:16 2021view thread

PlaySound() mmslib does not play existing sound

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

Views: 100

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/2021 11:43Tue Sep 28 11:43:45 2021view thread

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