How to play MP3 files in C?

前端 未结 10 1445
遇见更好的自我
遇见更好的自我 2020-12-01 01:15

I\'m looking for the easiest way to play a MP3 file in C. I am looking for either a library, in which I could just call the function on the filename, or an executable that w

相关标签:
10条回答
  • 2020-12-01 01:31

    If you are on Windows or OSX, I recommend BASS (http://www.un4seen.com/bass.html)

    You can download the library and look at code sample to get started. The "contest" example in C directory is a good start point.

    0 讨论(0)
  • 2020-12-01 01:31

    alternatively something someone's already written that will just run and quit.

    You can use mpg123 (or the fixed point port of it, mpg321)

    mpg123 <mp3file>
    

    will play an mp3 file and quit.

    0 讨论(0)
  • 2020-12-01 01:32

    The BASS DLL is really easy to use and will probably do what you need. It is only free for non-commercial use though.

    If you need more control, you will need a codec (I prefer libMad) and some sound output API like DirectSound on Windows or ALSA or Linux (or whatever Linux guys use for sound this week)

    0 讨论(0)
  • 2020-12-01 01:36

    On Win32, you don't need any library. Use standard Win32 api (mp3 is native)

    See on Adv. Win32 api newsgroup : news://comp.os.ms-windows.programmer.win32 where it 's a FAQ.

    0 讨论(0)
提交回复
热议问题