diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rbcodec/dsp/dsp_misc.c | 46 | ||||
-rw-r--r-- | lib/rbcodec/dsp/dsp_misc.h | 17 | ||||
-rw-r--r-- | lib/rbcodec/test/warble.c | 2 |
3 files changed, 9 insertions, 56 deletions
diff --git a/lib/rbcodec/dsp/dsp_misc.c b/lib/rbcodec/dsp/dsp_misc.c index a19ef52883..40d198ff50 100644 --- a/lib/rbcodec/dsp/dsp_misc.c +++ b/lib/rbcodec/dsp/dsp_misc.c | |||
@@ -116,7 +116,7 @@ static void dsp_pitch_update(struct dsp_config *dsp) | |||
116 | fp_div(pitch_ratio, PITCH_SPEED_100, 16)); | 116 | fp_div(pitch_ratio, PITCH_SPEED_100, 16)); |
117 | } | 117 | } |
118 | 118 | ||
119 | static void dsp_set_pitch(int32_t percent) | 119 | void dsp_set_pitch(int32_t percent) |
120 | { | 120 | { |
121 | if (percent <= 0) | 121 | if (percent <= 0) |
122 | percent = PITCH_SPEED_100; | 122 | percent = PITCH_SPEED_100; |
@@ -128,50 +128,12 @@ static void dsp_set_pitch(int32_t percent) | |||
128 | 128 | ||
129 | dsp_pitch_update(dsp_get_config(CODEC_IDX_AUDIO)); | 129 | dsp_pitch_update(dsp_get_config(CODEC_IDX_AUDIO)); |
130 | } | 130 | } |
131 | #endif /* HAVE_PITCHCONTROL */ | ||
132 | |||
133 | |||
134 | /** Firmware callback interface **/ | ||
135 | 131 | ||
136 | /* Hook back from firmware/ part of audio, which can't/shouldn't call apps/ | 132 | int32_t dsp_get_pitch(void) |
137 | * code directly. */ | ||
138 | int dsp_callback(int msg, intptr_t param) | ||
139 | { | 133 | { |
140 | int retval = 0; | 134 | return pitch_ratio; |
141 | |||
142 | switch (msg) | ||
143 | { | ||
144 | #ifdef HAVE_SW_TONE_CONTROLS | ||
145 | case DSP_CALLBACK_SET_PRESCALE: | ||
146 | tone_set_prescale(param); | ||
147 | break; | ||
148 | case DSP_CALLBACK_SET_BASS: | ||
149 | tone_set_bass(param); | ||
150 | break; | ||
151 | case DSP_CALLBACK_SET_TREBLE: | ||
152 | tone_set_treble(param); | ||
153 | break; | ||
154 | #endif /* HAVE_SW_TONE_CONTROLS */ | ||
155 | case DSP_CALLBACK_SET_CHANNEL_CONFIG: | ||
156 | channel_mode_set_config(param); | ||
157 | break; | ||
158 | case DSP_CALLBACK_SET_STEREO_WIDTH: | ||
159 | channel_mode_custom_set_width(param); | ||
160 | break; | ||
161 | #ifdef HAVE_PITCHCONTROL | ||
162 | case DSP_CALLBACK_SET_PITCH: | ||
163 | dsp_set_pitch(param); | ||
164 | break; | ||
165 | case DSP_CALLBACK_GET_PITCH: | ||
166 | retval = pitch_ratio; | ||
167 | break; | ||
168 | #endif /* HAVE_PITCHCONTROL */ | ||
169 | default: | ||
170 | break; | ||
171 | } | ||
172 | |||
173 | return retval; | ||
174 | } | 135 | } |
136 | #endif /* HAVE_PITCHCONTROL */ | ||
175 | 137 | ||
176 | static void INIT_ATTR misc_dsp_init(struct dsp_config *dsp, | 138 | static void INIT_ATTR misc_dsp_init(struct dsp_config *dsp, |
177 | enum dsp_ids dsp_id) | 139 | enum dsp_ids dsp_id) |
diff --git a/lib/rbcodec/dsp/dsp_misc.h b/lib/rbcodec/dsp/dsp_misc.h index 2583f495c3..2fed9400f2 100644 --- a/lib/rbcodec/dsp/dsp_misc.h +++ b/lib/rbcodec/dsp/dsp_misc.h | |||
@@ -54,18 +54,9 @@ struct dsp_replay_gains | |||
54 | 54 | ||
55 | void dsp_replaygain_set_settings(const struct replaygain_settings *settings); | 55 | void dsp_replaygain_set_settings(const struct replaygain_settings *settings); |
56 | 56 | ||
57 | /* Callback for firmware layers to interface */ | 57 | #ifdef HAVE_PITCHCONTROL |
58 | enum | 58 | void dsp_set_pitch(int32_t pitch); |
59 | { | 59 | int32_t dsp_get_pitch(void); |
60 | DSP_CALLBACK_SET_PRESCALE = 0, | 60 | #endif /* HAVE_PITCHCONTROL */ |
61 | DSP_CALLBACK_SET_BASS, | ||
62 | DSP_CALLBACK_SET_TREBLE, | ||
63 | DSP_CALLBACK_SET_CHANNEL_CONFIG, | ||
64 | DSP_CALLBACK_SET_STEREO_WIDTH, | ||
65 | DSP_CALLBACK_SET_PITCH, | ||
66 | DSP_CALLBACK_GET_PITCH, | ||
67 | }; | ||
68 | |||
69 | int dsp_callback(int msg, intptr_t param); | ||
70 | 61 | ||
71 | #endif /* DSP_MISC_H */ | 62 | #endif /* DSP_MISC_H */ |
diff --git a/lib/rbcodec/test/warble.c b/lib/rbcodec/test/warble.c index 6aabf95d17..735fa2511f 100644 --- a/lib/rbcodec/test/warble.c +++ b/lib/rbcodec/test/warble.c | |||
@@ -387,7 +387,7 @@ static void perform_config(void) | |||
387 | } else if (!strncmp(name, "offset=", 7)) { | 387 | } else if (!strncmp(name, "offset=", 7)) { |
388 | ci.id3->offset = atoi(val); | 388 | ci.id3->offset = atoi(val); |
389 | } else if (!strncmp(name, "rate=", 5)) { | 389 | } else if (!strncmp(name, "rate=", 5)) { |
390 | dsp_callback(DSP_CALLBACK_SET_PITCH, atof(val) * PITCH_SPEED_100); | 390 | dsp_set_pitch(atof(val) * PITCH_SPEED_100); |
391 | } else if (!strncmp(name, "seek=", 5)) { | 391 | } else if (!strncmp(name, "seek=", 5)) { |
392 | codec_action = CODEC_ACTION_SEEK_TIME; | 392 | codec_action = CODEC_ACTION_SEEK_TIME; |
393 | codec_action_param = atoi(val); | 393 | codec_action_param = atoi(val); |