summaryrefslogtreecommitdiff
path: root/apps/menus/playback_menu.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2013-05-23 13:58:51 -0400
committerMichael Sevakis <jethead71@rockbox.org>2013-07-06 04:22:04 +0200
commitd37bf24d9011addbfbd40942a4e9bbf26de7df00 (patch)
treedafb7eaeb494081668a4841d490fce2bfbb2438d /apps/menus/playback_menu.c
parent00faabef5e902008172e08d3bcd77683cbafef51 (diff)
downloadrockbox-d37bf24d9011addbfbd40942a4e9bbf26de7df00.tar.gz
rockbox-d37bf24d9011addbfbd40942a4e9bbf26de7df00.zip
Enable setting of global output samplerate on certain targets.
Replaces the NATIVE_FREQUENCY constant with a configurable frequency. The user may select 48000Hz if the hardware supports it. The default is still 44100Hz and the minimum is 44100Hz. The setting is located in the playback settings, under "Frequency". "Frequency" was duplicated in english.lang for now to avoid having to fix every .lang file for the moment and throwing everything out of sync because of the new play_frequency feature in features.txt. The next cleanup should combine it with the one included for recording and generalize the ID label. If the hardware doesn't support 48000Hz, no setting will be available. On particular hardware where very high rates are practical and desireable, the upper bound can be extended by patching. The PCM mixer can be configured to play at the full hardware frequency range. The DSP core can configure to the hardware minimum up to the maximum playback setting (some buffers must be reserved according to the maximum rate). If only 44100Hz is supported or possible on a given target for playback, using the DSP and mixer at other samperates is possible if the hardware offers them. Change-Id: I6023cf0c0baa8bc6292b6919b4dd3618a6a25622 Reviewed-on: http://gerrit.rockbox.org/479 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
Diffstat (limited to 'apps/menus/playback_menu.c')
-rw-r--r--apps/menus/playback_menu.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c
index 6beda93991..89472d45b9 100644
--- a/apps/menus/playback_menu.c
+++ b/apps/menus/playback_menu.c
@@ -37,6 +37,10 @@
37#include "misc.h" 37#include "misc.h"
38#if CONFIG_CODEC == SWCODEC 38#if CONFIG_CODEC == SWCODEC
39#include "playback.h" 39#include "playback.h"
40#include "pcm_sampr.h"
41#ifdef HAVE_PLAY_FREQ
42#include "talk.h"
43#endif
40#endif 44#endif
41 45
42 46
@@ -192,6 +196,10 @@ MENUITEM_SETTING(prevent_skip, &global_settings.prevent_skip, NULL);
192MENUITEM_SETTING(resume_rewind, &global_settings.resume_rewind, NULL); 196MENUITEM_SETTING(resume_rewind, &global_settings.resume_rewind, NULL);
193#endif 197#endif
194MENUITEM_SETTING(pause_rewind, &global_settings.pause_rewind, NULL); 198MENUITEM_SETTING(pause_rewind, &global_settings.pause_rewind, NULL);
199#ifdef HAVE_PLAY_FREQ
200MENUITEM_SETTING(play_frequency, &global_settings.play_frequency,
201 playback_callback);
202#endif
195 203
196MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, 204MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
197 Icon_Playback_menu, 205 Icon_Playback_menu,
@@ -217,12 +225,15 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
217#ifdef HAVE_HEADPHONE_DETECTION 225#ifdef HAVE_HEADPHONE_DETECTION
218 ,&unplug_menu 226 ,&unplug_menu
219#endif 227#endif
220 ,&skip_length, &prevent_skip, 228 ,&skip_length, &prevent_skip
221 229
222#if CONFIG_CODEC == SWCODEC 230#if CONFIG_CODEC == SWCODEC
223 &resume_rewind, 231 ,&resume_rewind
232#endif
233 ,&pause_rewind
234#ifdef HAVE_PLAY_FREQ
235 ,&play_frequency
224#endif 236#endif
225 &pause_rewind,
226 ); 237 );
227 238
228static int playback_callback(int action,const struct menu_item_ex *this_item) 239static int playback_callback(int action,const struct menu_item_ex *this_item)
@@ -243,9 +254,19 @@ static int playback_callback(int action,const struct menu_item_ex *this_item)
243 break; 254 break;
244 255
245 case ACTION_EXIT_MENUITEM: /* on exit */ 256 case ACTION_EXIT_MENUITEM: /* on exit */
257 /* Playing or not */
258#ifdef HAVE_PLAY_FREQ
259 if (this_item == &play_frequency)
260 {
261 settings_apply_play_freq(global_settings.play_frequency, false);
262 break;
263 }
264#endif /* HAVE_PLAY_FREQ */
265
246 if (!(audio_status() & AUDIO_STATUS_PLAY)) 266 if (!(audio_status() & AUDIO_STATUS_PLAY))
247 break; 267 break;
248 268
269 /* Playing only */
249 if (this_item == &shuffle_item) 270 if (this_item == &shuffle_item)
250 { 271 {
251 if (old_shuffle == global_settings.playlist_shuffle) 272 if (old_shuffle == global_settings.playlist_shuffle)