So I got a Monday off for once, but now I'm bored of playing Xbox so I want to program something, anything, but I have no ideas right now. What's something I could whip up a working version in a day? I'm down for whatever.
How about a simple text-controlled music player? Things to do:
1. Pick a format.
2. Find a way (any way) to read and get the sound data from the format.
3. Find a way to send the audio to the speakers.
4. Find a way to control the playback.
5. Make it easy to add more formats.
Don't forget to upload it to the Source Code section.
I will when it's finished! I've been searching for a relatively simple cross-platform way to do it. I started with just Win32 but then stopped myself. Realized I'd like to be able to run it on more than just Windows.
You could use SFML. I haven't used SFML for audio but if it's anything like the rest of SFML, and I'm sure it is, it should be very easy. If you want something more challenging, you could use libav (which is what more or less every open source project uses for handling audio and video file formats and codecs) and libao (an open source audio library). Both are cross-platform C APIs, they don't do as much for you as SFML does, but they're still not very difficult.
I've actually written a C API for libav and libao to be used in a textual music player I was writing in C#, but I don't have the code with me. I moved away from home to go to university and took my PC with me, but I'm back at home for the holidays and couldn't bring it back with me. It was simple but very easy to use and could be easily converted into a C++ class. When I get back in 3 weeks I'll make a C++ version and upload it to the source code section, but I imagine you'll be done by then. Hopefully someone will find it useful.
helios is right, all libav does is handle file formats and codecs. You need a separate library to actually play the audio. I used libAO, but there are others, you could use OpenAL as helios suggested (although AFAIK it's more low-level, so it'll be more difficult and tedious). SFML would probably be the optimal solution; it uses libsndfile to decode the audio data and OpenAL to play it, and gives you a simple C++ interface which is also flexible, although AFAIK it can't do any effects (neither can libAO) but if you get the audio data you can use OpenAL directly to do them yourself.