Hi, I want to play basically all sound files. Like mp3, m4a, m4p, wav, wma, mp2, mpeg... I've used so many options to play mp3s but I can't do it. I've tried mciSendString, PlaySound, ShellExecute, and sndPlaySound. But none of them works. idk if I've done any or all of them correctly of them correctly. Could someone please tell me more ways to do it and give me the code for all of those and for the all one's I've mentioned. (Basically tell me more and correct me if I'm doing the one's below wrong. I want to know as many ways to do it as possible.) But please type the code here and don't give me any websites to go to that explain it because those end up getting me more confused.
I also want to launch other files like programs, Word documents and stuff like that.
Oh and by the way I'm using menuitems to launch the sound so its like:
case IDM_PLAYSOUND:
mciSendString("play C:/Sound.mp3 type mpegvideo Alias mpeg", 0, 0, 0);
return 0;
All of these things compile but it doesn't play the file and I've checked to make sure of this: the file exists, the volume is all the way up, it's not on mute, the directory is correct, the file has sound. But none of these things work! Please give me the code. But please check to make sure it works on Dev-Cpp first (test it) before you give it to me becase the basis of my program is opening external files and playing music and videos. Oh can you also give me the basis code for a video playing a picture viewing program?
I know these are REALLY specific questions but I'm not really that great with programming as I just started learning like 6 months ago. But I can look at things in code and understand them really well. If anyone could help I would REALLLLLLLLYYYYYYY appritiate it!!!!!!! :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, umm... I tried both of the things you guys suggested but neither of them work. And I've tried stuff like this on other computers and it doesn't work there either. Please HELP!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Maybe your sound card is broken? My PlaySound example that plays the system asterisk is about as simple as they come. Are you putting it in one of your menu selections? Are you sure your code is getting there? Are you compiling with -lwinmm? If not, you should get a compile error I would think. I had to link with that library to get access to PlaySound IIRC.
I would suggest posting your compile log and the code that you are compiling that doesn't work for you. And lay off the CAPS LOCK. It doesn't make us think harder.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Maybe you can mess with the options to hide the player. All I did was copy a line of code that I use to launch an html help file and stick in the sound file location instead.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I want to play basically all sound files. Like mp3, m4a, m4p, wav, wma, mp2, mpeg... I've used so many options to play mp3s but I can't do it. I've tried mciSendString, PlaySound, ShellExecute, and sndPlaySound. But none of them works. idk if I've done any or all of them correctly of them correctly. Could someone please tell me more ways to do it and give me the code for all of those and for the all one's I've mentioned. (Basically tell me more and correct me if I'm doing the one's below wrong. I want to know as many ways to do it as possible.) But please type the code here and don't give me any websites to go to that explain it because those end up getting me more confused.
I also want to launch other files like programs, Word documents and stuff like that.
Oh and by the way I'm using menuitems to launch the sound so its like:
case IDM_PLAYSOUND:
mciSendString("play C:/Sound.mp3 type mpegvideo Alias mpeg", 0, 0, 0);
return 0;
All of these things compile but it doesn't play the file and I've checked to make sure of this: the file exists, the volume is all the way up, it's not on mute, the directory is correct, the file has sound. But none of these things work! Please give me the code. But please check to make sure it works on Dev-Cpp first (test it) before you give it to me becase the basis of my program is opening external files and playing music and videos. Oh can you also give me the basis code for a video playing a picture viewing program?
I know these are REALLY specific questions but I'm not really that great with programming as I just started learning like 6 months ago. But I can look at things in code and understand them really well. If anyone could help I would REALLLLLLLLYYYYYYY appritiate it!!!!!!! :)
Hi, umm... I tried both of the things you guys suggested but neither of them work. And I've tried stuff like this on other computers and it doesn't work there either. Please HELP!
Maybe your sound card is broken? My PlaySound example that plays the system asterisk is about as simple as they come. Are you putting it in one of your menu selections? Are you sure your code is getting there? Are you compiling with -lwinmm? If not, you should get a compile error I would think. I had to link with that library to get access to PlaySound IIRC.
I would suggest posting your compile log and the code that you are compiling that doesn't work for you. And lay off the CAPS LOCK. It doesn't make us think harder.
This doesn't quite answer your question, but to test that everything else is OK you could add this:
PlaySound("SystemAsterisk", NULL, SND_ALIAS | SND_ASYNC);
and see if it plays the system beep thingy.
Also I tried your ShellExecute idea and it worked for me (keep in mind that it will spawn an external player rather than just playing the sound):
ShellExecute(NULL, "open", "c:\temp\start.wav", NULL, NULL, SW_SHOWNORMAL);
Maybe you can mess with the options to hide the player. All I did was copy a line of code that I use to launch an html help file and stick in the sound file location instead.