Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define SKIP_COUNTER_MAX 10000
- #define VOLUMES_MAX_INDEX 20
- #define VOLUMES_MIN_INDEX 0
- int volumes_left[] = {2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 8, 8, 8};
- int volumes_right[] = {8, 8, 8, 8, 8, 8, 7, 7, 7, 6, 6, 5, 5, 5, 4, 4, 4, 3, 3, 3, 2};
- enum direction
- {
- left,
- right
- };
- enum direction current_direction = right;
- int skip_counter = 0;
- int current_index = 10;
- void process_signal(void)
- {
- skip_counter++;
- if (skip_counter >= SKIP_COUNTER_MAX)
- {
- skip_counter = 0;
- if (current_direction == right)
- {
- current_index++;
- if (current_index == VOLUMES_MAX_INDEX)
- {
- current_direction = left;
- }
- }
- else
- {
- current_index--;
- if (current_index == VOLUMES_MIN_INDEX)
- {
- current_direction = right;
- }
- }
- }
- iChannel0LeftOut = ((iChannel0LeftIn << 8) >> (8 - volumes_left[current_index])) >> 8;
- iChannel0RightOut = ((iChannel0RightIn << 8) >> (8 - volumes_right[current_index])) >> 8;
- }
Add Comment
Please, Sign In to add comment