Mercurial > codedump
comparison win95kggui/dep/ft2play/snd_masm.c @ 126:8e4ee43d3b81
remove submodules
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Sun, 01 Oct 2023 03:48:43 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 125:5cc85ef3a675 | 126:8e4ee43d3b81 |
|---|---|
| 1 #include <stdint.h> | |
| 2 #include <stdbool.h> | |
| 3 #include "snd_masm.h" | |
| 4 #include "pmplay.h" | |
| 5 | |
| 6 /* 8bb: This is done in a slightly different way, but the result | |
| 7 ** is the same (bit-accurate to FT2.08/FT2.09 w/ SB16, and WAV-writer). | |
| 8 ** | |
| 9 ** Mixer macros are stored in snd_masm.h | |
| 10 */ | |
| 11 | |
| 12 void PMPMix32Proc(CIType *v, int32_t numSamples, int32_t bufferPos) | |
| 13 { | |
| 14 if (v->SType & SType_Off) | |
| 15 return; // voice is not active | |
| 16 | |
| 17 uint32_t volStatus = v->SLVol1 | v->SRVol1; | |
| 18 if (volumeRampingFlag) | |
| 19 volStatus |= v->SLVol2 | v->SRVol2; | |
| 20 | |
| 21 if (volStatus == 0) // silence mix | |
| 22 { | |
| 23 const uint64_t samplesToMix = (uint64_t)v->SFrq * (uint32_t)numSamples; // 16.16fp | |
| 24 | |
| 25 const int32_t samples = (int32_t)(samplesToMix >> 16); | |
| 26 const int32_t samplesFrac = (samplesToMix & 0xFFFF) + (v->SPosDec >> 16); | |
| 27 | |
| 28 int32_t realPos = v->SPos + samples + (samplesFrac >> 16); | |
| 29 int32_t posFrac = samplesFrac & 0xFFFF; | |
| 30 | |
| 31 if (realPos >= v->SLen) | |
| 32 { | |
| 33 uint8_t SType = v->SType; | |
| 34 if (SType & (SType_Fwd+SType_Rev)) | |
| 35 { | |
| 36 do | |
| 37 { | |
| 38 SType ^= SType_RevDir; | |
| 39 realPos -= v->SRepL; | |
| 40 } | |
| 41 while (realPos >= v->SLen); | |
| 42 v->SType = SType; | |
| 43 } | |
| 44 else | |
| 45 { | |
| 46 v->SType = SType_Off; | |
| 47 return; | |
| 48 } | |
| 49 } | |
| 50 | |
| 51 v->SPosDec = posFrac << 16; | |
| 52 v->SPos = realPos; | |
| 53 } | |
| 54 else // normal mixing | |
| 55 { | |
| 56 bool mixInCenter; | |
| 57 if (volumeRampingFlag) | |
| 58 mixInCenter = (v->SLVol2 == v->SRVol2) && (v->SLVolIP == v->SRVolIP); | |
| 59 else | |
| 60 mixInCenter = v->SLVol1 == v->SRVol1; | |
| 61 | |
| 62 mixRoutineTable[(mixInCenter * 8) + v->SMixType](v, numSamples, bufferPos); | |
| 63 } | |
| 64 } | |
| 65 | |
| 66 static void mix8b(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 67 { | |
| 68 int32_t sample; | |
| 69 | |
| 70 GET_VOL | |
| 71 GET_MIXER_VARS | |
| 72 SET_BASE8 | |
| 73 | |
| 74 int32_t CDA_BytesLeft = numSamples; | |
| 75 while (CDA_BytesLeft > 0) | |
| 76 { | |
| 77 LIMIT_MIX_NUM | |
| 78 CDA_BytesLeft -= samplesToMix; | |
| 79 | |
| 80 HANDLE_POS_START | |
| 81 for (i = 0; i < (samplesToMix & 3); i++) | |
| 82 { | |
| 83 MIX_8BIT | |
| 84 } | |
| 85 samplesToMix >>= 2; | |
| 86 for (i = 0; i < samplesToMix; i++) | |
| 87 { | |
| 88 MIX_8BIT | |
| 89 MIX_8BIT | |
| 90 MIX_8BIT | |
| 91 MIX_8BIT | |
| 92 } | |
| 93 HANDLE_POS_END | |
| 94 } | |
| 95 | |
| 96 SET_BACK_MIXER_POS | |
| 97 } | |
| 98 | |
| 99 static void mix8bIntrp(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 100 { | |
| 101 int32_t sample, sample2; | |
| 102 | |
| 103 GET_VOL | |
| 104 GET_MIXER_VARS | |
| 105 SET_BASE8 | |
| 106 | |
| 107 int32_t CDA_BytesLeft = numSamples; | |
| 108 while (CDA_BytesLeft > 0) | |
| 109 { | |
| 110 LIMIT_MIX_NUM | |
| 111 CDA_BytesLeft -= samplesToMix; | |
| 112 | |
| 113 HANDLE_POS_START | |
| 114 for (i = 0; i < (samplesToMix & 3); i++) | |
| 115 { | |
| 116 MIX_8BIT_INTRP | |
| 117 } | |
| 118 samplesToMix >>= 2; | |
| 119 for (i = 0; i < samplesToMix; i++) | |
| 120 { | |
| 121 MIX_8BIT_INTRP | |
| 122 MIX_8BIT_INTRP | |
| 123 MIX_8BIT_INTRP | |
| 124 MIX_8BIT_INTRP | |
| 125 } | |
| 126 HANDLE_POS_END | |
| 127 } | |
| 128 | |
| 129 SET_BACK_MIXER_POS | |
| 130 } | |
| 131 | |
| 132 static void mix8bRamp(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 133 { | |
| 134 int32_t sample; | |
| 135 | |
| 136 GET_MIXER_VARS | |
| 137 GET_RAMP_VARS | |
| 138 SET_BASE8 | |
| 139 | |
| 140 int32_t CDA_BytesLeft = numSamples; | |
| 141 while (CDA_BytesLeft > 0) | |
| 142 { | |
| 143 LIMIT_MIX_NUM | |
| 144 LIMIT_MIX_NUM_RAMP | |
| 145 CDA_BytesLeft -= samplesToMix; | |
| 146 | |
| 147 GET_VOL_RAMP | |
| 148 HANDLE_POS_START | |
| 149 for (i = 0; i < (samplesToMix & 3); i++) | |
| 150 { | |
| 151 MIX_8BIT | |
| 152 VOL_RAMP | |
| 153 } | |
| 154 samplesToMix >>= 2; | |
| 155 for (i = 0; i < samplesToMix; i++) | |
| 156 { | |
| 157 MIX_8BIT | |
| 158 VOL_RAMP | |
| 159 MIX_8BIT | |
| 160 VOL_RAMP | |
| 161 MIX_8BIT | |
| 162 VOL_RAMP | |
| 163 MIX_8BIT | |
| 164 VOL_RAMP | |
| 165 } | |
| 166 HANDLE_POS_END | |
| 167 SET_VOL_BACK | |
| 168 } | |
| 169 | |
| 170 SET_BACK_MIXER_POS | |
| 171 } | |
| 172 | |
| 173 static void mix8bRampIntrp(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 174 { | |
| 175 int32_t sample, sample2; | |
| 176 | |
| 177 GET_MIXER_VARS | |
| 178 GET_RAMP_VARS | |
| 179 SET_BASE8 | |
| 180 | |
| 181 int32_t CDA_BytesLeft = numSamples; | |
| 182 while (CDA_BytesLeft > 0) | |
| 183 { | |
| 184 LIMIT_MIX_NUM | |
| 185 LIMIT_MIX_NUM_RAMP | |
| 186 CDA_BytesLeft -= samplesToMix; | |
| 187 | |
| 188 GET_VOL_RAMP | |
| 189 HANDLE_POS_START | |
| 190 for (i = 0; i < (samplesToMix & 3); i++) | |
| 191 { | |
| 192 MIX_8BIT_INTRP | |
| 193 VOL_RAMP | |
| 194 } | |
| 195 samplesToMix >>= 2; | |
| 196 for (i = 0; i < samplesToMix; i++) | |
| 197 { | |
| 198 MIX_8BIT_INTRP | |
| 199 VOL_RAMP | |
| 200 MIX_8BIT_INTRP | |
| 201 VOL_RAMP | |
| 202 MIX_8BIT_INTRP | |
| 203 VOL_RAMP | |
| 204 MIX_8BIT_INTRP | |
| 205 VOL_RAMP | |
| 206 } | |
| 207 HANDLE_POS_END | |
| 208 SET_VOL_BACK | |
| 209 } | |
| 210 | |
| 211 SET_BACK_MIXER_POS | |
| 212 } | |
| 213 | |
| 214 static void mix16b(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 215 { | |
| 216 int32_t sample; | |
| 217 | |
| 218 GET_VOL | |
| 219 GET_MIXER_VARS | |
| 220 SET_BASE16 | |
| 221 | |
| 222 int32_t CDA_BytesLeft = numSamples; | |
| 223 while (CDA_BytesLeft > 0) | |
| 224 { | |
| 225 LIMIT_MIX_NUM | |
| 226 CDA_BytesLeft -= samplesToMix; | |
| 227 | |
| 228 HANDLE_POS_START | |
| 229 for (i = 0; i < (samplesToMix & 3); i++) | |
| 230 { | |
| 231 MIX_16BIT | |
| 232 } | |
| 233 samplesToMix >>= 2; | |
| 234 for (i = 0; i < samplesToMix; i++) | |
| 235 { | |
| 236 MIX_16BIT | |
| 237 MIX_16BIT | |
| 238 MIX_16BIT | |
| 239 MIX_16BIT | |
| 240 } | |
| 241 HANDLE_POS_END | |
| 242 } | |
| 243 | |
| 244 SET_BACK_MIXER_POS | |
| 245 } | |
| 246 | |
| 247 static void mix16bIntrp(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 248 { | |
| 249 int32_t sample, sample2; | |
| 250 | |
| 251 GET_VOL | |
| 252 GET_MIXER_VARS | |
| 253 SET_BASE16 | |
| 254 | |
| 255 int32_t CDA_BytesLeft = numSamples; | |
| 256 while (CDA_BytesLeft > 0) | |
| 257 { | |
| 258 LIMIT_MIX_NUM | |
| 259 CDA_BytesLeft -= samplesToMix; | |
| 260 | |
| 261 HANDLE_POS_START | |
| 262 for (i = 0; i < (samplesToMix & 3); i++) | |
| 263 { | |
| 264 MIX_16BIT_INTRP | |
| 265 } | |
| 266 samplesToMix >>= 2; | |
| 267 for (i = 0; i < samplesToMix; i++) | |
| 268 { | |
| 269 MIX_16BIT_INTRP | |
| 270 MIX_16BIT_INTRP | |
| 271 MIX_16BIT_INTRP | |
| 272 MIX_16BIT_INTRP | |
| 273 } | |
| 274 HANDLE_POS_END | |
| 275 } | |
| 276 | |
| 277 SET_BACK_MIXER_POS | |
| 278 } | |
| 279 | |
| 280 static void mix16bRamp(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 281 { | |
| 282 int32_t sample; | |
| 283 | |
| 284 GET_MIXER_VARS | |
| 285 GET_RAMP_VARS | |
| 286 SET_BASE16 | |
| 287 | |
| 288 int32_t CDA_BytesLeft = numSamples; | |
| 289 while (CDA_BytesLeft > 0) | |
| 290 { | |
| 291 LIMIT_MIX_NUM | |
| 292 LIMIT_MIX_NUM_RAMP | |
| 293 CDA_BytesLeft -= samplesToMix; | |
| 294 | |
| 295 GET_VOL_RAMP | |
| 296 HANDLE_POS_START | |
| 297 for (i = 0; i < (samplesToMix & 3); i++) | |
| 298 { | |
| 299 MIX_16BIT | |
| 300 VOL_RAMP | |
| 301 } | |
| 302 samplesToMix >>= 2; | |
| 303 for (i = 0; i < samplesToMix; i++) | |
| 304 { | |
| 305 MIX_16BIT | |
| 306 VOL_RAMP | |
| 307 MIX_16BIT | |
| 308 VOL_RAMP | |
| 309 MIX_16BIT | |
| 310 VOL_RAMP | |
| 311 MIX_16BIT | |
| 312 VOL_RAMP | |
| 313 } | |
| 314 HANDLE_POS_END | |
| 315 SET_VOL_BACK | |
| 316 } | |
| 317 | |
| 318 SET_BACK_MIXER_POS | |
| 319 } | |
| 320 | |
| 321 static void mix16bRampIntrp(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 322 { | |
| 323 int32_t sample, sample2; | |
| 324 | |
| 325 GET_MIXER_VARS | |
| 326 GET_RAMP_VARS | |
| 327 SET_BASE16 | |
| 328 | |
| 329 int32_t CDA_BytesLeft = numSamples; | |
| 330 while (CDA_BytesLeft > 0) | |
| 331 { | |
| 332 LIMIT_MIX_NUM | |
| 333 LIMIT_MIX_NUM_RAMP | |
| 334 CDA_BytesLeft -= samplesToMix; | |
| 335 | |
| 336 GET_VOL_RAMP | |
| 337 HANDLE_POS_START | |
| 338 for (i = 0; i < (samplesToMix & 3); i++) | |
| 339 { | |
| 340 MIX_16BIT_INTRP | |
| 341 VOL_RAMP | |
| 342 } | |
| 343 samplesToMix >>= 2; | |
| 344 for (i = 0; i < samplesToMix; i++) | |
| 345 { | |
| 346 MIX_16BIT_INTRP | |
| 347 VOL_RAMP | |
| 348 MIX_16BIT_INTRP | |
| 349 VOL_RAMP | |
| 350 MIX_16BIT_INTRP | |
| 351 VOL_RAMP | |
| 352 MIX_16BIT_INTRP | |
| 353 VOL_RAMP | |
| 354 } | |
| 355 HANDLE_POS_END | |
| 356 SET_VOL_BACK | |
| 357 } | |
| 358 | |
| 359 SET_BACK_MIXER_POS | |
| 360 } | |
| 361 | |
| 362 static void mix8bCenter(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 363 { | |
| 364 int32_t sample; | |
| 365 | |
| 366 GET_VOL_CENTER | |
| 367 GET_MIXER_VARS | |
| 368 SET_BASE8 | |
| 369 | |
| 370 int32_t CDA_BytesLeft = numSamples; | |
| 371 while (CDA_BytesLeft > 0) | |
| 372 { | |
| 373 LIMIT_MIX_NUM | |
| 374 CDA_BytesLeft -= samplesToMix; | |
| 375 | |
| 376 HANDLE_POS_START | |
| 377 for (i = 0; i < (samplesToMix & 3); i++) | |
| 378 { | |
| 379 MIX_8BIT_M | |
| 380 } | |
| 381 samplesToMix >>= 2; | |
| 382 for (i = 0; i < samplesToMix; i++) | |
| 383 { | |
| 384 MIX_8BIT_M | |
| 385 MIX_8BIT_M | |
| 386 MIX_8BIT_M | |
| 387 MIX_8BIT_M | |
| 388 } | |
| 389 HANDLE_POS_END | |
| 390 } | |
| 391 | |
| 392 SET_BACK_MIXER_POS | |
| 393 } | |
| 394 | |
| 395 static void mix8bIntrpCenter(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 396 { | |
| 397 int32_t sample, sample2; | |
| 398 | |
| 399 GET_VOL_CENTER | |
| 400 GET_MIXER_VARS | |
| 401 SET_BASE8 | |
| 402 | |
| 403 int32_t CDA_BytesLeft = numSamples; | |
| 404 while (CDA_BytesLeft > 0) | |
| 405 { | |
| 406 LIMIT_MIX_NUM | |
| 407 CDA_BytesLeft -= samplesToMix; | |
| 408 | |
| 409 HANDLE_POS_START | |
| 410 for (i = 0; i < (samplesToMix & 3); i++) | |
| 411 { | |
| 412 MIX_8BIT_INTRP_M | |
| 413 } | |
| 414 samplesToMix >>= 2; | |
| 415 for (i = 0; i < samplesToMix; i++) | |
| 416 { | |
| 417 MIX_8BIT_INTRP_M | |
| 418 MIX_8BIT_INTRP_M | |
| 419 MIX_8BIT_INTRP_M | |
| 420 MIX_8BIT_INTRP_M | |
| 421 } | |
| 422 HANDLE_POS_END | |
| 423 } | |
| 424 | |
| 425 SET_BACK_MIXER_POS | |
| 426 } | |
| 427 | |
| 428 static void mix8bRampCenter(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 429 { | |
| 430 int32_t sample; | |
| 431 | |
| 432 GET_MIXER_VARS | |
| 433 GET_RAMP_VARS | |
| 434 SET_BASE8 | |
| 435 | |
| 436 int32_t CDA_BytesLeft = numSamples; | |
| 437 while (CDA_BytesLeft > 0) | |
| 438 { | |
| 439 LIMIT_MIX_NUM | |
| 440 LIMIT_MIX_NUM_RAMP | |
| 441 CDA_BytesLeft -= samplesToMix; | |
| 442 | |
| 443 GET_VOL_RAMP | |
| 444 HANDLE_POS_START | |
| 445 for (i = 0; i < (samplesToMix & 3); i++) | |
| 446 { | |
| 447 MIX_8BIT_M | |
| 448 VOL_RAMP | |
| 449 } | |
| 450 samplesToMix >>= 2; | |
| 451 for (i = 0; i < samplesToMix; i++) | |
| 452 { | |
| 453 MIX_8BIT_M | |
| 454 VOL_RAMP | |
| 455 MIX_8BIT_M | |
| 456 VOL_RAMP | |
| 457 MIX_8BIT_M | |
| 458 VOL_RAMP | |
| 459 MIX_8BIT_M | |
| 460 VOL_RAMP | |
| 461 } | |
| 462 HANDLE_POS_END | |
| 463 SET_VOL_BACK | |
| 464 } | |
| 465 | |
| 466 SET_BACK_MIXER_POS | |
| 467 } | |
| 468 | |
| 469 static void mix8bRampIntrpCenter(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 470 { | |
| 471 int32_t sample, sample2; | |
| 472 | |
| 473 GET_MIXER_VARS | |
| 474 GET_RAMP_VARS | |
| 475 SET_BASE8 | |
| 476 | |
| 477 int32_t CDA_BytesLeft = numSamples; | |
| 478 while (CDA_BytesLeft > 0) | |
| 479 { | |
| 480 LIMIT_MIX_NUM | |
| 481 LIMIT_MIX_NUM_RAMP | |
| 482 CDA_BytesLeft -= samplesToMix; | |
| 483 | |
| 484 GET_VOL_RAMP | |
| 485 HANDLE_POS_START | |
| 486 for (i = 0; i < (samplesToMix & 3); i++) | |
| 487 { | |
| 488 MIX_8BIT_INTRP_M | |
| 489 VOL_RAMP | |
| 490 } | |
| 491 samplesToMix >>= 2; | |
| 492 for (i = 0; i < samplesToMix; i++) | |
| 493 { | |
| 494 MIX_8BIT_INTRP_M | |
| 495 VOL_RAMP | |
| 496 MIX_8BIT_INTRP_M | |
| 497 VOL_RAMP | |
| 498 MIX_8BIT_INTRP_M | |
| 499 VOL_RAMP | |
| 500 MIX_8BIT_INTRP_M | |
| 501 VOL_RAMP | |
| 502 } | |
| 503 HANDLE_POS_END | |
| 504 SET_VOL_BACK | |
| 505 } | |
| 506 | |
| 507 SET_BACK_MIXER_POS | |
| 508 } | |
| 509 | |
| 510 static void mix16bCenter(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 511 { | |
| 512 int32_t sample; | |
| 513 | |
| 514 GET_VOL_CENTER | |
| 515 GET_MIXER_VARS | |
| 516 SET_BASE16 | |
| 517 | |
| 518 int32_t CDA_BytesLeft = numSamples; | |
| 519 while (CDA_BytesLeft > 0) | |
| 520 { | |
| 521 LIMIT_MIX_NUM | |
| 522 CDA_BytesLeft -= samplesToMix; | |
| 523 | |
| 524 HANDLE_POS_START | |
| 525 for (i = 0; i < (samplesToMix & 3); i++) | |
| 526 { | |
| 527 MIX_16BIT_M | |
| 528 } | |
| 529 samplesToMix >>= 2; | |
| 530 for (i = 0; i < samplesToMix; i++) | |
| 531 { | |
| 532 MIX_16BIT_M | |
| 533 MIX_16BIT_M | |
| 534 MIX_16BIT_M | |
| 535 MIX_16BIT_M | |
| 536 } | |
| 537 HANDLE_POS_END | |
| 538 } | |
| 539 | |
| 540 SET_BACK_MIXER_POS | |
| 541 } | |
| 542 | |
| 543 static void mix16bIntrpCenter(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 544 { | |
| 545 int32_t sample, sample2; | |
| 546 | |
| 547 GET_VOL_CENTER | |
| 548 GET_MIXER_VARS | |
| 549 SET_BASE16 | |
| 550 | |
| 551 int32_t CDA_BytesLeft = numSamples; | |
| 552 while (CDA_BytesLeft > 0) | |
| 553 { | |
| 554 LIMIT_MIX_NUM | |
| 555 CDA_BytesLeft -= samplesToMix; | |
| 556 | |
| 557 HANDLE_POS_START | |
| 558 for (i = 0; i < (samplesToMix & 3); i++) | |
| 559 { | |
| 560 MIX_16BIT_INTRP_M | |
| 561 } | |
| 562 samplesToMix >>= 2; | |
| 563 for (i = 0; i < samplesToMix; i++) | |
| 564 { | |
| 565 MIX_16BIT_INTRP_M | |
| 566 MIX_16BIT_INTRP_M | |
| 567 MIX_16BIT_INTRP_M | |
| 568 MIX_16BIT_INTRP_M | |
| 569 } | |
| 570 HANDLE_POS_END | |
| 571 } | |
| 572 | |
| 573 SET_BACK_MIXER_POS | |
| 574 } | |
| 575 | |
| 576 static void mix16bRampCenter(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 577 { | |
| 578 int32_t sample; | |
| 579 | |
| 580 GET_MIXER_VARS | |
| 581 GET_RAMP_VARS | |
| 582 SET_BASE16 | |
| 583 | |
| 584 int32_t CDA_BytesLeft = numSamples; | |
| 585 while (CDA_BytesLeft > 0) | |
| 586 { | |
| 587 LIMIT_MIX_NUM | |
| 588 LIMIT_MIX_NUM_RAMP | |
| 589 CDA_BytesLeft -= samplesToMix; | |
| 590 | |
| 591 GET_VOL_RAMP | |
| 592 HANDLE_POS_START | |
| 593 for (i = 0; i < (samplesToMix & 3); i++) | |
| 594 { | |
| 595 MIX_16BIT_M | |
| 596 VOL_RAMP | |
| 597 } | |
| 598 samplesToMix >>= 2; | |
| 599 for (i = 0; i < samplesToMix; i++) | |
| 600 { | |
| 601 MIX_16BIT_M | |
| 602 VOL_RAMP | |
| 603 MIX_16BIT_M | |
| 604 VOL_RAMP | |
| 605 MIX_16BIT_M | |
| 606 VOL_RAMP | |
| 607 MIX_16BIT_M | |
| 608 VOL_RAMP | |
| 609 } | |
| 610 HANDLE_POS_END | |
| 611 SET_VOL_BACK | |
| 612 } | |
| 613 | |
| 614 SET_BACK_MIXER_POS | |
| 615 } | |
| 616 | |
| 617 static void mix16bRampIntrpCenter(CIType *v, uint32_t numSamples, uint32_t bufferPos) | |
| 618 { | |
| 619 int32_t sample, sample2; | |
| 620 | |
| 621 GET_MIXER_VARS | |
| 622 GET_RAMP_VARS | |
| 623 SET_BASE16 | |
| 624 | |
| 625 int32_t CDA_BytesLeft = numSamples; | |
| 626 while (CDA_BytesLeft > 0) | |
| 627 { | |
| 628 LIMIT_MIX_NUM | |
| 629 LIMIT_MIX_NUM_RAMP | |
| 630 CDA_BytesLeft -= samplesToMix; | |
| 631 | |
| 632 GET_VOL_RAMP | |
| 633 HANDLE_POS_START | |
| 634 for (i = 0; i < (samplesToMix & 3); i++) | |
| 635 { | |
| 636 MIX_16BIT_INTRP_M | |
| 637 VOL_RAMP | |
| 638 } | |
| 639 samplesToMix >>= 2; | |
| 640 for (i = 0; i < samplesToMix; i++) | |
| 641 { | |
| 642 MIX_16BIT_INTRP_M | |
| 643 VOL_RAMP | |
| 644 MIX_16BIT_INTRP_M | |
| 645 VOL_RAMP | |
| 646 MIX_16BIT_INTRP_M | |
| 647 VOL_RAMP | |
| 648 MIX_16BIT_INTRP_M | |
| 649 VOL_RAMP | |
| 650 } | |
| 651 HANDLE_POS_END | |
| 652 SET_VOL_BACK | |
| 653 } | |
| 654 | |
| 655 SET_BACK_MIXER_POS | |
| 656 } | |
| 657 | |
| 658 mixRoutine mixRoutineTable[16] = | |
| 659 { | |
| 660 (mixRoutine)mix8b, | |
| 661 (mixRoutine)mix8bIntrp, | |
| 662 (mixRoutine)mix8bRamp, | |
| 663 (mixRoutine)mix8bRampIntrp, | |
| 664 (mixRoutine)mix16b, | |
| 665 (mixRoutine)mix16bIntrp, | |
| 666 (mixRoutine)mix16bRamp, | |
| 667 (mixRoutine)mix16bRampIntrp, | |
| 668 (mixRoutine)mix8bCenter, | |
| 669 (mixRoutine)mix8bIntrpCenter, | |
| 670 (mixRoutine)mix8bRampCenter, | |
| 671 (mixRoutine)mix8bRampIntrpCenter, | |
| 672 (mixRoutine)mix16bCenter, | |
| 673 (mixRoutine)mix16bIntrpCenter, | |
| 674 (mixRoutine)mix16bRampCenter, | |
| 675 (mixRoutine)mix16bRampIntrpCenter | |
| 676 }; |
