Playing sounds with C++?

前端 未结 5 1056
刺人心
刺人心 2021-02-06 16:10

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?

5条回答
  •  庸人自扰
    2021-02-06 16:55

    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++

提交回复
热议问题