How to Play Music In C++ (Simple)
Max O'Didily
How to Play Music Using C++ (Simple)
Greetings, today we are here with another C++ tutorial. This C++ tutorial will teach you how to play music using the mmsystem.h and winmm.lib libraries. This will only work with .wav files and can only be used on a Windows OS.
The mmsystem.h and winmm.lib libraries are included with C++ so no new libraries need to be installed. Playing music in C++ can be done with only a few lines of code.
We simply need to just use the PlaySound function. We pass in a file path of the wav file we wish to play. A NULL as we are using a file path to tell the PlaySound function where our wav music file is. We then pass in SND_FILENAME and SND_SYNC. SND_FILENAME is used to tell the PlaySound function that we are using a file path to locate the wav file and SND_SYNC means the thread will wait until the sound has finished before carrying onto the next line of code.
More tutorials will be uploaded covering more about playing music using C++.
Thanks for watching this simple C++ tutorial on how to play music.
Subscribe to keep notified when I upload: https://tinyurl.com/SubMaxODidily
How to Play Music Using C++ (Simple) ... https://www.youtube.com/watch?v=CrPHVvgENq0
6318209 Bytes