diff options
-rw-r--r-- | apps/dsp.c | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/apps/dsp.c b/apps/dsp.c index 297a70d5a9..bbe53300d3 100644 --- a/apps/dsp.c +++ b/apps/dsp.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include "settings.h" | 31 | #include "settings.h" |
32 | #include "replaygain.h" | 32 | #include "replaygain.h" |
33 | #include "misc.h" | 33 | #include "misc.h" |
34 | #include "debug.h" | ||
35 | #include "tdspeed.h" | 34 | #include "tdspeed.h" |
36 | #include "buffer.h" | 35 | #include "buffer.h" |
37 | 36 | ||
@@ -267,22 +266,27 @@ void sound_set_pitch(int permille) | |||
267 | 266 | ||
268 | static void tdspeed_setup(struct dsp_config *dspc) | 267 | static void tdspeed_setup(struct dsp_config *dspc) |
269 | { | 268 | { |
269 | /* Assume timestretch will not not be used */ | ||
270 | dspc->tdspeed_active = false; | 270 | dspc->tdspeed_active = false; |
271 | if (dspc == &AUDIO_DSP) | 271 | sample_buf = small_sample_buf; |
272 | { | 272 | resample_buf = small_resample_buf; |
273 | if(!dsp_timestretch_available()) | 273 | sample_buf_count = SMALL_SAMPLE_BUF_COUNT; |
274 | return; | 274 | |
275 | if (dspc->tdspeed_percent == 0) | 275 | if(!dsp_timestretch_available()) |
276 | dspc->tdspeed_percent = 100; | 276 | return; /* Timestretch not enabled or buffer not allocated */ |
277 | if (!tdspeed_config( | 277 | if (dspc->tdspeed_percent == 0) |
278 | dspc->codec_frequency == 0 ? NATIVE_FREQUENCY : dspc->codec_frequency, | 278 | dspc->tdspeed_percent = 100; |
279 | dspc->stereo_mode != STEREO_MONO, | 279 | if (!tdspeed_config( |
280 | dspc->tdspeed_percent)) | 280 | dspc->codec_frequency == 0 ? NATIVE_FREQUENCY : dspc->codec_frequency, |
281 | return; | 281 | dspc->stereo_mode != STEREO_MONO, |
282 | if (dspc->tdspeed_percent == 100 || big_sample_buf_count <= 0) | 282 | dspc->tdspeed_percent)) |
283 | return; | 283 | return; /* Timestretch not possible or needed with these parameters */ |
284 | dspc->tdspeed_active = true; | 284 | |
285 | } | 285 | /* Timestretch is to be used */ |
286 | dspc->tdspeed_active = true; | ||
287 | sample_buf = big_sample_buf; | ||
288 | sample_buf_count = big_sample_buf_count; | ||
289 | resample_buf = big_resample_buf; | ||
286 | } | 290 | } |
287 | 291 | ||
288 | void dsp_timestretch_enable(bool enabled) | 292 | void dsp_timestretch_enable(bool enabled) |
@@ -1436,19 +1440,6 @@ intptr_t dsp_configure(struct dsp_config *dsp, int setting, intptr_t value) | |||
1436 | return 0; | 1440 | return 0; |
1437 | } | 1441 | } |
1438 | 1442 | ||
1439 | if (!dsp->tdspeed_active) | ||
1440 | { | ||
1441 | sample_buf = small_sample_buf; | ||
1442 | resample_buf = small_resample_buf; | ||
1443 | sample_buf_count = SMALL_SAMPLE_BUF_COUNT; | ||
1444 | } | ||
1445 | else | ||
1446 | { | ||
1447 | sample_buf = big_sample_buf; | ||
1448 | sample_buf_count = big_sample_buf_count; | ||
1449 | resample_buf = big_resample_buf; | ||
1450 | } | ||
1451 | |||
1452 | return 1; | 1443 | return 1; |
1453 | } | 1444 | } |
1454 | 1445 | ||