wessapim.c (4353B)
1 2 /* WESS API INCLUDES */ 3 #include "wessapi.h" // audio stuff... 4 #include "seqload.h" 5 #include "soundhw.h" 6 #include "wessarc.h" 7 #include "wessseq.h" 8 9 #include "funqueue.h" 10 11 #include "graph.h" // debug 12 13 #ifndef NOUSEWESSCODE 14 15 unsigned char master_sfx_volume = 0x7F; // 80075834 16 unsigned char master_mus_volume = 0x7F; // 80075835 17 unsigned char pan_status = 1; // 80075836 18 int enabledecay = 0; // 8005D980 19 20 extern pmasterstat *pm_stat; //0x800B41CC 21 22 char wess_master_sfx_volume_get(void) // 80031120 23 { 24 if (!Is_Module_Loaded()) 25 { 26 return 0; 27 } 28 29 return (master_sfx_volume); 30 } 31 32 char wess_master_mus_volume_get(void) // 80031158 33 { 34 if (!Is_Module_Loaded()) 35 { 36 return 0; 37 } 38 39 return (master_mus_volume); 40 } 41 42 void wess_master_sfx_vol_set(char volume) // 80031190 43 { 44 char _volume; 45 46 _volume = volume; 47 48 wess_disable(); 49 queue_the_function(QUEUE_MASTER_SFX_VOL_SET); 50 queue_the_data(&_volume, sizeof(char)); 51 wess_enable(); 52 } 53 54 void queue_wess_master_sfx_vol_set(char volume); 55 56 void run_queue_wess_master_sfx_vol_set(void) // 800311CC 57 { 58 char volume; 59 60 unqueue_the_data(&volume, sizeof(char)); 61 queue_wess_master_sfx_vol_set(volume); 62 } 63 64 void queue_wess_master_sfx_vol_set(char volume) // 800311FC 65 { 66 char nt, na; 67 sequence_status *psq_stat; 68 track_status *ptmp; 69 char *lpdest; 70 char *ppos; 71 int li, lj; 72 char tmpppos[16]; 73 74 char _volume; 75 76 _volume = volume; 77 78 if (!Is_Module_Loaded()) 79 { 80 return; 81 } 82 83 master_sfx_volume = _volume; 84 85 wess_disable(); 86 87 /* search for all sequences with this number and turn them off */ 88 nt = wess_driver_sequences; 89 na = pm_stat->seqs_active; 90 psq_stat = pm_stat->pseqstattbl; 91 92 if (na) 93 { 94 while (nt--) 95 { 96 if (psq_stat->flags & SEQ_ACTIVE) 97 { 98 li = psq_stat->tracks_active; 99 lj = pm_stat->max_trks_perseq; 100 /* *lpdest refers to an active track if not 0xFF */ 101 lpdest = psq_stat->ptrk_indxs; 102 while (lj--) 103 { 104 if (*lpdest != 0xFF) 105 { 106 ptmp = (pm_stat->ptrkstattbl + (*lpdest)); 107 108 if (ptmp->sndclass == SNDFX_CLASS) 109 { 110 //save 111 ppos = ptmp->ppos; 112 113 // set tmp buffer ppos 114 ptmp->ppos = tmpppos; 115 ptmp->ppos[0] = VolumeMod; 116 ptmp->ppos[1] = ptmp->volume_cntrl; 117 ptmp->volume_cntrl = 0; 118 119 CmdFuncArr[ptmp->patchtype][VolumeMod](ptmp); 120 121 //restore 122 ptmp->ppos = ppos; 123 } 124 if (!--li) break; 125 } 126 lpdest++; 127 } 128 129 if (!--na) break; 130 } 131 psq_stat++; 132 } 133 } 134 135 wess_enable(); 136 } 137 138 void wess_master_mus_vol_set(char volume) // 800313DC 139 { 140 char _volume; 141 142 _volume = volume; 143 144 wess_disable(); 145 queue_the_function(QUEUE_MASTER_MUS_VOL_SET); 146 queue_the_data(&_volume, sizeof(char)); 147 wess_enable(); 148 } 149 150 151 void queue_wess_master_mus_vol_set(char volume); 152 153 void run_queue_wess_master_mus_vol_set(void) // 80031418 154 { 155 char volume; 156 157 unqueue_the_data(&volume, sizeof(char)); 158 queue_wess_master_mus_vol_set(volume); 159 } 160 161 void queue_wess_master_mus_vol_set(char volume) // 80031448 162 { 163 char nt, na; 164 sequence_status *psq_stat; 165 track_status *ptmp; 166 char *lpdest; 167 char *ppos; 168 int li, lj; 169 char tmpppos[16]; 170 171 char _volume; 172 173 _volume = volume; 174 175 if (!Is_Module_Loaded()) 176 { 177 return; 178 } 179 180 master_mus_volume = _volume; 181 182 wess_disable(); 183 184 /* search for all sequences with this number and turn them off */ 185 nt = wess_driver_sequences; 186 na = pm_stat->seqs_active; 187 psq_stat = pm_stat->pseqstattbl; 188 189 if (na) 190 { 191 while (nt--) 192 { 193 if (psq_stat->flags & SEQ_ACTIVE) 194 { 195 li = psq_stat->tracks_active; 196 lj = pm_stat->max_trks_perseq; 197 /* *lpdest refers to an active track if not 0xFF */ 198 lpdest = psq_stat->ptrk_indxs; 199 while (lj--) 200 { 201 if (*lpdest != 0xFF) 202 { 203 ptmp = (pm_stat->ptrkstattbl + (*lpdest)); 204 205 if (ptmp->sndclass == MUSIC_CLASS) 206 { 207 //save 208 ppos = ptmp->ppos; 209 210 // set tmp buffer ppos 211 ptmp->ppos = tmpppos; 212 ptmp->ppos[0] = VolumeMod; 213 ptmp->ppos[1] = ptmp->volume_cntrl; 214 ptmp->volume_cntrl = 0; 215 216 CmdFuncArr[ptmp->patchtype][VolumeMod](ptmp); 217 218 //restore 219 ptmp->ppos = ppos; 220 } 221 if (!--li) break; 222 } 223 lpdest++; 224 } 225 226 if (!--na) break; 227 } 228 psq_stat++; 229 } 230 } 231 232 wess_enable(); 233 } 234 235 char wess_pan_mode_get(void) // 80031624 236 { 237 return pan_status; 238 } 239 240 void wess_pan_mode_set(char mode) // 80031634 241 { 242 pan_status = mode; 243 } 244 #endif