I have to submit the game as a school team play this time, so I want to insert music into the game. So I searched several places, but it just didn't work (Crying)
There is a function called PlaySound, so I'm trying to use this function, but if I run if the file path is not recognized properly, only the window warning sound appears and nothing is executed.
I tried two ways
(Actually, did they say there's a flag in the back?) Anyway, I changed that and changed the file path. It was originally a Korean title file because it was not recognized as Korean, but I even changed it to arrow like now)
In the end, there was only a window warning.ㅜ<
Is there something wrong with my code? I've been searching several places for hours now, and I've tried many things, but I can't solve it.
(Oh, I didn't hear anything on that code because of NODEFAULT.)
ps. I've seen a lot of posts telling me to use fmod when playing music in the console window, but I excluded it because I'm in the first year of my undergraduate studies, and I don't need to use that much detail.
playsound c++
Try the following:
#include<stdio.h>
#include<Windows.h>
#include<MMSystem.h>
#pragma comment(lib,"Winmm.lib")
int main(void)
{
sndPlaySoundA("C:\\a.wav",SND_ASYNC|SND_NODEFAULT);
// Enter the path name for the music performance C:\~~~. (However, you have to write the reverse slash that separates the folder twice.
// e.g.) C:\test\aa.If wav, "C:\\test\aa.wav"
system("pause");
return 0;
}
Source: http://crasy.tistory.com/12 [HELLO_HELL?]
© 2024 OneMinuteCode. All rights reserved.