00001 00006 /* 00007 All original material Copyright (C) 2002-2010 UFO: Alien Invasion. 00008 00009 Original file from Quake 2 v3.21: quake2-2.31/client/sound.h 00010 Copyright (C) 1997-2001 Id Software, Inc. 00011 00012 This program is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU General Public License 00014 as published by the Free Software Foundation; either version 2 00015 of the License, or (at your option) any later version. 00016 00017 This program is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00020 00021 See the GNU General Public License for more details. 00022 00023 You should have received a copy of the GNU General Public License 00024 along with this program; if not, write to the Free Software 00025 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00026 00027 */ 00028 00029 #ifndef CLIENT_SOUND_MAIN_H 00030 #define CLIENT_SOUND_MAIN_H 00031 00032 #include <SDL_mixer.h> 00033 00034 #define MAX_CHANNELS 64 00035 00037 enum { 00038 SOUND_WATER_IN, 00039 SOUND_WATER_OUT, 00040 SOUND_WATER_MOVE, 00041 00042 MAX_SOUNDIDS 00043 }; 00044 00045 typedef struct s_sample_s { 00046 char *name; 00047 int lastPlayed; 00049 Mix_Chunk* chunk; 00050 struct s_sample_s* hashNext; 00051 } s_sample_t; 00052 00053 typedef struct s_channel_s { 00054 vec3_t org; 00055 s_sample_t *sample; 00056 float atten; 00057 int count; 00058 } s_channel_t; 00059 00061 typedef struct s_env_s { 00062 vec3_t right; /* for stereo panning */ 00063 00064 s_channel_t channels[MAX_CHANNELS]; 00065 00066 int sampleRepeatRate; 00067 int rate; 00068 int numChannels; 00069 uint16_t format; 00070 00071 qboolean initialized; 00072 } s_env_t; 00073 00074 extern s_env_t s_env; 00075 00076 #define SND_VOLUME_DEFAULT 1.0f 00077 #define SND_VOLUME_WEAPONS 1.0f 00078 00079 void S_Init(void); 00080 void S_Shutdown(void); 00081 void S_Frame(void); 00082 void S_Stop(void); 00083 void S_PlaySample(const vec3_t origin, s_sample_t* sample, float atten, float volume); 00084 void S_StartLocalSample(const char *s, float volume); 00085 s_sample_t *S_LoadSample(const char *s); 00086 00087 #endif