|
|
1.1 ! root 1: // sound.h -- client sound i/o functions ! 2: ! 3: #ifndef __SOUND__ ! 4: #define __SOUND__ ! 5: ! 6: #define DEFAULT_SOUND_PACKET_VOLUME 255 ! 7: #define DEFAULT_SOUND_PACKET_ATTENUATION 1.0 ! 8: ! 9: // !!! if this is changed, it much be changed in asm_i386.h too !!! ! 10: typedef struct ! 11: { ! 12: int left; ! 13: int right; ! 14: } portable_samplepair_t; ! 15: ! 16: typedef struct sfx_s ! 17: { ! 18: char name[MAX_QPATH]; ! 19: cache_user_t cache; ! 20: } sfx_t; ! 21: ! 22: // !!! if this is changed, it much be changed in asm_i386.h too !!! ! 23: typedef struct ! 24: { ! 25: int length; ! 26: int loopstart; ! 27: int speed; ! 28: int width; ! 29: int stereo; ! 30: byte data[1]; // variable sized ! 31: } sfxcache_t; ! 32: ! 33: typedef struct ! 34: { ! 35: qboolean gamealive; ! 36: qboolean soundalive; ! 37: qboolean splitbuffer; ! 38: int channels; ! 39: int samples; // mono samples in buffer ! 40: int submission_chunk; // don't mix less than this # ! 41: int samplepos; // in mono samples ! 42: int samplebits; ! 43: int speed; ! 44: unsigned char *buffer; ! 45: } dma_t; ! 46: ! 47: // !!! if this is changed, it much be changed in asm_i386.h too !!! ! 48: typedef struct ! 49: { ! 50: sfx_t *sfx; // sfx number ! 51: int leftvol; // 0-255 volume ! 52: int rightvol; // 0-255 volume ! 53: int end; // end time in global paintsamples ! 54: int pos; // sample position in sfx ! 55: int looping; // where to loop, -1 = no looping ! 56: int entnum; // to allow overriding a specific sound ! 57: int entchannel; // ! 58: vec3_t origin; // origin of sound effect ! 59: vec_t dist_mult; // distance multiplier (attenuation/clipK) ! 60: int master_vol; // 0-255 master volume ! 61: } channel_t; ! 62: ! 63: typedef struct ! 64: { ! 65: int rate; ! 66: int width; ! 67: int channels; ! 68: int loopstart; ! 69: int samples; ! 70: int dataofs; // chunk starts this many bytes from file start ! 71: } wavinfo_t; ! 72: ! 73: void S_Init (void); ! 74: void S_Shutdown (void); ! 75: void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation); ! 76: void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation); ! 77: void S_StopSound (int entnum, int entchannel); ! 78: void S_StopAllSounds(void); ! 79: void S_ClearBuffer (void); ! 80: void S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up); ! 81: void S_ExtraUpdate (void); ! 82: ! 83: sfx_t *S_PrecacheSound (char *sample); ! 84: void S_TouchSound (char *sample); ! 85: ! 86: void S_PaintChannels(int endtime); ! 87: void S_InitPaintChannels (void); ! 88: ! 89: // picks a channel based on priorities, empty slots, number of channels ! 90: channel_t *SND_PickChannel(int entnum, int entchannel); ! 91: ! 92: // spatializes a channel ! 93: void SND_Spatialize(channel_t *ch); ! 94: ! 95: // initializes cycling through a DMA buffer and returns information on it ! 96: qboolean SNDDMA_Init(void); ! 97: ! 98: // gets the current DMA position ! 99: int SNDDMA_GetDMAPos(void); ! 100: ! 101: // shutdown the DMA xfer. ! 102: void SNDDMA_Shutdown(void); ! 103: ! 104: // ==================================================================== ! 105: // User-setable variables ! 106: // ==================================================================== ! 107: ! 108: #define MAX_CHANNELS 128 ! 109: #define MAX_DYNAMIC_CHANNELS 8 ! 110: ! 111: ! 112: extern channel_t channels[MAX_CHANNELS]; ! 113: // 0 to MAX_DYNAMIC_CHANNELS-1 = normal entity sounds ! 114: // MAX_DYNAMIC_CHANNELS to MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS -1 = water, etc ! 115: // MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS to total_channels = static sounds ! 116: ! 117: extern int total_channels; ! 118: ! 119: // ! 120: // Fake dma is a synchronous faking of the DMA progress used for ! 121: // isolating performance in the renderer. The fakedma_updates is ! 122: // number of times S_Update() is called per second. ! 123: // ! 124: ! 125: extern qboolean fakedma; ! 126: extern int fakedma_updates; ! 127: extern int paintedtime; ! 128: extern vec3_t listener_origin; ! 129: extern vec3_t listener_forward; ! 130: extern vec3_t listener_right; ! 131: extern vec3_t listener_up; ! 132: extern volatile dma_t *shm; ! 133: extern vec_t sound_nominal_clip_dist; ! 134: ! 135: extern cvar_t loadas8bit; ! 136: extern cvar_t bgmvolume; ! 137: extern cvar_t volume; ! 138: ! 139: void S_LocalSound (char *s); ! 140: sfxcache_t *S_LoadSound (sfx_t *s); ! 141: ! 142: void S_StartNoiseTrack (char *name); ! 143: wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength); ! 144: ! 145: void SND_InitScaletable (void); ! 146: ! 147: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.