Is the PlaySound() function incompatible with MQL5, or are the developers just thick?
The actual bug is in the path, not the slash direction. //Sounds//error_sound.wav resolves to <data folder>\Sounds\Sounds\error_sound.wav , PlaySound() already looks inside the Sounds folder by default, so adding /Sounds/ in front of the filename points one level too deep, into a folder that doesn't exist. Dropping the extra segment is what actually fixes it:
if(!PlaySound("error_sound.wav")) Print("Sound file not found");
Per the PlaySound() docs, the path is already relative to terminal_directory\Sounds, so it should just be the file name (or a real subfolder under Sounds, not Sounds itself again).
- www.mql5.com
Sorry, but why are the simplest of things just impossible. The fact that there are other posts on here saying the same thing - with equally unclear responses - speaks volumes.
The `PlaySound()` method - seriously?
The file path `C:\Users\<user>\AppData\Roaming\MetaQuotes\Terminal\Sounds` is where the sound file is located.
Lets see what the documentation says, shall we?
`The file must be located in terminal_directory\Sounds or its sub-directory. Only WAV files are played.`
`Terminal\Sounds`
Clue is in the directory path, right?
My data is correct, yet MQL5 seems to thing otherwise:
Oh look at that, it's a .wav file, and - well - blow me down with a feather, it's in the correct directory.
I am so tired of ripping my hair out over unclear documentation, I am so tired of these programmes not doing as they're told. This should have taken a few minutes to implement.
Bu oh no, because that would be way to simple, wouldn't it? Why allow your users to spend 3 minutes when you can make them spend 5,000 years only to see the same pointless error message.
I literally don't know why I bother with this POS sometimes, I really don't.
Either the documentation is unclear or wrong, or the developers at Metaquotes Language forgot to implement the backend of the `PlaySound()` method, which is it?.
WHY
DOES
MQL5
NOT
FIND
THE
SOUND
FILE?!