Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.72 KB | None | 0 0
  1. static void effecte_karplus_strong(mod_channel *ch)
  2. {
  3.     if (mod_tick == 0)
  4.     {
  5.         if (ch->sample > 0)
  6.         {
  7.             MODULE_SAMPLE *s = &source->samples[ch->sample - 1];
  8.  
  9.             signed char *sample_loop_data = &source->sample_data[s->offset + s->loop_start];
  10.  
  11.             unsigned int loop_length = s->loop_length - 2;
  12.             unsigned int loop_length_counter = loop_length;
  13.  
  14.             /* interpolate whole sample loop each row */
  15.             while (loop_length_counter--)
  16.             {
  17.                 *sample_loop_data = (*sample_loop_data + *(sample_loop_data + 1)) / 2;
  18.                 sample_loop_data++;
  19.             }
  20.  
  21.             /* interpolate with: last sample in loop + first sample in loop */
  22.             *sample_loop_data = (*sample_loop_data + *(sample_loop_data - loop_length)) / 2;
  23.         }
  24.     }
  25.  
  26.     return;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement