doom

a minimalistic implementation of doom
git clone git://ssnf.xyz/doom
Log | Files | Refs

sounds.h (5239B)


      1 #define S_MAX_VOLUME    127
      2 #define S_CLIPPING_DIST (1200*0x10000)
      3 #define S_CLOSE_DIST    (200*0x10000)
      4 #define S_ATTENUATOR    ((S_CLIPPING_DIST-S_CLOSE_DIST)>>FRACBITS)
      5 #define NORM_PITCH      128
      6 #define NORM_PRIORITY   64
      7 #define NORM_VOLUME     snd_MaxVolume
      8 #define S_PITCH_PERTURB 1
      9 #define NORM_SEP        128
     10 #define S_STEREO_SWING  (96*0x10000)
     11 #define S_IFRACVOL      30
     12 #define NA              0
     13 #define S_NUMCHANNELS   2
     14 #define FREQ_LOW		0x40
     15 #define FREQ_NORM		0x80
     16 #define FREQ_HIGH		0xff
     17 typedef struct MusicInfo MusicInfo;
     18 typedef struct SfxInfo   SfxInfo;
     19 typedef struct Channel   Channel;
     20 typedef enum MusicEnum   MusicEnum;
     21 typedef enum SfxEnum     SfxEnum;
     22 struct MusicInfo {
     23 	char* name; /*up to 6 chars*/
     24 	long  lumpnum;
     25 	void* data;
     26 	long  handle;
     27 };
     28 struct SfxInfo {
     29 	char*    name; /*up to 6*/
     30 	int      singularity;
     31 	int      priority;
     32 	SfxInfo* link;
     33 	int      pitch;
     34 	int      volume;
     35 	void*    data;
     36 	int      usefulness;
     37 	int      lumpnum;		
     38 };
     39 struct Channel {
     40 	SfxInfo*   sfxinfo;
     41 	void*      origin;
     42 	int        handle;
     43 };
     44 enum {
     45 	Music,
     46 	Sfx,
     47 	SfxLink
     48 };
     49 enum {
     50 	PC    = 1,
     51 	Adlib = 2,
     52 	SB    = 4,
     53 	Midi  = 8
     54 };
     55 enum {
     56 	sfxThrowOut = -1,
     57 	sfxNotUsed  = 0
     58 };
     59 void        S_Init(int, int);
     60 void        S_Start();
     61 void        S_Pause();
     62 void        S_Resume();
     63 void        S_SetMusicVolume(int volume);
     64 void        S_SetSfxVolume(int volume);
     65 extern void S_StartSound(void* origin, int sound_id);
     66 extern void S_StartSoundAtVolume(void* origin, int sound_id, int volume);
     67 extern void S_StopSound(void* origin);
     68 extern void S_StartMusic(int music_id);
     69 extern void S_ChangeMusic(int music_id, int looping);
     70 extern void S_StopMusic();
     71 extern void S_UpdateSounds(void* listener);
     72 void        I_SetMusicVolume(int volume);
     73 void        I_SetSfxVolume(int volume);
     74 void        I_PauseSong(int handle);
     75 void        I_ResumeSong(int handle);
     76 void        I_PlaySong(int handle, int looping);
     77 void        I_StopSong(int handle);
     78 int         I_RegisterSong(void *data);
     79 void        I_UnRegisterSong(int handle);
     80 int         I_IsSongPlaying(int handle);
     81 void        I_SetChannels(int channels);
     82 int         I_GetSfxLumpNum (SfxInfo*);
     83 int         I_StartSound(int id, void* data, int vol, int sep, int pitch, int priority);
     84 void        I_UpdateSoundParams(int handle, int vol, int sep, int pitch);
     85 void        I_StopSound(int handle);
     86 int         I_IsSoundPlaying(int handle);
     87 enum MusicEnum {
     88     mus_None,
     89     mus_e1m1,
     90     mus_e1m2,
     91     mus_e1m3,
     92     mus_e1m4,
     93     mus_e1m5,
     94     mus_e1m6,
     95     mus_e1m7,
     96     mus_e1m8,
     97     mus_e1m9,
     98     mus_e2m1,
     99     mus_e2m2,
    100     mus_e2m3,
    101     mus_e2m4,
    102     mus_e2m5,
    103     mus_e2m6,
    104     mus_e2m7,
    105     mus_e2m8,
    106     mus_e2m9,
    107     mus_e3m1,
    108     mus_e3m2,
    109     mus_e3m3,
    110     mus_e3m4,
    111     mus_e3m5,
    112     mus_e3m6,
    113     mus_e3m7,
    114     mus_e3m8,
    115     mus_e3m9,
    116     mus_inter,
    117     mus_intro,
    118     mus_bunny,
    119     mus_victor,
    120     mus_introa,
    121     mus_runnin,
    122     mus_stalks,
    123     mus_countd,
    124     mus_betwee,
    125     mus_doom,
    126     mus_the_da,
    127     mus_shawn,
    128     mus_ddtblu,
    129     mus_in_cit,
    130     mus_dead,
    131     mus_stlks2,
    132     mus_theda2,
    133     mus_doom2,
    134     mus_ddtbl2,
    135     mus_runni2,
    136     mus_dead2,
    137     mus_stlks3,
    138     mus_romero,
    139     mus_shawn2,
    140     mus_messag,
    141     mus_count2,
    142     mus_ddtbl3,
    143     mus_ampie,
    144     mus_theda3,
    145     mus_adrian,
    146     mus_messg2,
    147     mus_romer2,
    148     mus_tense,
    149     mus_shawn3,
    150     mus_openin,
    151     mus_evil,
    152     mus_ultima,
    153     mus_read_m,
    154     mus_dm2ttl,
    155     mus_dm2int,
    156     MUS_COUNT
    157 };
    158 enum SfxEnum {
    159     sfx_None,
    160     sfx_pistol,
    161     sfx_shotgn,
    162     sfx_sgcock,
    163     sfx_dshtgn,
    164     sfx_dbopn,
    165     sfx_dbcls,
    166     sfx_dbload,
    167     sfx_plasma,
    168     sfx_bfg,
    169     sfx_sawup,
    170     sfx_sawidl,
    171     sfx_sawful,
    172     sfx_sawhit,
    173     sfx_rlaunc,
    174     sfx_rxplod,
    175     sfx_firsht,
    176     sfx_firxpl,
    177     sfx_pstart,
    178     sfx_pstop,
    179     sfx_doropn,
    180     sfx_dorcls,
    181     sfx_stnmov,
    182     sfx_swtchn,
    183     sfx_swtchx,
    184     sfx_plpain,
    185     sfx_dmpain,
    186     sfx_popain,
    187     sfx_vipain,
    188     sfx_mnpain,
    189     sfx_pepain,
    190     sfx_slop,
    191     sfx_itemup,
    192     sfx_wpnup,
    193     sfx_oof,
    194     sfx_telept,
    195     sfx_posit1,
    196     sfx_posit2,
    197     sfx_posit3,
    198     sfx_bgsit1,
    199     sfx_bgsit2,
    200     sfx_sgtsit,
    201     sfx_cacsit,
    202     sfx_brssit,
    203     sfx_cybsit,
    204     sfx_spisit,
    205     sfx_bspsit,
    206     sfx_kntsit,
    207     sfx_vilsit,
    208     sfx_mansit,
    209     sfx_pesit,
    210     sfx_sklatk,
    211     sfx_sgtatk,
    212     sfx_skepch,
    213     sfx_vilatk,
    214     sfx_claw,
    215     sfx_skeswg,
    216     sfx_pldeth,
    217     sfx_pdiehi,
    218     sfx_podth1,
    219     sfx_podth2,
    220     sfx_podth3,
    221     sfx_bgdth1,
    222     sfx_bgdth2,
    223     sfx_sgtdth,
    224     sfx_cacdth,
    225     sfx_skldth,
    226     sfx_brsdth,
    227     sfx_cybdth,
    228     sfx_spidth,
    229     sfx_bspdth,
    230     sfx_vildth,
    231     sfx_kntdth,
    232     sfx_pedth,
    233     sfx_skedth,
    234     sfx_posact,
    235     sfx_bgact,
    236     sfx_dmact,
    237     sfx_bspact,
    238     sfx_bspwlk,
    239     sfx_vilact,
    240     sfx_noway,
    241     sfx_barexp,
    242     sfx_punch,
    243     sfx_hoof,
    244     sfx_metal,
    245     sfx_chgun,
    246     sfx_tink,
    247     sfx_bdopn,
    248     sfx_bdcls,
    249     sfx_itmbk,
    250     sfx_flame,
    251     sfx_flamst,
    252     sfx_getpow,
    253     sfx_bospit,
    254     sfx_boscub,
    255     sfx_bossit,
    256     sfx_bospn,
    257     sfx_bosdth,
    258     sfx_manatk,
    259     sfx_mandth,
    260     sfx_sssit,
    261     sfx_ssdth,
    262     sfx_keenpn,
    263     sfx_keendt,
    264     sfx_skeact,
    265     sfx_skesit,
    266     sfx_skeatk,
    267     sfx_radio,
    268     NUMSFX
    269 };
    270 extern SfxInfo   S_sfx[];
    271 extern MusicInfo S_music[];