Question:
Using C++ 2010, How can I create a BUTTON that will play an mp3 or wav?
2014-07-02 11:21:39 UTC
Okay, so I am new to C++. (sort of....I did some programming at college about 12 years ago, but that's gone out my head now :D.)

My aim is to create a window with some buttons that will each play a different Wav/ Mp3.
I know how to add buttons, name them and add txt and some code etc. I also know how to make the button play a beep sound... BUT not a wav/ mp3 file.

Anyone with some C++ knowledge able to help me out :)

The Image I have supplied is a test program that I made up, following a tutorial on youtube. There is a "Change" button which changes the text "This is a test". Instead of doing that I want it to open a music file.
Three answers:
?
2014-07-02 15:40:27 UTC
C++2010 doesn't exist? Perhaps you mean C++0x or C++11?



I'm assuming from the Windows-like UI that you're on Windows.

In that case, are you kidding me?



Call PlaySound (). :)

Documentation is here:

http://msdn.microsoft.com/en-us/library/windows/desktop/dd743680(v=vs.85).aspx
jake
2014-07-02 11:37:20 UTC
Open a music file natively (ie. run the file-extension, which results in Windows media player/etc)?

http://www.cplusplus.com/forum/beginner/91617/



Or play the music file in the background based on it's type?

http://www.fmod.org/download/

and a source example: http://stackoverflow.com/questions/428884/how-to-play-mp3-files-in-c?lq=1
Jim
2014-07-02 21:12:49 UTC
he means VC++2010. it exists and costs $800-$10k and uses c++03 standard I suspect.



there is no GUI in C++, and Bjarne Stroustrup (author of the language) has said that in his talks. for this we have GUI Toolkits like MFC, wxwidgets fltk, etc.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...