Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.37 KB | None | 0 0
  1. static void UpdateInvertLoop(mod_channel *ch)
  2. {
  3.     static const unsigned char pt_tab_invloop[16] =
  4.     {
  5.         0x00, 0x05, 0x06, 0x07, 0x08, 0x0A, 0x0B, 0x0D,
  6.         0x0F, 0x13, 0x16, 0x1A, 0x20, 0x2B, 0x40, 0x80
  7.     };
  8.  
  9.     ch->invloop_delay += pt_tab_invloop[ch->invloop_speed];
  10.     if (ch->invloop_delay >= 128)
  11.     {
  12.         ch->invloop_delay = 0;
  13.  
  14.         if (ch->sample > 0)
  15.         {
  16.             MODULE_SAMPLE *s = &source->samples[ch->sample - 1];
  17.  
  18.             if (s->loop_length >= 4)
  19.             {
  20.                 ch->invloop_offset++;
  21.                 if (ch->invloop_offset >= s->loop_end)
  22.                 {
  23.                     ch->invloop_offset = s->loop_start;
  24.                 }
  25.  
  26.                 source->sample_data[s->offset + ch->invloop_offset] ^= 0xFF;
  27.             }
  28.         }
  29.     }
  30.    
  31.     return;
  32. }
  33.  
  34. static void effecte_invertloop(mod_channel *ch)
  35. {
  36.     if (mod_tick == 0)
  37.     {
  38.         ch->invloop_speed = ch->param & 0x0F;
  39.  
  40.         UpdateInvertLoop(ch);
  41.     }
  42.    
  43.     return;
  44. }
  45.  
  46. static void update_effect(mod_channel *ch)
  47. {
  48.     if (mod_tick > 0)
  49.     {
  50.         UpdateInvertLoop(ch);
  51.     }
  52.  
  53.     effect_routines[ch->command](ch);
  54.    
  55.     return;
  56. }
  57.  
  58. static void update_channel(mod_channel *ch)
  59. {
  60.     aflags = 0;
  61.     if (mod_tick == 0)
  62.     {
  63.         if (pattern_delay_2 == 0)
  64.         {
  65.             read_note(ch);
  66.         }
  67.  
  68.         /* if a sample number is found */
  69.         if (ch->sample > 0)
  70.         {
  71.             MODULE_SAMPLE *s = &source->samples[ch->sample - 1];
  72.             ch->invloop_offset = s->loop_start;
  73.         }
  74.  
  75.         /* ... */
  76.     }
  77.  
  78.     /* ... */
  79.  
  80.     update_effect(ch);
  81.  
  82.     /* ... */
  83.  
  84.     return;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement