diff options
Diffstat (limited to 'apps/tdspeed.c')
-rw-r--r-- | apps/tdspeed.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/apps/tdspeed.c b/apps/tdspeed.c index 07f8beb132..cd01099a76 100644 --- a/apps/tdspeed.c +++ b/apps/tdspeed.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <stdio.h> | 25 | #include <stdio.h> |
26 | #include <string.h> | 26 | #include <string.h> |
27 | #include "buffer.h" | 27 | #include "buffer.h" |
28 | #include "debug.h" | ||
29 | #include "system.h" | 28 | #include "system.h" |
30 | #include "tdspeed.h" | 29 | #include "tdspeed.h" |
31 | #include "settings.h" | 30 | #include "settings.h" |
@@ -72,7 +71,7 @@ void tdspeed_init() | |||
72 | } | 71 | } |
73 | 72 | ||
74 | 73 | ||
75 | bool tdspeed_config(int samplerate, bool stereo, int factor) | 74 | bool tdspeed_config(int samplerate, bool stereo, int32_t factor) |
76 | { | 75 | { |
77 | struct tdspeed_state_s *st = &tdspeed_state; | 76 | struct tdspeed_state_s *st = &tdspeed_state; |
78 | int src_frame_sz; | 77 | int src_frame_sz; |
@@ -84,7 +83,7 @@ bool tdspeed_config(int samplerate, bool stereo, int factor) | |||
84 | return false; | 83 | return false; |
85 | 84 | ||
86 | /* Check parameters */ | 85 | /* Check parameters */ |
87 | if (factor == 100) | 86 | if (factor == PITCH_SPEED_100) |
88 | return false; | 87 | return false; |
89 | if (samplerate < MIN_RATE || samplerate > MAX_RATE) | 88 | if (samplerate < MIN_RATE || samplerate > MAX_RATE) |
90 | return false; | 89 | return false; |
@@ -94,14 +93,14 @@ bool tdspeed_config(int samplerate, bool stereo, int factor) | |||
94 | st->stereo = stereo; | 93 | st->stereo = stereo; |
95 | st->dst_step = samplerate / MINFREQ; | 94 | st->dst_step = samplerate / MINFREQ; |
96 | 95 | ||
97 | if (factor > 100) | 96 | if (factor > PITCH_SPEED_100) |
98 | st->dst_step = st->dst_step * 100 / factor; | 97 | st->dst_step = st->dst_step * PITCH_SPEED_100 / factor; |
99 | st->dst_order = 1; | 98 | st->dst_order = 1; |
100 | 99 | ||
101 | while (st->dst_step >>= 1) | 100 | while (st->dst_step >>= 1) |
102 | st->dst_order++; | 101 | st->dst_order++; |
103 | st->dst_step = (1 << st->dst_order); | 102 | st->dst_step = (1 << st->dst_order); |
104 | st->src_step = st->dst_step * factor / 100; | 103 | st->src_step = st->dst_step * factor / PITCH_SPEED_100; |
105 | st->shift_max = (st->dst_step > st->src_step) ? st->dst_step : st->src_step; | 104 | st->shift_max = (st->dst_step > st->src_step) ? st->dst_step : st->src_step; |
106 | 105 | ||
107 | src_frame_sz = st->shift_max + st->dst_step; | 106 | src_frame_sz = st->shift_max + st->dst_step; |