Got the day off, what to write?

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.
I like this idea, not something I would have thought of. I'll get right on this after I finish this Euler problem!
Don't forget to upload it to the Source Code section.
make program that can read words that you write XD

make an xmas program for everyone wishing them noel or happy solctice if they are pagan

(its xmas im working on a program i am gonna submit in the lounge as a card fur everyone cos i love them (barring framework))
How's your file reversing assignment coming up, devon?
I put it on hold to experiment with a few new ideas, figured i could learn a bit more other stuff in order to optimize it; am getting distracted though.
Last edited on
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.
Last edited on
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.
Last edited on
I was going to suggest OpenAL, but libao may be a better choice for simple playback (i.e. no audio positioning and the like).
Think I'm gonna use libav for this, it feels more professional than libao and I like the documentation more.
libav is strictly for decoding, AFAIK.
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.
Last edited on
Ah yea I see this now. Looks as if libav sends data to libao to actually play the audio.

I think I'll just use libao also.
Last edited on
Yeah, that's how it works. Once libav has decoded a packet, you just have to pass the packet to libao to play it. It's very easy, the hard (well, tedious) part is decoding the packet with libav.
Topic archived. No new replies allowed.