1 /* 2 * wmslib/include/snd.h, part of wmslib (Library functions) 3 * Copyright (C) 1994 William Shubert. 4 * See "configure.h.in" for more copyright information. 5 */ 6 7 #ifndef _WMS_SND_H_ 8 #define _WMS_SND_H_ 1 9 10 /********************************************************************** 11 * Data types 12 **********************************************************************/ 13 14 /* Public. */ 15 typedef enum { 16 sndInit_ok, sndInit_busy, sndInit_broken 17 } SndInit; 18 19 /* 20 * This is a public type, but the "sndState_i*" values should never be used 21 * by the application - they are for internal use only. 22 */ 23 typedef enum { 24 sndState_iOff, sndState_off, sndState_partOpen, sndState_iWantOpen, 25 sndState_fullOpen, sndState_oldState, sndState_iTempOpen 26 } SndState; 27 28 /* Opaque. */ 29 typedef struct Snd_struct { 30 int len; 31 uchar *data; 32 bool converted; 33 int cvtlen; 34 union { 35 uchar *dsp; 36 ushort *dsp1; 37 } cvtdata; 38 struct Snd_struct *next; 39 } Snd; 40 41 /********************************************************************** 42 * Global variables 43 **********************************************************************/ 44 45 /* 46 * Feel free to set this pointer to point to any old handler. By default 47 * it points to a routine that dumps errStr to stderr for the first 48 * error then ignores the rest. 49 * It gets called ONLY by snd_play; snd_init returns an error code that you 50 * should check for. 51 * errStr is always the same as snd_error. 52 */ 53 extern void (*snd_errHandler)(SndInit errType, char *errStr); 54 extern char snd_error[]; 55 56 /********************************************************************** 57 * Functions 58 **********************************************************************/ 59 extern SndInit snd_init(SndState newState, int newVolume); 60 extern void snd_play(Snd *sound); 61 extern void snd_deinit(void); 62 63 /********************************************************************** 64 * Macros, constants, etc. 65 **********************************************************************/ 66 67 #define snd_define(data) {sizeof(data), data, FALSE,0,{NULL},NULL} 68 69 #define SND_MAXVOL 10000 /* Just for kicks, you know? */ 70 71 #if SUN_SOUND || LINUX_SOUND 72 #define SND_AVAILABLE 1 73 #else 74 #define SND_AVAILABLE 0 75 #endif 76 77 #endif /* _WMS_SND_H_ */ 78