Annotation of quake1/sound.h, revision 1.1.1.2

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);
1.1.1.2 ! root       74: void S_Startup (void);
1.1       root       75: void S_Shutdown (void);
                     76: void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol,  float attenuation);
                     77: void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
                     78: void S_StopSound (int entnum, int entchannel);
1.1.1.2 ! root       79: void S_StopAllSounds(qboolean clear);
1.1       root       80: void S_ClearBuffer (void);
                     81: void S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up);
                     82: void S_ExtraUpdate (void);
                     83: 
                     84: sfx_t *S_PrecacheSound (char *sample);
                     85: void S_TouchSound (char *sample);
1.1.1.2 ! root       86: void S_ClearPrecache (void);
        !            87: void S_BeginPrecaching (void);
        !            88: void S_EndPrecaching (void);
1.1       root       89: void S_PaintChannels(int endtime);
                     90: void S_InitPaintChannels (void);
                     91: 
                     92: // picks a channel based on priorities, empty slots, number of channels
                     93: channel_t *SND_PickChannel(int entnum, int entchannel);
                     94: 
                     95: // spatializes a channel
                     96: void SND_Spatialize(channel_t *ch);
                     97: 
                     98: // initializes cycling through a DMA buffer and returns information on it
                     99: qboolean SNDDMA_Init(void);
                    100: 
                    101: // gets the current DMA position
                    102: int SNDDMA_GetDMAPos(void);
                    103: 
                    104: // shutdown the DMA xfer.
                    105: void SNDDMA_Shutdown(void);
                    106: 
                    107: // ====================================================================
                    108: // User-setable variables
                    109: // ====================================================================
                    110: 
                    111: #define        MAX_CHANNELS                    128
                    112: #define        MAX_DYNAMIC_CHANNELS    8
                    113: 
                    114: 
                    115: extern channel_t   channels[MAX_CHANNELS];
                    116: // 0 to MAX_DYNAMIC_CHANNELS-1 = normal entity sounds
                    117: // MAX_DYNAMIC_CHANNELS to MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS -1 = water, etc
                    118: // MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS to total_channels = static sounds
                    119: 
                    120: extern int                     total_channels;
                    121: 
                    122: //
                    123: // Fake dma is a synchronous faking of the DMA progress used for
                    124: // isolating performance in the renderer.  The fakedma_updates is
                    125: // number of times S_Update() is called per second.
                    126: //
                    127: 
                    128: extern qboolean                fakedma;
                    129: extern int                     fakedma_updates;
                    130: extern int             paintedtime;
                    131: extern vec3_t listener_origin;
                    132: extern vec3_t listener_forward;
                    133: extern vec3_t listener_right;
                    134: extern vec3_t listener_up;
                    135: extern volatile dma_t *shm;
1.1.1.2 ! root      136: extern volatile dma_t sn;
1.1       root      137: extern vec_t sound_nominal_clip_dist;
                    138: 
                    139: extern cvar_t loadas8bit;
                    140: extern cvar_t bgmvolume;
                    141: extern cvar_t volume;
                    142: 
1.1.1.2 ! root      143: extern qboolean        snd_initialized;
        !           144: 
        !           145: extern int             snd_blocked;
        !           146: 
1.1       root      147: void S_LocalSound (char *s);
                    148: sfxcache_t *S_LoadSound (sfx_t *s);
                    149: 
                    150: wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength);
                    151: 
                    152: void SND_InitScaletable (void);
1.1.1.2 ! root      153: void SNDDMA_Submit(void);
        !           154: 
        !           155: void S_AmbientOff (void);
        !           156: void S_AmbientOn (void);
1.1       root      157: 
                    158: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.