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: Idle Basketball by Julia65Today 20:40Today at 20:40:33view thread

Oldest article: Kingstonian home sat by Clive15/7/2014 18:58Tue Jul 15 18:58:15 2014view thread

MenuSearch

Reply to "PlaySound() mmslib does not play existing sound"

You must log in or register before you can post an article

return to the front page

PlaySound() mmslib does not play existing sound

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

Views: 76

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

  • Collapse threadPlaySound() mmslib does not play existing sound by Ogburn6521/10/2021 10:13Fri Oct 1 10:13:04 2021view thread

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