Sound in C? - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Sound in C? (/thread-1310.html)
Sound in C? - mikey - May 12, 2009 01:21 PM
I've created a 2D rubbishy first project, with - get ready!! - a 2D block with a laser which shoots a blue box. Exciting isn't it? Anyhoo, I thought, hmmm, how could I add sounds?
If I compile a MIDI/MP3/MOV music track, how do I add this as background music in my game, written in C? I've heard of OpenAL, is this right for a novice?
A laser sound would also be cool, but it only fires when I press space.
Sound in C? - Ingemar - May 12, 2009 02:09 PM
QuickTime is one option worth mentioning.
Sound in C? - stevejohnson - May 12, 2009 02:13 PM
I don't know anything about it, but OpenAL seems to be a popular choice among game developers. You can also look into SDL's sound features.
Sound in C? - Oddity007 - May 12, 2009 03:19 PM
OpenAL is really easy, check out alure to help you further.
Sound in C? - Nosredna - May 13, 2009 08:13 AM
Oddity007 Wrote:OpenAL is really easy, check out alure to help you further.
What is "alure?"
Sound in C? - AnotherJake - May 13, 2009 09:02 AM
Allure is a sort of helper library for OpenAL. I didn't even know it worked on Mac... 'course I hadn't looked very closely at it.
Anyway, I disagree that OpenAL is "really" easy. I'd say it's a heck of a lot easier than other options for sound, but still, it isn't a no-brainer, and I think there could be a better solution.
@ mikey: As has already been suggested, OpenAL is probably your best bet. Pangea offers a free book which has a little section on OpenAL. You might find some other useful info in there too.
Sound in C? - Ingemar - May 27, 2009 11:24 AM
As AnotherJake said, OpenAL isn't really "really easy". It is managable, but a big problem for beginners is that it can't load sound files, so you must add that. ALUT fixes it, but Apple's treatment of ALUT is less that impressive. One possibility is to grab the WAV loader from FreeALUT and use that. Once you have that rolling, OpenAL is pretty nice.
Thanks for the tip about the Pangea book!
Sound in C? - mikey - May 27, 2009 12:44 PM
Thanks everyone, I'm actually using AnotherJake's library, sfxlite. It's working great!