Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Playing sounds with C++?

Tags:

c++

audio

media

How would i make it so in my program there is a button when that button is clicked i want it to play a .wma file without opening and media player?

like image 658
H4cKL0rD Avatar asked Nov 30 '22 07:11

H4cKL0rD


1 Answers

The C++ standard does not include this functionality. That means it depends on what your system offers.

For Windows, you can try something like PlaySound.

However, you best bet is to use a pre-existing library, like:

  • OpenAL
  • BASS
  • FMOD
  • SDL's: Sound.

Searching for C++ Sound Library brings up a lot of information.

Also, check out these three other SO topics:

  • What Is The Best C++ Sound API For Windows?
  • How to play MP3 files in C?
  • Learning to work with audio in C++
like image 53
GManNickG Avatar answered Dec 01 '22 20:12

GManNickG