sound.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. Copyright (C) 2004-2005 Michael Liebscher
  3. Copyright (C) 1997-2001 Id Software, Inc.
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License
  6. as published by the Free Software Foundation; either version 2
  7. of the License, or (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  15. */
  16. /*
  17. * sound.h:
  18. *
  19. * Author: Michael Liebscher <johnnycanuck@users.sourceforge.net>
  20. * Date: 2004
  21. *
  22. * Acknowledgement:
  23. * This code was derived from Quake II, and was originally
  24. * written by Id Software, Inc.
  25. *
  26. * Acknowledgement:
  27. * Portion of this code was derived from Quake II Evolved.
  28. *
  29. */
  30. #ifndef __SOUND_H__
  31. #define __SOUND_H__
  32. // Sound channels
  33. // Channel 0 never willingly overrides
  34. // Other channels (1-7) always override a playing sound on that channel
  35. #define CHAN_AUTO 0
  36. #define CHAN_WEAPON 1
  37. #define CHAN_VOICE 2
  38. #define CHAN_ITEM 3
  39. #define CHAN_BODY 4
  40. // Modifier flags
  41. #define CHAN_NO_PHS_ADD 8 // Send to all clients, not just ones in PHS (ATTN 0 will also do this)
  42. #define CHAN_RELIABLE 16 // Send by reliable message, not datagram
  43. // Sound attenuation values
  44. #define ATTN_NONE 0 // Full volume the entire level
  45. #define ATTN_NORM 1
  46. #define ATTN_IDLE 2
  47. #define ATTN_STATIC 3 // Diminish very rapidly with distance
  48. extern cvar_t *s_device;
  49. extern cvar_t *s_masterVolume;
  50. extern cvar_t *s_sfxVolume;
  51. extern cvar_t *s_musicVolume;
  52. extern char *sound_devices[ 12 ];
  53. extern W16 numSoundDevices;
  54. extern W16 numDefaultSoundDevice;
  55. extern W8 sound_initialized;
  56. extern void Sound_Init( void );
  57. extern void Sound_Shutdown( void );
  58. extern void Sound_Update( const vec3_t position, const vec3_t velocity, const vec3_t at, const vec3_t up);
  59. extern void Sound_Activate( _boolean active );
  60. extern channel_t *Sound_PickChannel( W32 entNum, W32 entChannel );
  61. extern sfx_t *Sound_RegisterSound( const char *name );
  62. extern void Sound_StartLocalSound( const char *filename );
  63. extern void Sound_StreamBGTrack( void );
  64. extern void Sound_StartStreaming( void );
  65. extern void Sound_StopStreaming( void );
  66. extern void Sound_StartBGTrack( const char *introTrack, const char *loopTrack );
  67. extern void Sound_StopBGTrack( void );
  68. extern void Sound_StartSound( const vec3_t position, int entNum, int entChannel, sfx_t *sfx, float volume, float attenuation, int timeOfs );
  69. extern void Sound_StopAllSounds( void );
  70. #endif /* __SOUND_H__ */