I need C++ code to play sound at particular decibels that are choose by user dynamically.
Asked
Active
Viewed 2,044 times
1
-
1Try this: http://stackoverflow.com/questions/1565439/how-to-playsound-in-c – user2215259 Mar 27 '13 at 11:56
1 Answers
3
This was answered Here
You need to use the absolute path, make sure that you're sending a filename (use SND_FILENAME flag), and pause the program long enough to play the sound file (e.g., use getchar()). You need to link the winmm.lib library in your project settings, and #include windows.h and mmsystem.h in the header.
#include <windows.h>
#include <mmsystem.h>
int main() {
PlaySound((LPCSTR) "C:\\kenny g.WAV", NULL, SND_FILENAME | SND_ASYNC);
getchar();
}

Community
- 1
- 1

user2215259
- 50
- 4