@@ -379,16 +379,17 @@ static void StartEnvelope(ENVPR *t,UBYTE flg,UBYTE pts,UBYTE susbeg,UBYTE susend
379
379
static void SetEnvelopePosition (ENVPR * t , ENVPT * p , SWORD pos )
380
380
{
381
381
if (t -> flg & EF_ON ) {
382
- t -> tick = pos - 1 ;
383
-
384
382
SWORD idx = 0 ;
385
383
BOOL envUpdate = TRUE;
386
384
SWORD tick = pos ;
387
385
386
+ t -> tick = pos - 1 ;
387
+
388
388
if (t -> pts > 1 ) {
389
+ UWORD i ;
389
390
idx ++ ;
390
391
391
- for (UWORD i = 0 ; i < t -> pts - 1 ; i ++ ) {
392
+ for (i = 0 ; i < t -> pts - 1 ; i ++ ) {
392
393
if (tick < p [idx ].pos ) {
393
394
idx -- ;
394
395
@@ -446,7 +447,7 @@ static void SetPanningEnvelopePosition(MODULE *mod, INSTRUMENT *i, ENVPR *t, ENV
446
447
/* Calculates the next envelope value the XM way, based on the implementation from ft2-clone */
447
448
static inline void ProcessEnvelopeXm (MP_VOICE * aout , ENVPR * t )
448
449
{
449
- WORD idx = t -> index ;
450
+ UWORD idx = t -> index ;
450
451
const BOOL keyOff = aout -> main .keyoff & KEY_OFF ;
451
452
452
453
if (keyOff ) {
@@ -506,11 +507,14 @@ static inline void ProcessEnvelopeXm(MP_VOICE *aout, ENVPR *t)
506
507
/* Calculates the next envelope value the IT way, based on the implementation from Schismtracker */
507
508
static inline void ProcessEnvelopeIt (MP_VOICE * aout , ENVPR * t )
508
509
{
509
- t -> tick ++ ;
510
-
511
510
SWORD start , end ;
512
511
const BOOL keyOff = aout -> main .keyoff & KEY_OFF ;
513
512
BOOL fadeFlag = FALSE;
513
+ SWORD pointPos , newPos ;
514
+ SWORD tick ;
515
+ UWORD i , idx ;
516
+
517
+ t -> tick ++ ;
514
518
515
519
if ((t -> flg & EF_SUSTAIN ) && !keyOff ) {
516
520
start = t -> env [t -> susbeg ].pos ;
@@ -537,19 +541,18 @@ static inline void ProcessEnvelopeIt(MP_VOICE *aout, ENVPR *t)
537
541
t -> tick = start ;
538
542
}
539
543
540
- SWORD tick = t -> tick ;
541
- WORD idx = t -> pts - 1 ;
544
+ tick = t -> tick ;
545
+ idx = t -> pts - 1 ;
542
546
543
547
// Find the right point to use
544
- for (WORD i = 0 ; i < t -> pts - 1 ; i ++ ) {
548
+ for (i = 0 ; i < t -> pts - 1 ; i ++ ) {
545
549
if (tick <= t -> env [i ].pos ) {
546
550
idx = i ;
547
551
break ;
548
552
}
549
553
}
550
554
551
- const SWORD pointPos = t -> env [idx ].pos ;
552
- SWORD newPos ;
555
+ pointPos = t -> env [idx ].pos ;
553
556
554
557
if (tick >= pointPos ) {
555
558
t -> lastvalue = t -> env [idx ].val ;
0 commit comments