home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Libraries / BSDSoundLib 1.0.3 / BSDSoundLib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-03  |  4.0 KB  |  134 lines  |  [TEXT/CWIE]

  1. /*
  2.      File:        BSDSoundLib.h
  3.  
  4.      Contains:    BSDSoundLib Headers.
  5.  
  6.      Version:    Technology:    Torture Chamber v1.0
  7.                  Package:    BSDSoundLib v1.0.3
  8.  
  9.      Copyright:    © 1997, BuggySoft™ Development.
  10.                  By Scott Dunbar
  11. */
  12.  
  13. #pragma once
  14.  
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18.  
  19. #ifndef __SOUND__
  20. #include <Sound.h>
  21. #endif
  22.  
  23.     //    Use these with SetChanVol()
  24. #define kMaxLeft        -128    // left channel max; right channel min
  25. #define kMaxRight        128        // left channel min; right channel max
  26. #define kBalanced        0        // left & right channels equal
  27.  
  28. #define kMaxSndChans    25        // Use with InitSoundUtils() for max channels (value can be changed)
  29. #define kNone            -1        // Use with InitSoundUtils() when you don't want channels made for you
  30.  
  31. #define    kNoFreeChannels    -1        // Returned by FindFreeChannel() when none are found
  32.  
  33. #define kLoopingChan    -32657
  34.  
  35. extern short    numChannels;    // total channels allocated; don't edit this!!
  36. extern Boolean    sndChanActive[kMaxSndChans], loopingActive;    // true if sound channel is active
  37.  
  38.  
  39.     //    InitSoundUtils(kMaxSndChans);
  40.     //        Call before using any other routines from this library
  41. extern void InitSoundUtils (short num);
  42.  
  43.     //    DisposeSoundUtils();
  44.     //        Call when finished using this library
  45. extern void DisposeSoundUtils (void);
  46.  
  47.     //    InitSoundChanPtr();
  48.     //        Call to create a new sound channel
  49.     //        Returns a Ptr to the newly created channel.
  50.     //        For use with SndPlay(), mostly. (for me anyways)
  51.     //        Still needs InitSoundUtils() to be called first!!
  52. extern SndChannelPtr InitSoundChanPtr (long init);
  53.  
  54.     //    InitSoundChan();
  55.     //        Call to setup a new channel
  56.     //        Returns the new channel's number (or and error if one occurs).
  57.     //    
  58.     //    Result Codes
  59.     //        mFulErr        -41        Channel can't be created (memory full)
  60.     //
  61.     //    Calling Convertion
  62.     //        chanNum = InitSoundChan(initStero);
  63. extern short InitSoundChan (long init);
  64.  
  65.     //    DisposeSoundChan();
  66.     //        Call to dispose of a certain channel number.
  67. extern void DisposeSoundChan (short chanNum);
  68.  
  69.     //    short chan = FindFreeChannel();
  70.     //        Use this to get the number of a free sound channel
  71. extern short FindFreeChannel (void);
  72.  
  73.     //    PlaySoundChanPtr(chan, snd);
  74.     //        Use this to play a sound channel that you allocated with InitSoundChanPtr().
  75. extern void PlaySoundChanPtr (SndChannelPtr chan, Handle snd);
  76.  
  77.     //    PlaySoundChan(chanNum, snd);
  78.     //        Use this to play a sound on a certain channel
  79.     //    PlaySoundChan(FindFreeChannel(), snd);
  80.     //        Use like that to play on any channel
  81. extern void PlaySoundChan (short chanNum, Handle snd);
  82.  
  83.     //    PlaySnd(snd);
  84.     //        Use this to play a sound asyncrously.
  85. extern void PlaySnd (Handle snd);
  86.  
  87.     //    PlaySndVol(snd, kBalanced);
  88.     //        Use this to play a sound asyncrously at a certain volume.
  89. extern void PlaySndVol (Handle snd, short balance);
  90.  
  91.     //    SilenceChannel(chanNum);
  92.     //        Use this to silence a sound channel
  93. extern void SilenceChannel (short chanNum);
  94.  
  95.     //    SilenceChanPtr(chan);
  96.     //        Use this to silence a sound channel you allocated with InitSoundChanPtr().
  97. extern void SilenceChanPtr (SndChannelPtr chan);
  98.  
  99.     //    SndChanPtrBusy(chan);
  100.     //        Use this to check to see if a channel (allocated with InitSoundChanPtr()) is busy.
  101. extern Boolean SndChanPtrBusy (SndChannelPtr chan);
  102.  
  103.  
  104.     //    SetChaneVol(chanNum, kMaxLeft);
  105.     //    SetChaneVol(chanNum, kBalanced);
  106.     //    SetChaneVol(chanNum, kMaxRight);
  107.     //        Use this to set the volume of a sound channel and for stereo effects (panning...etc.)
  108. extern void SetChanVol (short chanNum, short balance);
  109. extern void SetChanVolLR (short chanNum, short left, short right);
  110.  
  111.     //    BalanceSndChannels();
  112.     //        Use to reset the volume levels on all sound channels
  113. extern void BalanceSndChannels (void);
  114.  
  115.  
  116.     //    InitLoopingSounds();
  117.     //        Call before playing any looping sounds
  118. extern void InitLoopingSounds (void);
  119.  
  120.     //    DisposeLoopingSounds();
  121.     //        Call when finished playing looping sounds
  122. extern void DisposeLoopingSounds (void);
  123.  
  124.     //    PlayLoopingSound(snd);
  125.     //        Use this to start a sound looping
  126. extern void PlayLoopingSound (Handle snd);
  127.  
  128.     //    SilenceLoopingChannel();
  129.     //        Use this to stop a looping sound
  130. extern void SilenceLoopingChannel (void);
  131.  
  132. #ifdef __cplusplus
  133. }
  134. #endif