Crossfire Client, Trunk  R18666
/home/leaf/crossfire/client/trunk/sound-src/common.h
Go to the documentation of this file.
00001 /*
00002     Crossfire client, a client program for the crossfire program.
00003 
00004     Copyright (C) 2001 Mark Wedel & Crossfire Development Team
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 
00020     The author can be reached via e-mail to crossfire-devel@real-time.com
00021 */
00022 
00028 #ifndef _SOUND_SRC_COMMON_H
00029 #define _SOUND_SRC_COMMON_H
00030 
00031 #define CLIENT_SOUNDS_PATH CF_DATADIR "/sounds/"
00032 #define USER_SOUNDS_PATH "/.crossfire/sound.cache/"
00033 #define USER_CONFIG_FILE "/.crossfire/sndconfig"
00034 #define USER_SOUNDS_FILE "/.crossfire/sounds"
00035 #define MAX_SOUNDS 1024
00036 
00037 #define SOUND_DEBUG
00038 
00039 extern char *def_sounds[];
00040 
00041 extern char *client_sounds_path;
00042 extern char *user_sounds_path;
00043 extern char *user_config_file;
00044 extern char *user_sounds_file;
00045 
00046 extern char *buffers;
00047 
00048 typedef struct Sound_Info {
00049     char *filename;
00050     char *symbolic;
00051     unsigned char volume;
00052     int size;
00053     unsigned char *data;
00054 } Sound_Info;
00055 
00056 extern Sound_Info normal_sounds[MAX_SOUNDS];
00057 extern Sound_Info spell_sounds[MAX_SOUNDS];
00058 extern Sound_Info default_normal;
00059 extern Sound_Info default_spell;
00060 
00061 typedef struct sound_settings {
00062     int stereo;
00063     int bit8;
00064     int sign;
00065     int frequency;
00066     int buffers;
00067     int buflen;
00068     int simultaneously;                 
00069     const char *audiodev;
00070 } sound_settings;
00071 
00072 extern sound_settings settings;
00073 
00074 /*
00075  * Sound device parameters
00076  */
00077 extern int stereo;
00078 extern int bit8;
00079 extern int sample_size;
00080 extern int frequency;
00081 extern int sign;
00082 extern int zerolevel;
00083 
00084 extern int *sounds_in_buffer;
00085 
00086 extern int init_audio(void);
00087 
00088 void play_sound(int soundnum, int soundtype, int x, int y);
00089 void play_music(const char *name);
00090 
00091 /* From ../common/libcfclient.a */
00092 extern char *strdup_local(const char *str);
00093 extern void replace_chars_with_string(char*        buffer,
00094                                       const uint16 buffer_size,
00095                                       const char   find,
00096                                       const char*  replace      );
00097 
00098 #endif /* _SOUND_SRC_COMMON_H */
00099