summaryrefslogtreecommitdiff
path: root/apps/dsp.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dsp.c')
-rw-r--r--apps/dsp.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/apps/dsp.c b/apps/dsp.c
index 30b4ed357b..ec59417621 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -162,7 +162,7 @@ struct dsp_config
162 int sample_depth; 162 int sample_depth;
163 int sample_bytes; 163 int sample_bytes;
164 int stereo_mode; 164 int stereo_mode;
165 int tdspeed_percent; /* Speed % */ 165 int32_t tdspeed_percent; /* Speed% * PITCH_SPEED_PRECISION */
166 bool tdspeed_active; /* Timestretch is in use */ 166 bool tdspeed_active; /* Timestretch is in use */
167 int frac_bits; 167 int frac_bits;
168#ifdef HAVE_SW_TONE_CONTROLS 168#ifdef HAVE_SW_TONE_CONTROLS
@@ -205,7 +205,7 @@ static int treble; /* A/V */
205#endif 205#endif
206 206
207/* Settings applicable to audio codec only */ 207/* Settings applicable to audio codec only */
208static int pitch_ratio = 1000; 208static int32_t pitch_ratio = PITCH_SPEED_100;
209static int channels_mode; 209static int channels_mode;
210 long dsp_sw_gain; 210 long dsp_sw_gain;
211 long dsp_sw_cross; 211 long dsp_sw_cross;
@@ -254,14 +254,14 @@ static inline int32_t clip_sample_16(int32_t sample)
254 return sample; 254 return sample;
255} 255}
256 256
257int sound_get_pitch(void) 257int32_t sound_get_pitch(void)
258{ 258{
259 return pitch_ratio; 259 return pitch_ratio;
260} 260}
261 261
262void sound_set_pitch(int permille) 262void sound_set_pitch(int32_t percent)
263{ 263{
264 pitch_ratio = permille; 264 pitch_ratio = percent;
265 dsp_configure(&AUDIO_DSP, DSP_SWITCH_FREQUENCY, 265 dsp_configure(&AUDIO_DSP, DSP_SWITCH_FREQUENCY,
266 AUDIO_DSP.codec_frequency); 266 AUDIO_DSP.codec_frequency);
267} 267}
@@ -277,7 +277,7 @@ static void tdspeed_setup(struct dsp_config *dspc)
277 if(!dsp_timestretch_available()) 277 if(!dsp_timestretch_available())
278 return; /* Timestretch not enabled or buffer not allocated */ 278 return; /* Timestretch not enabled or buffer not allocated */
279 if (dspc->tdspeed_percent == 0) 279 if (dspc->tdspeed_percent == 0)
280 dspc->tdspeed_percent = 100; 280 dspc->tdspeed_percent = PITCH_SPEED_100;
281 if (!tdspeed_config( 281 if (!tdspeed_config(
282 dspc->codec_frequency == 0 ? NATIVE_FREQUENCY : dspc->codec_frequency, 282 dspc->codec_frequency == 0 ? NATIVE_FREQUENCY : dspc->codec_frequency,
283 dspc->stereo_mode != STEREO_MONO, 283 dspc->stereo_mode != STEREO_MONO,
@@ -312,13 +312,13 @@ void dsp_timestretch_enable(bool enabled)
312 } 312 }
313} 313}
314 314
315void dsp_set_timestretch(int percent) 315void dsp_set_timestretch(int32_t percent)
316{ 316{
317 AUDIO_DSP.tdspeed_percent = percent; 317 AUDIO_DSP.tdspeed_percent = percent;
318 tdspeed_setup(&AUDIO_DSP); 318 tdspeed_setup(&AUDIO_DSP);
319} 319}
320 320
321int dsp_get_timestretch() 321int32_t dsp_get_timestretch()
322{ 322{
323 return AUDIO_DSP.tdspeed_percent; 323 return AUDIO_DSP.tdspeed_percent;
324} 324}
@@ -1347,7 +1347,7 @@ intptr_t dsp_configure(struct dsp_config *dsp, int setting, intptr_t value)
1347 not need this feature. 1347 not need this feature.
1348 */ 1348 */
1349 if (dsp == &AUDIO_DSP) 1349 if (dsp == &AUDIO_DSP)
1350 dsp->frequency = pitch_ratio * dsp->codec_frequency / 1000; 1350 dsp->frequency = pitch_ratio * dsp->codec_frequency / PITCH_SPEED_100;
1351 else 1351 else
1352 dsp->frequency = dsp->codec_frequency; 1352 dsp->frequency = dsp->codec_frequency;
1353 1353