Sound in C?
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.
Thanks
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.

Thanks
~ Bring a Pen ~
QuickTime is one option worth mentioning.
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
OpenAL is really easy, check out alure to help you further.
Oddity007 Wrote:OpenAL is really easy, check out alure to help you further.
What is "alure?"
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.
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.
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!
Thanks for the tip about the Pangea book!
Thanks everyone, I'm actually using AnotherJake's library, sfxlite. It's working great!
~ Bring a Pen ~

