Sound using carbon

Member
Posts: 157
Joined: 2002.12
Post: #1
Hello all, I've been looking for some sample code on sounds for carbon OS X without any luck, any advise would be appreciated.

Thank you all.
Quote this message in a reply
w_reade
Unregistered
 
Post: #2
I found the old Sound Manager functions easiest to deal with - you should be able to find something using them somewhere in the Source Code section (where I learned from), or you could download the source to MAFFia (my uDG entry), which I know has it. It's 3.8 MB, mostly graphics I'm afraid, but sound.c should have most of what you need.

http://www.btinternet.com/~julianreade/maffcode.dmg.sit
Quote this message in a reply
Member
Posts: 157
Joined: 2002.12
Post: #3
Smile Thanks w_reade I have some sounds working!!
I'm working on 3D game using Open GL, I wanted to have more control ever the sound, but for now your suggestion will do just fine.

Once I got something ready to show I'll post it here.

I wish Apple had an easier way to deal with sounds on 3D.
Quote this message in a reply
w_reade
Unregistered
 
Post: #4
My pleasure, glad to help.

Oh yeah - If you're using OpenGL, how about OpenAL for the sound? I've never used it myself but I hear it has a similar interface to OpenGL, and may offer the control you're afterĂ– it might be just what you're looking for.
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #5
I have some code that shows how to pan using Sound Manager.
Quote this message in a reply
Member
Posts: 157
Joined: 2002.12
Post: #6
I'll take a look at OpenAL

Jabber is it possible to take a look at code or a demo?

Thanks again..
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #7
Code:
#define    kFullLeft -kFullVolume
#define kFullRight kFullVolume

OSStatus PanSpeakers(SndChannelPtr theChannel, short panPos)
{
    short        theVolumeLeft, theVolumeRight;
    OSStatus    err;
    SndCommand    theCmd;
    
    theVolumeRight = kFullVolume + panPos;
    theVolumeLeft = kFullVolume - panPos;
    
    theCmd.param1 = 0;
    theCmd.param2 = (long)((long)theVolumeRight << 16L | theVolumeLeft);
    theCmd.cmd = volumeCmd;
    
    err = SndDoImmediate(theChannel, &theCmd);
    return err;
}
Should work with Mac OS 9 and X. panPos should be anywhere between -128 to 128. -128 being full left speaker, 0 begin center and 128 being full right speaker.
Quote this message in a reply
Member
Posts: 157
Joined: 2002.12
Post: #8
Thanks Jabber !
Quote this message in a reply
Member
Posts: 157
Joined: 2002.12
Post: #9
Shock I really wanted to use OpenAL, but My project is carbon CFM and OpenAL is a framework.
I looked at the sample code CallMachOFramework from Apple, but it only works with frameworks in the System/Library/frameworks not on Library/frameworks.

Should I change all my code to work with Mach-0Huh

Any suggestions?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Sound from disk in Carbon? Fenris 6 4,104 Feb 12, 2003 10:43 PM
Last Post: Fenris
  Sound library for Carbon Muffinking 2 3,245 Nov 14, 2002 12:52 PM
Last Post: OneSadCookie