Guest User

Untitled

a guest
Nov 18th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #define SKIP_COUNTER_MAX 10000
  2. #define VOLUMES_MAX_INDEX 20
  3. #define VOLUMES_MIN_INDEX 0
  4.  
  5. int volumes_left[] = {2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 8, 8, 8};
  6.  
  7. int volumes_right[] = {8, 8, 8, 8, 8, 8, 7, 7, 7, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, 2};
  8.  
  9. enum direction
  10. {
  11. left,
  12. right
  13. };
  14.  
  15. enum direction current_direction = right;
  16.  
  17. int skip_counter = 0;
  18.  
  19. int current_index = 10;
  20.  
  21. void process_signal(void)
  22. {
  23. skip_counter++;
  24.  
  25. if (skip_counter >= SKIP_COUNTER_MAX)
  26. {
  27. skip_counter = 0;
  28.  
  29. if (current_direction == right)
  30. {
  31. current_index++;
  32. if (current_index == VOLUMES_MAX_INDEX)
  33. {
  34. current_direction = left;
  35. }
  36. }
  37. else
  38. {
  39. current_index--;
  40. if (current_index == VOLUMES_MIN_INDEX)
  41. {
  42. current_direction = right;
  43. }
  44. }
  45. }
  46.  
  47. iChannel0LeftOut = ((iChannel0LeftIn << 8) >> (8 - volumes_left[current_index])) >> 8;
  48. iChannel0RightOut = ((iChannel0RightIn << 8) >> (8 - volumes_right[current_index])) >> 8;
  49. }
Add Comment
Please, Sign In to add comment