home *** CD-ROM | disk | FTP | other *** search
- /*
- File: BSDSoundLib.h
-
- Contains: BSDSoundLib Headers.
-
- Version: Technology: Torture Chamber v1.0
- Package: BSDSoundLib v1.0.3
-
- Copyright: © 1997, BuggySoft™ Development.
- By Scott Dunbar
- */
-
- #pragma once
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #ifndef __SOUND__
- #include <Sound.h>
- #endif
-
- // Use these with SetChanVol()
- #define kMaxLeft -128 // left channel max; right channel min
- #define kMaxRight 128 // left channel min; right channel max
- #define kBalanced 0 // left & right channels equal
-
- #define kMaxSndChans 25 // Use with InitSoundUtils() for max channels (value can be changed)
- #define kNone -1 // Use with InitSoundUtils() when you don't want channels made for you
-
- #define kNoFreeChannels -1 // Returned by FindFreeChannel() when none are found
-
- #define kLoopingChan -32657
-
- extern short numChannels; // total channels allocated; don't edit this!!
- extern Boolean sndChanActive[kMaxSndChans], loopingActive; // true if sound channel is active
-
-
- // InitSoundUtils(kMaxSndChans);
- // Call before using any other routines from this library
- extern void InitSoundUtils (short num);
-
- // DisposeSoundUtils();
- // Call when finished using this library
- extern void DisposeSoundUtils (void);
-
- // InitSoundChanPtr();
- // Call to create a new sound channel
- // Returns a Ptr to the newly created channel.
- // For use with SndPlay(), mostly. (for me anyways)
- // Still needs InitSoundUtils() to be called first!!
- extern SndChannelPtr InitSoundChanPtr (long init);
-
- // InitSoundChan();
- // Call to setup a new channel
- // Returns the new channel's number (or and error if one occurs).
- //
- // Result Codes
- // mFulErr -41 Channel can't be created (memory full)
- //
- // Calling Convertion
- // chanNum = InitSoundChan(initStero);
- extern short InitSoundChan (long init);
-
- // DisposeSoundChan();
- // Call to dispose of a certain channel number.
- extern void DisposeSoundChan (short chanNum);
-
- // short chan = FindFreeChannel();
- // Use this to get the number of a free sound channel
- extern short FindFreeChannel (void);
-
- // PlaySoundChanPtr(chan, snd);
- // Use this to play a sound channel that you allocated with InitSoundChanPtr().
- extern void PlaySoundChanPtr (SndChannelPtr chan, Handle snd);
-
- // PlaySoundChan(chanNum, snd);
- // Use this to play a sound on a certain channel
- // PlaySoundChan(FindFreeChannel(), snd);
- // Use like that to play on any channel
- extern void PlaySoundChan (short chanNum, Handle snd);
-
- // PlaySnd(snd);
- // Use this to play a sound asyncrously.
- extern void PlaySnd (Handle snd);
-
- // PlaySndVol(snd, kBalanced);
- // Use this to play a sound asyncrously at a certain volume.
- extern void PlaySndVol (Handle snd, short balance);
-
- // SilenceChannel(chanNum);
- // Use this to silence a sound channel
- extern void SilenceChannel (short chanNum);
-
- // SilenceChanPtr(chan);
- // Use this to silence a sound channel you allocated with InitSoundChanPtr().
- extern void SilenceChanPtr (SndChannelPtr chan);
-
- // SndChanPtrBusy(chan);
- // Use this to check to see if a channel (allocated with InitSoundChanPtr()) is busy.
- extern Boolean SndChanPtrBusy (SndChannelPtr chan);
-
-
- // SetChaneVol(chanNum, kMaxLeft);
- // SetChaneVol(chanNum, kBalanced);
- // SetChaneVol(chanNum, kMaxRight);
- // Use this to set the volume of a sound channel and for stereo effects (panning...etc.)
- extern void SetChanVol (short chanNum, short balance);
- extern void SetChanVolLR (short chanNum, short left, short right);
-
- // BalanceSndChannels();
- // Use to reset the volume levels on all sound channels
- extern void BalanceSndChannels (void);
-
-
- // InitLoopingSounds();
- // Call before playing any looping sounds
- extern void InitLoopingSounds (void);
-
- // DisposeLoopingSounds();
- // Call when finished playing looping sounds
- extern void DisposeLoopingSounds (void);
-
- // PlayLoopingSound(snd);
- // Use this to start a sound looping
- extern void PlayLoopingSound (Handle snd);
-
- // SilenceLoopingChannel();
- // Use this to stop a looping sound
- extern void SilenceLoopingChannel (void);
-
- #ifdef __cplusplus
- }
- #endif