seqload.h (3155B)
1 /*------------------------------------------------------------------*/ 2 /* 3 The Williams Entertainment Sound System 4 by Scott Patterson 5 */ 6 /*------------------------------------------------------------------*/ 7 8 #ifndef _SEQLOAD_H 9 #define _SEQLOAD_H 10 11 enum Seq_Load_Error { 12 13 SEQLOAD_NO_ERROR, 14 SEQLOAD_FOPEN, 15 SEQLOAD_FREAD, 16 SEQLOAD_FSEEK 17 }; 18 19 enum OpenSeqHandleFlag {NoOpenSeqHandle,YesOpenSeqHandle}; 20 21 /* 22 routine: wess_seq_loader_init() 23 24 - this routine must be called before and seq_loader_routines 25 - input_pm_stat is returned by wess_get_master_status() 26 - seqfile is the .wmd filename 27 - flag specifies if the file handle will be opened during init or 28 each time file is accessed 29 */ 30 31 extern int wess_seq_loader_sizeof( void *input_pm_stat, 32 char *seqfile ); 33 34 extern int wess_seq_loader_init( void *input_pm_stat, 35 char *seqfile, 36 enum OpenSeqHandleFlag flag, 37 char *memory_pointer, 38 int memory_allowance); 39 40 extern int wess_seq_loader_count( void ); 41 42 /* 43 routine: wess_seq_loader_exit() 44 45 - closes file handle if not already closed 46 - disables sequence loading calls 47 */ 48 49 extern void wess_seq_loader_exit(void); 50 51 /* 52 routine: wess_seq_loader_install_error_handler() 53 54 - for installing an error callback to notify file access errors 55 - module is your own ID returned as err_module parameter 56 - err_enum is the returned Seq_Load_Error enum parameter 57 */ 58 59 extern void wess_seq_loader_install_error_handler(int (*error_func)(int, int), 60 int module); 61 62 /* 63 general loading guidelines: 64 65 - sizeof functions return the amount of bytes needed for data 66 not already loaded, therefore, when sizeof returns 0, this 67 means the data referred to is already loaded 68 69 - load functions only load data that is not already loaded 70 and return the amount of bytes loaded, memory is not allocated 71 internally, you must use the sizeof functions and allocate 72 memory yourself 73 74 - free functions mark data as not loaded, memory is not freed 75 internally, you must free memory yourself 76 */ 77 78 /* 79 individual sequence loading 80 */ 81 82 extern int wess_seq_sizeof(int seqnum); 83 84 extern int wess_seq_load(int seqnum,void *memptr); 85 86 extern int wess_seq_free(int seqnum); 87 88 /* 89 sequence list loading 90 91 - pass in a list of sequnce numbers to be loaded 92 - end this list with the END_SEQ_LIST define 93 */ 94 95 #define END_SEQ_LIST -1 96 97 extern int wess_seq_list_sizeof(short *seqlist); 98 99 extern int wess_seq_list_load(short *seqlist,void *memptr); 100 101 extern int wess_seq_list_free(short *seqlist); 102 103 /* 104 sequence range loading 105 106 - specify a number of consecutive sequences to be loaded 107 */ 108 109 extern int wess_seq_range_sizeof(int seqfirst,int numseqs); 110 111 extern int wess_seq_range_load(int seqfirst,int numseqs,void *memptr); 112 113 extern int wess_seq_range_free(int seqfirst,int numseqs); 114 115 #endif 116