Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

sound.h

Go to the documentation of this file.
00001 // Sound Classes    by Alan Baylis 2002
00002 
00003 #ifndef SoundH
00004 #define SoundH
00005 
00006 #include <windows.h>
00007 #include "shared.h"
00008 #include "tll.h"
00009 #include "vector.h"
00010 #include "bass.h"
00011 
00012 // The order of these should match the order in which the samples are loaded
00013 enum {sample_gunshot = 1};
00014 // The order of these should match the order in which the channels are created
00015 enum {channel_gunshot = 1};
00016 
00017 class SOUND_SAMPLE
00018 {
00019     public:
00020         SOUND_SAMPLE(){};
00021         ~SOUND_SAMPLE(){};
00022 
00023         int Compare(const SOUND_SAMPLE& Sample);
00024         int GetMyPosition() const {return linkPosition;}
00025         void SetMyPosition(int newPosition) {linkPosition = newPosition;}
00026         int linkPosition;
00027 
00028         HSAMPLE hSample;             // the sample's handle
00029         char name[32];               // filename
00030         int max;                     // number of simultaneous playbacks
00031         DWORD flags;                 // option flags
00032         DWORD volume;
00033         float mindist;
00034         float maxdist;
00035 };
00036 
00037 class SOUND_CHANNEL
00038 {
00039     public:
00040         SOUND_CHANNEL(){};
00041         ~SOUND_CHANNEL(){};
00042 
00043         int Compare(const SOUND_CHANNEL& Channel);
00044         int GetMyPosition() const {return linkPosition;}
00045         void SetMyPosition(int newPosition) {linkPosition = newPosition;}
00046         int linkPosition;
00047 
00048         HCHANNEL hChannel;             // the channel's handle
00049         HSAMPLE hSample;             // handle of the sample associated with this channel
00050         BASS_3DVECTOR position;      // position
00051         BASS_3DVECTOR orientation;   // orientation
00052         BASS_3DVECTOR velocity;         // velocity
00053         int direction;                 // direction of the channel
00054         bool looped;                 // flag for looped sample
00055         bool intermittent;           // flag for intermittent sound
00056         bool random;                 // random intermittent sound
00057         unsigned int lowerrand;      // minimum repeat time
00058         unsigned int upperrand;      // maximum repeat time
00059         unsigned int interval;       // time between plays
00060         unsigned int idEvent;        // unique timer id (set this to the channel number)
00061 };
00062 
00063 void InitializeBASS();
00064 void LoadSample(SOUND_SAMPLE* Sample);
00065 void CreateChannel(int SampleNumber);
00066 void UpdateListener();
00067 void UpdateChannel(int ChannelNumber, VECTOR* Position, VECTOR* Orientation, VECTOR* Velocity);
00068 void PlayChannel(int ChannelNumber);
00069 VOID CALLBACK SoundTimerProc(HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime);
00070 void CreateSounds();
00071 BOOL CALLBACK devicedialogproc(HWND h,UINT m,WPARAM w,LPARAM l);
00072 
00073 #endif

Generated on Fri Dec 23 05:19:55 2005 for Particles by doxygen1.2.15