Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
GameHeaders/GameSounds.h
#pragma once |
#include <Sound.h> |
#define kNumChan 4 |
enum { |
kWakeUpSnd = 128, |
kFireSnd = 129, |
kRiffSnd = 130, |
kBadFireSnd = 131, |
kExplode = 132, |
kYouLose = 133, |
kYouWin = 134, |
kIncidental1 = 135, |
kEngineStart = 136, |
kIncidental2 = 137, |
kEngineLoop = 138, |
kIncidental3 = 139, |
kIncidental4 = 140, |
kIncidental5 = 141 |
}; |
enum { |
kStdPriority = 0x01, |
kMedPriority = 0x05, |
kHighPriority = 0x0A |
}; |
enum { |
kMusicChan, |
kShotChan, |
kExplosionChan, |
kFlightChan |
}; |
typedef struct { |
SndChannelPtr channel; |
short priority; |
Handle sndHandle; |
} SndChanInfo; |
/* call this when your program starts */ |
void InitSounds(Str255 sndFileName); |
/* call this from your main loop */ |
void SoundKeeper(); |
/* use this to play sounds */ |
OSErr PlaySndAsynchChannel(short sndID, short chanNum, short priority); |
/* call this when your program quits */ |
void FreeSounds(void); |
/* misc routines used internally */ |
pascal void SndDoneProc(SndChannelPtr channel, SndCommand *cmd); |
Handle GetSound(short sndID); |
/* private global variables */ |
extern SndChanInfo gChan[kNumChan]; |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14