Annotation of quake2/client/snd_loc.h, revision 1.1.1.1

1.1       root        1: // snd_loc.h -- private sound functions
                      2: 
                      3: // !!! if this is changed, the asm code must change !!!
                      4: typedef struct
                      5: {
                      6:        int                     left;
                      7:        int                     right;
                      8: } portable_samplepair_t;
                      9: 
                     10: typedef struct
                     11: {
                     12:        int             length;
                     13:        int             loopstart;
                     14:        int             speed;                  // not needed, because converted on load?
                     15:        int             width;
                     16:        int             stereo;
                     17:        byte            data[1];                // variable sized
                     18: } sfxcache_t;
                     19: 
                     20: typedef struct sfx_s
                     21: {
                     22:        char            name[MAX_QPATH];
                     23:        int                     registration_sequence;
                     24:        sfxcache_t      *cache;
                     25: } sfx_t;
                     26: 
                     27: // a playsound_t will be generated by each call to S_StartSound,
                     28: // when the mixer reaches playsound->begin, the playsound will
                     29: // be assigned to a channel
                     30: typedef struct playsound_s
                     31: {
                     32:        struct playsound_s      *prev, *next;
                     33:        sfx_t           *sfx;
                     34:        float           volume;
                     35:        float           attenuation;
                     36:        int                     entnum;
                     37:        int                     entchannel;
                     38:        qboolean        fixed_origin;   // use origin field instead of entnum's origin
                     39:        vec3_t          origin;
                     40:        unsigned        begin;                  // begin on this sample
                     41: } playsound_t;
                     42: 
                     43: typedef struct
                     44: {
                     45:        int                     channels;
                     46:        int                     samples;                                // mono samples in buffer
                     47:        int                     submission_chunk;               // don't mix less than this #
                     48:        int                     samplepos;                              // in mono samples
                     49:        int                     samplebits;
                     50:        int                     speed;
                     51:        byte            *buffer;
                     52: } dma_t;
                     53: 
                     54: // !!! if this is changed, the asm code must change !!!
                     55: typedef struct
                     56: {
                     57:        sfx_t           *sfx;                   // sfx number
                     58:        int                     leftvol;                // 0-255 volume
                     59:        int                     rightvol;               // 0-255 volume
                     60:        int                     end;                    // end time in global paintsamples
                     61:        int             pos;                    // sample position in sfx
                     62:        int                     looping;                // where to loop, -1 = no looping OBSOLETE?
                     63:        int                     entnum;                 // to allow overriding a specific sound
                     64:        int                     entchannel;             //
                     65:        vec3_t          origin;                 // only use if fixed_origin is set
                     66:        vec_t           dist_mult;              // distance multiplier (attenuation/clipK)
                     67:        int                     master_vol;             // 0-255 master volume
                     68:        qboolean        fixed_origin;   // use origin instead of fetching entnum's origin
                     69:        qboolean        autosound;              // from an entity->sound, cleared each frame
                     70: } channel_t;
                     71: 
                     72: typedef struct
                     73: {
                     74:        int                     rate;
                     75:        int                     width;
                     76:        int                     channels;
                     77:        int                     loopstart;
                     78:        int                     samples;
                     79:        int                     dataofs;                // chunk starts this many bytes from file start
                     80: } wavinfo_t;
                     81: 
                     82: 
                     83: /*
                     84: ====================================================================
                     85: 
                     86:   SYSTEM SPECIFIC FUNCTIONS
                     87: 
                     88: ====================================================================
                     89: */
                     90: 
                     91: // initializes cycling through a DMA buffer and returns information on it
                     92: qboolean SNDDMA_Init(void);
                     93: 
                     94: // gets the current DMA position
                     95: int            SNDDMA_GetDMAPos(void);
                     96: 
                     97: // shutdown the DMA xfer.
                     98: void   SNDDMA_Shutdown(void);
                     99: 
                    100: void   SNDDMA_BeginPainting (void);
                    101: 
                    102: void   SNDDMA_Submit(void);
                    103: 
                    104: //====================================================================
                    105: 
                    106: #define        MAX_CHANNELS                    32
                    107: extern channel_t   channels[MAX_CHANNELS];
                    108: 
                    109: extern int             paintedtime;
                    110: extern int             s_rawend;
                    111: extern vec3_t  listener_origin;
                    112: extern vec3_t  listener_forward;
                    113: extern vec3_t  listener_right;
                    114: extern vec3_t  listener_up;
                    115: extern dma_t   dma;
                    116: extern playsound_t     s_pendingplays;
                    117: 
                    118: #define        MAX_RAW_SAMPLES 8192
                    119: extern portable_samplepair_t   s_rawsamples[MAX_RAW_SAMPLES];
                    120: 
                    121: extern cvar_t  *s_volume;
                    122: extern cvar_t  *s_nosound;
                    123: extern cvar_t  *s_loadas8bit;
                    124: extern cvar_t  *s_khz;
                    125: extern cvar_t  *s_show;
                    126: extern cvar_t  *s_mixahead;
                    127: extern cvar_t  *s_testsound;
                    128: extern cvar_t  *s_primary;
                    129: 
                    130: wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength);
                    131: 
                    132: void S_InitScaletable (void);
                    133: 
                    134: sfxcache_t *S_LoadSound (sfx_t *s);
                    135: 
                    136: void S_IssuePlaysound (playsound_t *ps);
                    137: 
                    138: void S_PaintChannels(int endtime);
                    139: 
                    140: // picks a channel based on priorities, empty slots, number of channels
                    141: channel_t *S_PickChannel(int entnum, int entchannel);
                    142: 
                    143: // spatializes a channel
                    144: void S_Spatialize(channel_t *ch);

unix.superglobalmegacorp.com

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