comparison minijss/jssmix.c @ 2586:9807ae37ad69

Require stdbool.h, we require C11 now.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 08 Dec 2022 15:59:22 +0200
parents 69a5af2eb1ea
children
comparison
equal deleted inserted replaced
2585:ef6c826c5b7a 2586:9807ae37ad69
258 if (chn->chPos.dw >= chn->chLoopE.dw) 258 if (chn->chPos.dw >= chn->chLoopE.dw)
259 { 259 {
260 DMFixedPoint end; 260 DMFixedPoint end;
261 FP_ADD_R(end, chn->chLoopE, chn->chLoopE); 261 FP_ADD_R(end, chn->chLoopE, chn->chLoopE);
262 FP_SUB_R(chn->chPos, end, chn->chPos); 262 FP_SUB_R(chn->chPos, end, chn->chPos);
263 chn->chDirection = FALSE; 263 chn->chDirection = false;
264 } 264 }
265 } 265 }
266 else 266 else
267 { 267 {
268 // Normal forward loop 268 // Normal forward loop
277 else 277 else
278 { 278 {
279 // Normal (non-looped) sample 279 // Normal (non-looped) sample
280 if (chn->chPos.dw >= chn->chSize.dw) 280 if (chn->chPos.dw >= chn->chSize.dw)
281 { 281 {
282 chn->chPlaying = FALSE; 282 chn->chPlaying = false;
283 return; 283 return;
284 } 284 }
285 } 285 }
286 } 286 }
287 else 287 else
296 if (chn->chPos.dw <= chn->chLoopS.dw) 296 if (chn->chPos.dw <= chn->chLoopS.dw)
297 { 297 {
298 DMFixedPoint start; 298 DMFixedPoint start;
299 FP_ADD_R(start, chn->chLoopS, chn->chLoopS); 299 FP_ADD_R(start, chn->chLoopS, chn->chLoopS);
300 FP_SUB_R(chn->chPos, start, chn->chPos); 300 FP_SUB_R(chn->chPos, start, chn->chPos);
301 chn->chDirection = TRUE; 301 chn->chDirection = true;
302 } 302 }
303 } 303 }
304 else 304 else
305 { 305 {
306 // Normal forward loop 306 // Normal forward loop
315 else 315 else
316 { 316 {
317 // Normal (non-looped) sample 317 // Normal (non-looped) sample
318 if (chn->chPos.dw <= 0) 318 if (chn->chPos.dw <= 0)
319 { 319 {
320 chn->chPlaying = FALSE; 320 chn->chPlaying = false;
321 return; 321 return;
322 } 322 }
323 } 323 }
324 } 324 }
325 325
484 /* Channel manipulation routines 484 /* Channel manipulation routines
485 */ 485 */
486 void jvmPlay(JSSMixer * mixer, const int channel) 486 void jvmPlay(JSSMixer * mixer, const int channel)
487 { 487 {
488 JSS_LOCK(mixer); 488 JSS_LOCK(mixer);
489 mixer->channels[channel].chPlaying = TRUE; 489 mixer->channels[channel].chPlaying = true;
490 JSS_UNLOCK(mixer); 490 JSS_UNLOCK(mixer);
491 } 491 }
492 492
493 493
494 void jvmStop(JSSMixer * mixer, const int channel) 494 void jvmStop(JSSMixer * mixer, const int channel)
495 { 495 {
496 JSS_LOCK(mixer); 496 JSS_LOCK(mixer);
497 mixer->channels[channel].chPlaying = FALSE; 497 mixer->channels[channel].chPlaying = false;
498 JSS_UNLOCK(mixer); 498 JSS_UNLOCK(mixer);
499 } 499 }
500 500
501 501
502 void jvmReset(JSSMixer * mixer, const int channel) 502 void jvmReset(JSSMixer * mixer, const int channel)
504 JSSChannel *c; 504 JSSChannel *c;
505 505
506 JSS_LOCK(mixer); 506 JSS_LOCK(mixer);
507 c = &mixer->channels[channel]; 507 c = &mixer->channels[channel];
508 508
509 c->chDirection = TRUE; 509 c->chDirection = true;
510 c->chPos.dw = c->chDeltaO.dw = 0; 510 c->chPos.dw = c->chDeltaO.dw = 0;
511 511
512 JSS_UNLOCK(mixer); 512 JSS_UNLOCK(mixer);
513 } 513 }
514 514
525 FP_SETHL(c->chSize, size, 0); 525 FP_SETHL(c->chSize, size, 0);
526 FP_SETHL(c->chLoopS, loopS, 0); 526 FP_SETHL(c->chLoopS, loopS, 0);
527 FP_SETHL(c->chLoopE, loopE, 0); 527 FP_SETHL(c->chLoopE, loopE, 0);
528 c->chData = data; 528 c->chData = data;
529 c->chFlags = flags; 529 c->chFlags = flags;
530 c->chDirection = TRUE; 530 c->chDirection = true;
531 c->chPos.dw = c->chDeltaO.dw = 0; 531 c->chPos.dw = c->chDeltaO.dw = 0;
532 532
533 JSS_UNLOCK(mixer); 533 JSS_UNLOCK(mixer);
534 } 534 }
535 535
667 667
668 return tmp; 668 return tmp;
669 } 669 }
670 670
671 671
672 void jvmMute(JSSMixer * mixer, const int channel, const BOOL mute) 672 void jvmMute(JSSMixer * mixer, const int channel, const bool mute)
673 { 673 {
674 JSS_LOCK(mixer); 674 JSS_LOCK(mixer);
675 mixer->channels[channel].chMute = mute; 675 mixer->channels[channel].chMute = mute;
676 JSS_UNLOCK(mixer); 676 JSS_UNLOCK(mixer);
677 } 677 }
678 678
679 679
680 BOOL jvmGetMute(JSSMixer * mixer, const int channel) 680 bool jvmGetMute(JSSMixer * mixer, const int channel)
681 { 681 {
682 BOOL tmp; 682 bool tmp;
683 683
684 JSS_LOCK(mixer); 684 JSS_LOCK(mixer);
685 tmp = mixer->channels[channel].chMute; 685 tmp = mixer->channels[channel].chMute;
686 JSS_UNLOCK(mixer); 686 JSS_UNLOCK(mixer);
687 687