PDA

View Full Version : How do I play flac files in C?



dragos240
April 6th, 2010, 02:42 PM
I'm making a simple program that writes the lyrics of "still alive" in a terminal in sync with the song, and so far it's a HUGE SUCCESS..... it's pretty hard to overstate my satisfaction...... anyway, how can I play flac files in C? What headers do I have to import, and how do I signal it to play?

falconindy
April 6th, 2010, 04:06 PM
looks like you'll need to import FLAC/stream_decoder.h (and who knows what else). To play the stream once its decoded, just find the user's audio device (maybe /dev/dsp?) and write to it. Maybe look at MPD's code for ideas?

Laterix
April 6th, 2010, 04:26 PM
I suggest to use gstreamer framework. Makes it a whole lot easier.

schauerlich
April 6th, 2010, 04:31 PM
First result in google search for "flac c library":

http://flac.sourceforge.net/api/index.html