Sound in C?

Member
Posts: 281
Joined: 2009.04
Post: #1
I've created a 2D rubbishy first project, with - get ready!! - a 2D block with a laser which shoots a blue box. Bored Exciting isn't it? WinkHuhRasp 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? Huh

A laser sound would also be cool, but it only fires when I press space. Cool

Thanks Smile

~ Bring a Pen ~
Quote this message in a reply
Member
Posts: 260
Joined: 2005.05
Post: #2
QuickTime is one option worth mentioning.
Quote this message in a reply
Moderator
Posts: 682
Joined: 2002.11
Post: #3
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.

My web site - Games, music, Python stuff
Quote this message in a reply
Member
Posts: 227
Joined: 2008.08
Post: #4
OpenAL is really easy, check out alure to help you further.
Quote this message in a reply
Member
Posts: 51
Joined: 2009.02
Post: #5
Oddity007 Wrote:OpenAL is really easy, check out alure to help you further.

What is "alure?"
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #6
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.
Quote this message in a reply
Member
Posts: 260
Joined: 2005.05
Post: #7
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!
Quote this message in a reply
Member
Posts: 281
Joined: 2009.04
Post: #8
Thanks everyone, I'm actually using AnotherJake's library, sfxlite. It's working great!Smile

~ Bring a Pen ~
Quote this message in a reply
Post Reply