Search code examples
c++audiowavplaysound

can't play audio file in c++ using PlaySound


I have downloaded a .wav file and saved it in the same folder as my main .cpp file.

I've included:

#include <Windows.h>
#include <MMSystem.h>
#include <iostream>

and this is the command I'm trying to use to play the sound in the background:

PlaySound(TEXT("BgSound.wav"),NULL, SND_FILENAME | SND_LOOP | SND_ASYNC);

I put this line in main and everytime I run the program it just plays the windows default "ting" sound when something doesn't work...

does anyone know what is the problem and how to solve it?


Solution

  • The problem was that I didn't convert properly the .mp3 file to .wav

    edit : I converted the mp3 file through a website and not manually(by changing the end)