diff options
| author | Steve Bavin <pondlife@pondlife.me> | 2009-06-17 11:19:51 +0000 |
|---|---|---|
| committer | Steve Bavin <pondlife@pondlife.me> | 2009-06-17 11:19:51 +0000 |
| commit | 626494177615916fd51dbfb63e1456efd97fd316 (patch) | |
| tree | 4e5356a4fa3ad6098e6d07c4755538535c992d95 /apps | |
| parent | d52c6614c5d4711a6574981cd04c3e103551b608 (diff) | |
| download | rockbox-626494177615916fd51dbfb63e1456efd97fd316.zip rockbox-626494177615916fd51dbfb63e1456efd97fd316.tar.gz rockbox-626494177615916fd51dbfb63e1456efd97fd316.tar.bz2 rockbox-626494177615916fd51dbfb63e1456efd97fd316.tar.xz | |
Rework internal timestretch enable/disable code - fix FS#10341(hopefully).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21317 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/dsp.c | 49 |
1 files changed, 20 insertions, 29 deletions
@@ -31,7 +31,6 @@ #include "settings.h" #include "replaygain.h" #include "misc.h" -#include "debug.h" #include "tdspeed.h" #include "buffer.h" @@ -267,22 +266,27 @@ void sound_set_pitch(int permille) static void tdspeed_setup(struct dsp_config *dspc) { + /* Assume timestretch will not not be used */ dspc->tdspeed_active = false; - if (dspc == &AUDIO_DSP) - { - if(!dsp_timestretch_available()) - return; - if (dspc->tdspeed_percent == 0) - dspc->tdspeed_percent = 100; - if (!tdspeed_config( - dspc->codec_frequency == 0 ? NATIVE_FREQUENCY : dspc->codec_frequency, - dspc->stereo_mode != STEREO_MONO, - dspc->tdspeed_percent)) - return; - if (dspc->tdspeed_percent == 100 || big_sample_buf_count <= 0) - return; - dspc->tdspeed_active = true; - } + sample_buf = small_sample_buf; + resample_buf = small_resample_buf; + sample_buf_count = SMALL_SAMPLE_BUF_COUNT; + + if(!dsp_timestretch_available()) + return; /* Timestretch not enabled or buffer not allocated */ + if (dspc->tdspeed_percent == 0) + dspc->tdspeed_percent = 100; + if (!tdspeed_config( + dspc->codec_frequency == 0 ? NATIVE_FREQUENCY : dspc->codec_frequency, + dspc->stereo_mode != STEREO_MONO, + dspc->tdspeed_percent)) + return; /* Timestretch not possible or needed with these parameters */ + + /* Timestretch is to be used */ + dspc->tdspeed_active = true; + sample_buf = big_sample_buf; + sample_buf_count = big_sample_buf_count; + resample_buf = big_resample_buf; } void dsp_timestretch_enable(bool enabled) @@ -1436,19 +1440,6 @@ intptr_t dsp_configure(struct dsp_config *dsp, int setting, intptr_t value) return 0; } - if (!dsp->tdspeed_active) - { - sample_buf = small_sample_buf; - resample_buf = small_resample_buf; - sample_buf_count = SMALL_SAMPLE_BUF_COUNT; - } - else - { - sample_buf = big_sample_buf; - sample_buf_count = big_sample_buf_count; - resample_buf = big_resample_buf; - } - return 1; } |