1 /* 2 * Alizarin Tetris 3 * The sound interface header file. 4 * 5 * Copyright 2000, Kiri Wagstaff & Westley Weimer 6 */ 7 8 #ifndef __SOUND_H 9 #define __SOUND_H 10 11 #include <SDL_audio.h> 12 #include <SDL_error.h> 13 14 #define MAX_MIXED_SAMPLES 32 15 16 /* a sample to be played */ 17 typedef struct playing_sample_struct { 18 int in_use; /* only play this if it is in use */ 19 int delay; /* bytes to wait before starting */ 20 Uint32 len; 21 Uint32 pos; 22 Uint8 * audio_data; 23 char * filename; 24 } playing_sample; 25 26 /* all samples to be played */ 27 typedef struct samples_to_be_played_struct { 28 playing_sample sample[MAX_MIXED_SAMPLES]; 29 } samples_to_be_played; 30 31 typedef struct WAV_sample_struct { 32 SDL_AudioSpec spec; 33 Uint8 * audio_buf; 34 Uint32 audio_len; 35 char * filename; 36 } WAV_sample; 37 38 #define SOUND_THUD 0 /* the piece you were moving settled */ 39 #define SOUND_CLEAR1 1 /* you cleared a row */ 40 #define SOUND_CLEAR4 2 /* you clear four at once */ 41 #define SOUND_LEVELUP 3 /* you have moved to the next level */ 42 #define SOUND_LEVELDOWN 4 /* you have moved to the previous level */ 43 #define SOUND_GARBAGE1 5 /* opponent gives you garbage */ 44 #define SOUND_CLOCK 6 /* running out of time! */ 45 #define NUM_SOUND 7 46 47 typedef struct sound_style_struct { 48 WAV_sample WAV[NUM_SOUND]; 49 char *name; /* name of this sound style */ 50 } sound_style; 51 52 typedef struct sound_styles_struct { 53 int num_style; 54 int choice; 55 sound_style **style; 56 } sound_styles; 57 58 #include "sound.pro" 59 60 #endif 61 62 /* 63 * $Log: sound.h,v $ 64 * Revision 1.10 2000/10/27 00:07:36 weimer 65 * some sound fixes ... 66 * 67 * Revision 1.9 2000/10/21 01:14:43 weimer 68 * massic autoconf/automake restructure ... 69 * 70 * Revision 1.8 2000/10/19 00:20:27 weimer 71 * sound directory changes, added a ticking clock ... 72 * 73 * Revision 1.7 2000/09/04 19:48:02 weimer 74 * interim menu for choosing among game styles, button changes (two states) 75 * 76 * Revision 1.6 2000/09/03 18:26:11 weimer 77 * major header file and automatic prototype generation changes, restructuring 78 * 79 * Revision 1.5 2000/08/26 02:35:23 weimer 80 * add sounds when you are given garbage 81 * 82 * Revision 1.4 2000/08/26 00:56:47 weimer 83 * client-server mods, plus you can now disable sound 84 * 85 * Revision 1.3 2000/08/15 00:48:28 weimer 86 * Massive sound rewrite, fixed a few memory problems. We now have 87 * sound_styles that work like piece_styles and color_styles. 88 * 89 * Revision 1.2 2000/08/13 21:53:08 weimer 90 * preliminary sound support (mixing multiple samples, etc.) 91 * 92 * Revision 1.1 2000/08/13 21:24:03 weimer 93 * preliminary sound 94 * 95 */ 96