Reputation: 71
No compiler issues, No linker issues, all that happens when this program is ran the PlaySound function returns FALSE and doesn't play any sound at all,
https://media.discordapp.net/attachments/670195970226651140/852503334505676820/unknown.png
As seen in the figure image above the directory is perfectly fine, I've ran this program on both Release, and Debug, Any help would be very much appreciated, the code is below,
#include <iostream>
#include <Windows.h>
#include <fstream>
#pragma comment(lib, "winmm.lib")
int main()
{
std::ifstream ThisFile;
ThisFile.open("S:\\Visual Studio Projects\\KB\\A\\Test.wav");
if (ThisFile.is_open())
{
std::cout << "std::ifstream Success!" << std::endl;
}
else
{
std::cout << "std::ifstream Failure!" << std::endl;
}
std::cout << "Begin Sound" << std::endl;
BOOL PlaySoundReturn = PlaySound(L"S:\\Visual Studio Projects\\KB\\A\\Test.wav", NULL, SND_SYNC | SND_FILENAME | SND_NODEFAULT);
if (PlaySoundReturn == 0)
{
std::cout << "Failed!" << std::endl;
}
else
{
std::cout << "Success!" << std::endl;
}
std::cin.get();
return 0;
}
Upvotes: 0
Views: 288
Reputation: 71
Sorry! It's come to my attention all the WAVE files I was testing were for some reason invalid and unreadable, even though I could listen to them with other media software,
Upvotes: 1