Sound from disk in Carbon?

Oldtimer
Posts: 834
Joined: 2002.09
Post: #1
Gah... Sound programming is obviously not for me. Could anyone help me out with these questions?

Is there a way to play a sound loaded from disk in Carbon (I guess this has something to do with Get1Resource) and not having to store all the sounds in one resource file? (I would like to store all the sounds for one level in one file (preferrably packed together with the other files, but that's another worry. If anyone has suggestions towards this, they are welcome.)

Is it too slow to use Quicktime MP3:s for every sound effect in the game? (I would think so...)

What's a good strategy for playing sound effects in a game? Any tips, give them to me! Smile
Quote this message in a reply
Apprentice
Posts: 19
Joined: 2002.12
Post: #2
I like SDL in combination with SDL_mixer. I believe you can initialize just the audio port of SDL if you don't want the video portions.

What about OpenAL? I haven't looked into it. But have heard good things about it from others.

belboz@cinci.rr.com
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
If you want to load sound resources from different resource files, you just need to change the current resource file as you're loading the resources.

I don't remember what the functions are called, but you should be able to find out by looking at Resources.h or the Resource Manager documentation...

Of course, you shouldn't be using resources at all...
Quote this message in a reply
Apprentice
Posts: 19
Joined: 2002.12
Post: #4
There is also mikmod

http://www.mikmod.org/

There is an OS X port of it. I believe it supports carbon.

belboz@cinci.rr.com
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #5
Quote:Originally posted by OneSadCookie
Of course, you shouldn't be using resources at all...


No, which is why I'm asking for alternatives. Smile I'm inclined towards SDL, though... I'll look into it, thanks!
Quote this message in a reply
Member
Posts: 111
Joined: 2002.06
Post: #6
Quote:Originally posted by Fenris
Is there a way to play a sound loaded from disk in Carbon (I guess this has something to do with Get1Resource) and not having to store all the sounds in one resource file? (I would like to store all the sounds for one level in one file (preferrably packed together with the other files, but that's another worry. If anyone has suggestions towards this, they are welcome.)

What's a good strategy for playing sound effects in a game? Any tips, give them to me! Smile

If you use bundles, it's easy to have one resource file per level so you don't have to store all the sounds in one file. In Project Builder, you add the resource files to your project, then move the files into the Resource Manager Resources section (you do this in your build settings). I haven't made bundles with CodeWarrior, but the process is probably similar. As OneSadCookie said, you change the current resource file to load the new sounds you want to play.

For sound effects, QuickTime and snd resources are the easiest to program. I would use snd resources for sound effects and QuickTime for music.

Mark Szymczyk
http://www.meandmark.com
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #7
Hi Mark!

Yep, I went with your book - I always keep it around - QuickTime all the way. (For now, at least) Thanks, though!
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Best/simplest way to load data from disk NCarter 9 3,591 Aug 8, 2003 10:12 AM
Last Post: Jesse
  Sound using carbon NYGhost 8 4,477 Dec 10, 2002 11:37 PM
Last Post: NYGhost
  Sound library for Carbon Muffinking 2 3,269 Nov 14, 2002 12:52 PM
Last Post: OneSadCookie