Fix a dircache NULL-pointer dereference.
[kugel-rb.git] / apps / settings.h
blob6a42ca3c0c8233cc5ea84b74e709e15a66dbdaad
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Stuart Martin
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef __SETTINGS_H__
23 #define __SETTINGS_H__
25 #include <stdbool.h>
26 #include <stddef.h>
27 #include "inttypes.h"
28 #include "config.h"
29 #include "statusbar.h" /* for the statusbar values */
30 #include "quickscreen.h"
31 #include "button.h"
32 #if CONFIG_CODEC == SWCODEC
33 #include "audio.h"
34 #endif
36 struct opt_items {
37 unsigned const char* string;
38 int32_t voice_id;
41 /** Setting values defines **/
43 /* name of directory where configuration, fonts and other data
44 * files are stored */
45 #ifdef __PCTOOL__
46 #undef ROCKBOX_DIR
47 #undef ROCKBOX_DIR_LEN
48 #undef WPS_DIR
49 #define ROCKBOX_DIR "."
50 #define ROCKBOX_DIR_LEN 1
51 #else
53 /* ROCKBOX_DIR is now defined in autoconf.h for flexible build types */
54 #ifndef ROCKBOX_DIR
55 #error ROCKBOX_DIR not defined (should be in autoconf.h)
56 #endif
57 #define ROCKBOX_DIR_LEN sizeof(ROCKBOX_DIR)
58 #endif
61 #define FONT_DIR ROCKBOX_DIR "/fonts"
62 #define LANG_DIR ROCKBOX_DIR "/langs"
63 #define WPS_DIR ROCKBOX_DIR "/wps"
64 #define SBS_DIR WPS_DIR
65 #define THEME_DIR ROCKBOX_DIR "/themes"
66 #define ICON_DIR ROCKBOX_DIR "/icons"
68 #define PLUGIN_DIR ROCKBOX_DIR "/rocks"
69 #define PLUGIN_GAMES_DIR PLUGIN_DIR "/games"
70 #define PLUGIN_APPS_DIR PLUGIN_DIR "/apps"
71 #define PLUGIN_DEMOS_DIR PLUGIN_DIR "/demos"
72 #define VIEWERS_DIR PLUGIN_DIR "/viewers"
74 #define BACKDROP_DIR ROCKBOX_DIR "/backdrops"
75 #define REC_BASE_DIR "/"
76 #define EQS_DIR ROCKBOX_DIR "/eqs"
77 #define CODECS_DIR ROCKBOX_DIR "/codecs"
78 #define RECPRESETS_DIR ROCKBOX_DIR "/recpresets"
79 #define FMPRESET_PATH ROCKBOX_DIR "/fmpresets"
80 #define PLAYLIST_CATALOG_DEFAULT_DIR "/Playlists"
82 #define VIEWERS_CONFIG ROCKBOX_DIR "/viewers.config"
83 #define CONFIGFILE ROCKBOX_DIR "/config.cfg"
84 #define FIXEDSETTINGSFILE ROCKBOX_DIR "/fixed.cfg"
86 #define MAX_FILENAME 32
89 enum {
90 BOOKMARK_NO = 0,
91 BOOKMARK_YES,
92 BOOKMARK_ASK,
93 BOOKMARK_UNIQUE_ONLY = 2,
94 BOOKMARK_RECENT_ONLY_YES,
95 BOOKMARK_RECENT_ONLY_ASK,
98 enum
100 TRIG_MODE_OFF = 0,
101 TRIG_MODE_NOREARM,
102 TRIG_MODE_REARM
105 enum
107 TRIG_TYPE_STOP = 0,
108 TRIG_TYPE_PAUSE,
109 TRIG_TYPE_NEW_FILE
112 #ifdef HAVE_CROSSFADE
113 enum {
114 CROSSFADE_ENABLE_OFF = 0,
115 CROSSFADE_ENABLE_AUTOSKIP,
116 CROSSFADE_ENABLE_MANSKIP,
117 CROSSFADE_ENABLE_SHUFFLE,
118 CROSSFADE_ENABLE_SHUFFLE_OR_MANSKIP,
119 CROSSFADE_ENABLE_ALWAYS,
121 #endif
123 enum {
124 FOLDER_ADVANCE_OFF = 0,
125 FOLDER_ADVANCE_NEXT,
126 FOLDER_ADVANCE_RANDOM,
129 /* repeat mode options */
130 enum
132 REPEAT_OFF = 0,
133 REPEAT_ALL,
134 REPEAT_ONE,
135 REPEAT_SHUFFLE,
136 #ifdef AB_REPEAT_ENABLE
137 REPEAT_AB,
138 #endif
139 NUM_REPEAT_MODES
143 /* dir filter options */
144 /* Note: Any new filter modes need to be added before NUM_FILTER_MODES.
145 * Any new rockbox browse filter modes (accessible through the menu)
146 * must be added after NUM_FILTER_MODES. */
147 enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, SHOW_PLAYLIST, SHOW_ID3DB,
148 NUM_FILTER_MODES,
149 SHOW_WPS, SHOW_RWPS, SHOW_SBS, SHOW_RSBS, SHOW_FMR, SHOW_CFG,
150 SHOW_LNG, SHOW_MOD, SHOW_FONT, SHOW_PLUGINS};
152 /* file and dir sort options */
153 enum { SORT_ALPHA, SORT_DATE, SORT_DATE_REVERSED, SORT_TYPE, /* available as settings */
154 SORT_ALPHA_REVERSED, SORT_TYPE_REVERSED }; /* internal use only */
155 enum { SORT_INTERPRET_AS_DIGIT, SORT_INTERPRET_AS_NUMBER };
157 /* recursive dir insert options */
158 enum { RECURSE_OFF, RECURSE_ON, RECURSE_ASK };
160 /* replaygain types */
161 enum { REPLAYGAIN_TRACK = 0, REPLAYGAIN_ALBUM, REPLAYGAIN_SHUFFLE, REPLAYGAIN_OFF };
163 /* show path types */
164 enum { SHOW_PATH_OFF = 0, SHOW_PATH_CURRENT, SHOW_PATH_FULL };
166 /* scrollbar visibility/position */
167 enum { SCROLLBAR_OFF = 0, SCROLLBAR_LEFT, SCROLLBAR_RIGHT };
169 /* Alarm settings */
170 #ifdef HAVE_RTC_ALARM
171 enum { ALARM_START_WPS = 0,
172 #if CONFIG_TUNER
173 ALARM_START_FM,
174 #endif
175 #ifdef HAVE_RECORDING
176 ALARM_START_REC,
177 #endif
178 ALARM_START_COUNT
180 #if CONFIG_TUNER && defined(HAVE_RECORDING)
181 #define ALARM_SETTING_TEXT "wps,fm,rec"
182 #elif CONFIG_TUNER
183 #define ALARM_SETTING_TEXT "wps,fm"
184 #elif defined(HAVE_RECORDING)
185 #define ALARM_SETTING_TEXT "wps,rec"
186 #endif
188 #endif /* HAVE_RTC_ALARM */
190 /* Keyclick stuff */
192 /* Not really a setting but several files should stay synced */
193 #define KEYCLICK_DURATION 2
195 /** virtual pointer stuff.. move to another .h maybe? **/
196 /* These define "virtual pointers", which could either be a literal string,
197 or a mean a string ID if the pointer is in a certain range.
198 This helps to save space for menus and options. */
200 #define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */
201 #if defined(CPU_S5L870X)
202 /* the S5L870X has IRAM at 0, so we use 0xffff bytes right after that */
203 #define VIRT_PTR ((unsigned char*)0x40000)
204 #elif CONFIG_CPU==DM320
205 /* the DM320 has IRAM at 0, so we use 0xffff bytes right after that */
206 #define VIRT_PTR ((unsigned char*)0x4000)
207 #else
208 /* a location where we won't store strings, 0 is the fastest */
209 #define VIRT_PTR ((unsigned char*)0)
210 #endif
212 /* form a "virtual pointer" out of a language ID */
213 #define ID2P(id) (VIRT_PTR + id)
215 /* resolve a pointer which could be a virtualized ID or a literal */
216 #define P2STR(p) (char *)((p>=VIRT_PTR && p<VIRT_PTR+VIRT_SIZE) ? str(p-VIRT_PTR) : p)
218 /* get the string ID from a virtual pointer, -1 if not virtual */
219 #define P2ID(p) ((p>=VIRT_PTR && p<VIRT_PTR+VIRT_SIZE) ? p-VIRT_PTR : -1)
221 /* !defined(HAVE_LCD_COLOR) implies HAVE_LCD_CONTRAST with default 40.
222 Explicitly define HAVE_LCD_CONTRAST in config file for newer ports for
223 simplicity. */
227 /** function prototypes **/
229 /* argument bits for settings_load() */
230 #define SETTINGS_RTC (BIT_N(0)) /* only the settings from the RTC nonvolatile RAM */
231 #define SETTINGS_HD (BIT_N(1)) /* only the settings from the disk sector */
232 #define SETTINGS_ALL (SETTINGS_RTC|SETTINGS_HD) /* both */
233 void settings_load(int which);
234 bool settings_load_config(const char* file, bool apply);
236 void status_save(void);
237 int settings_save(void);
238 /* defines for the options paramater */
239 enum {
240 SETTINGS_SAVE_CHANGED = 0,
241 SETTINGS_SAVE_ALL,
242 SETTINGS_SAVE_THEME,
243 SETTINGS_SAVE_SOUND,
244 #ifdef HAVE_RECORDING
245 SETTINGS_SAVE_RECPRESETS,
246 #endif
247 #if CONFIG_CODEC == SWCODEC
248 SETTINGS_SAVE_EQPRESET,
249 #endif
251 bool settings_save_config(int options);
253 struct settings_list;
254 void reset_setting(const struct settings_list *setting, void *var);
255 void settings_reset(void);
256 void sound_settings_apply(void);
258 /* call this after loading a .wps/.rwps pr other skin files, so that the
259 * skin buffer is reset properly
261 void settings_apply_skins(void);
263 void settings_apply(bool read_disk);
264 void settings_apply_pm_range(void);
265 void settings_display(void);
267 enum optiontype { INT, BOOL };
269 const struct settings_list* find_setting(const void* variable, int *id);
270 bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len);
271 bool cfg_to_string(int setting_id, char* buf, int buf_len);
272 bool set_bool_options(const char* string, const bool* variable,
273 const char* yes_str, int yes_voice,
274 const char* no_str, int no_voice,
275 void (*function)(bool));
277 bool set_bool(const char* string, const bool* variable);
278 bool set_int(const unsigned char* string, const char* unit, int voice_unit,
279 const int* variable,
280 void (*function)(int), int step, int min, int max,
281 const char* (*formatter)(char*, size_t, int, const char*) );
283 /* use this one if you need to create a lang from the value (i.e with TALK_ID()) */
284 bool set_int_ex(const unsigned char* string, const char* unit, int voice_unit,
285 const int* variable,
286 void (*function)(int), int step, int min, int max,
287 const char* (*formatter)(char*, size_t, int, const char*),
288 int32_t (*get_talk_id)(int, int));
290 void set_file(const char* filename, char* setting, int maxlen);
292 bool set_option(const char* string, const void* variable, enum optiontype type,
293 const struct opt_items* options, int numoptions, void (*function)(int));
297 /** global_settings and global_status struct definitions **/
299 struct system_status
301 int resume_index; /* index in playlist (-1 for no active resume) */
302 uint32_t resume_offset; /* byte offset in mp3 file */
303 int runtime; /* current runtime since last charge */
304 int topruntime; /* top known runtime */
305 #ifdef HAVE_DIRCACHE
306 int dircache_size; /* directory cache structure last size, 22 bits */
307 #endif
308 #if CONFIG_TUNER
309 int last_frequency; /* Last frequency for resuming, in FREQ_STEP units,
310 relative to MIN_FREQ */
311 #endif
312 signed char last_screen;
313 int viewer_icon_count;
314 int last_volume_change; /* tick the last volume change happened. skins use this */
317 struct user_settings
319 /* audio settings */
321 int volume; /* audio output volume in decibels range depends on the dac */
322 int balance; /* stereo balance: 0-100 0=left 50=bal 100=right */
323 int bass; /* bass boost/cut in decibels */
324 int treble; /* treble boost/cut in decibels */
325 int channel_config; /* Stereo, Mono, Custom, Mono left, Mono right, Karaoke */
326 int stereo_width; /* 0-255% */
328 #if CONFIG_CODEC != SWCODEC
329 int loudness; /* loudness eq: 0-100 0=off 100=max */
330 int avc; /* auto volume correct: 0=off, 1=20ms, 2=2s 3=4s 4=8s */
331 int mdb_strength; /* 0-127dB */
332 int mdb_harmonics; /* 0-100% */
333 int mdb_center; /* 20-300Hz */
334 int mdb_shape; /* 50-300Hz */
335 bool mdb_enable; /* true/false */
336 bool superbass; /* true/false */
337 #endif
339 #ifdef HAVE_WM8758
340 int bass_cutoff;
341 int treble_cutoff;
342 #endif
344 #if CONFIG_CODEC == SWCODEC
345 #ifdef HAVE_CROSSFADE
346 /* Crossfade */
347 int crossfade; /* Enable crossfade (0=off, 1=shuffle, 2=trackskip,
348 3=shuff&trackskip, 4=always) */
349 int crossfade_fade_in_delay; /* Fade in delay (0-15s) */
350 int crossfade_fade_out_delay; /* Fade out delay (0-15s) */
351 int crossfade_fade_in_duration; /* Fade in duration (0-15s) */
352 int crossfade_fade_out_duration; /* Fade out duration (0-15s) */
353 int crossfade_fade_out_mixmode; /* Fade out mode (0=crossfade,1=mix) */
354 #endif
356 /* Replaygain */
357 bool replaygain_noclip; /* scale to prevent clips */
358 int replaygain_type; /* 0=track gain, 1=album gain, 2=track gain if
359 shuffle is on, album gain otherwise, 4=off */
360 int replaygain_preamp; /* scale replaygained tracks by this */
362 /* Crossfeed */
363 bool crossfeed; /* enable crossfeed */
364 unsigned int crossfeed_direct_gain; /* dB x 10 */
365 unsigned int crossfeed_cross_gain; /* dB x 10 */
366 unsigned int crossfeed_hf_attenuation; /* dB x 10 */
367 unsigned int crossfeed_hf_cutoff; /* Frequency in Hz */
369 /* EQ */
370 bool eq_enabled; /* Enable equalizer */
371 unsigned int eq_precut; /* dB */
373 /* Order is important here, must be cutoff, q, then gain for each band.
374 See dsp_set_eq_coefs in dsp.c for why. */
376 /* Band 0 settings */
377 int eq_band0_cutoff; /* Hz */
378 int eq_band0_q;
379 int eq_band0_gain; /* +/- dB */
381 /* Band 1 settings */
382 int eq_band1_cutoff; /* Hz */
383 int eq_band1_q;
384 int eq_band1_gain; /* +/- dB */
386 /* Band 2 settings */
387 int eq_band2_cutoff; /* Hz */
388 int eq_band2_q;
389 int eq_band2_gain; /* +/- dB */
391 /* Band 3 settings */
392 int eq_band3_cutoff; /* Hz */
393 int eq_band3_q;
394 int eq_band3_gain; /* +/- dB */
396 /* Band 4 settings */
397 int eq_band4_cutoff; /* Hz */
398 int eq_band4_q;
399 int eq_band4_gain; /* +/- dB */
401 /* Misc. swcodec */
402 int beep; /* system beep volume when changing tracks etc. */
403 int keyclick; /* keyclick volume */
404 int keyclick_repeats; /* keyclick on repeats */
405 bool dithering_enabled;
406 bool timestretch_enabled;
407 #endif /* CONFIG_CODEC == SWCODEC */
409 #ifdef HAVE_RECORDING
410 #if CONFIG_CODEC == SWCODEC
411 int rec_format; /* record format index */
412 int rec_mono_mode; /* how to create mono: L, R, L+R */
414 /* Encoder Settings Start - keep these together */
415 struct mp3_enc_config mp3_enc_config;
416 #if 0 /* These currently contain no members but their places in line
417 should be held */
418 struct aiff_enc_config aiff_enc_config;
419 struct wav_enc_config wav_enc_config;
420 struct wavpack_enc_config wavpack_enc_config;
421 #endif
422 /* Encoder Settings End */
424 #else
425 int rec_quality; /* 0-7 */
426 #endif /* CONFIG_CODEC == SWCODEC */
427 int rec_source; /* 0=mic, 1=line, 2=S/PDIF, 2 or 3=FM Radio */
428 int rec_frequency; /* 0 = 44.1kHz (depends on target)
429 1 = 48kHz
430 2 = 32kHz
431 3 = 22.05kHz
432 4 = 24kHz
433 5 = 16kHz */
434 int rec_channels; /* 0=Stereo, 1=Mono */
436 int rec_mic_gain; /* depends on target */
437 int rec_left_gain; /* depends on target */
438 int rec_right_gain; /* depends on target */
439 bool peak_meter_clipcounter; /* clipping count indicator */
440 bool rec_editable; /* true means that the bit reservoir is off */
442 /* note: timesplit setting is not saved */
443 int rec_timesplit; /* 0 = off,
444 1 = 00:05, 2 = 00:10, 3 = 00:15, 4 = 00:30
445 5 = 01:00, 6 = 02:00, 7 = 04:00, 8 = 06:00
446 9 = 08:00, 10= 10:00, 11= 12:00, 12= 18:00,
447 13= 24:00 */
448 int rec_sizesplit; /* 0 = off,
449 1 = 5MB, 2 = 10MB, 3 = 15MB, 4 = 32MB
450 5 = 64MB, 6 = 75MB, 7 = 100MB, 8 = 128MB
451 9 = 256MB, 10= 512MB, 11= 650MB, 12= 700MB,
452 13= 1GB, 14 = 1.5GB 15 = 1.75MB*/
453 int rec_split_type; /* split/stop */
454 int rec_split_method; /* time/filesize */
456 int rec_prerecord_time; /* In seconds, 0-30, 0 means OFF */
457 char rec_directory[MAX_FILENAME+1];
458 int cliplight; /* 0 = off
459 1 = main lcd
460 2 = main and remote lcd
461 3 = remote lcd */
463 int rec_start_thres_db;
464 int rec_start_thres_linear;
465 int rec_start_duration; /* index of trig_durations */
466 int rec_stop_thres_db;
467 int rec_stop_thres_linear;
468 int rec_stop_postrec;
469 int rec_stop_gap; /* index of trig_durations */
470 int rec_trigger_mode; /* see TRIG_MODE_XXX constants */
471 int rec_trigger_type; /* what to do when trigger released */
473 #ifdef HAVE_AGC
474 int rec_agc_preset_mic; /* AGC mic preset modes:
475 0 = Off
476 1 = Safety (clip)
477 2 = Live (slow)
478 3 = DJ-Set (slow)
479 4 = Medium
480 5 = Voice (fast) */
481 int rec_agc_preset_line; /* AGC line-in preset modes:
482 0 = Off
483 1 = Safety (clip)
484 2 = Live (slow)
485 3 = DJ-Set (slow)
486 4 = Medium
487 5 = Voice (fast) */
488 int rec_agc_maxgain_mic; /* AGC maximum mic gain */
489 int rec_agc_maxgain_line; /* AGC maximum line-in gain */
490 int rec_agc_cliptime; /* 0.2, 0.4, 0.6, 0.8, 1s */
491 #endif
492 #endif /* HAVE_RECORDING */
494 #if CONFIG_TUNER
495 int fm_region;
496 bool fm_force_mono; /* Forces Mono mode if true */
497 unsigned char fmr_file[MAX_FILENAME+1]; /* last fmr preset */
498 #endif
500 /* misc options */
501 #ifndef HAVE_WHEEL_ACCELERATION
502 int list_accel_start_delay; /* ms before we start increaseing step size */
503 int list_accel_wait; /* ms between increases */
504 #endif
506 #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
507 int touchpad_sensitivity;
508 #endif
510 #ifdef HAVE_HEADPHONE_DETECTION
511 int unplug_mode; /* pause on headphone unplug */
512 int unplug_rw; /* time in s to rewind when pausing */
513 bool unplug_autoresume; /* disable auto-resume if no phones */
514 #endif
516 #ifdef HAVE_QUICKSCREEN
517 int qs_items[QUICKSCREEN_ITEM_COUNT];
518 #endif
520 #if CONFIG_RTC
521 int timeformat; /* time format: 0=24 hour clock, 1=12 hour clock */
522 #endif
524 #ifdef HAVE_DISK_STORAGE
525 int disk_spindown; /* time until disk spindown, in seconds (0=off) */
526 int buffer_margin; /* audio buffer watermark margin, in seconds */
527 #endif
529 int dirfilter; /* 0=display all, 1=only supported, 2=only music,
530 3=dirs+playlists, 4=ID3 database */
531 int show_filename_ext; /* show filename extensions in file browser?
532 0 = no, 1 = yes, 2 = only unknown 0 */
533 int default_codepage; /* set default codepage for tag conversion */
534 bool hold_lr_for_scroll_in_list; /* hold L/R scrolls the list left/right */
535 bool play_selected; /* Plays selected file even in shuffle mode */
536 bool party_mode; /* party mode - unstoppable music */
537 bool audioscrobbler; /* Audioscrobbler logging */
538 bool cuesheet;
539 bool car_adapter_mode; /* 0=off 1=on */
540 int start_in_screen;
541 #if defined(HAVE_RTC_ALARM) && \
542 (defined(HAVE_RECORDING) || CONFIG_TUNER)
543 int alarm_wake_up_screen;
544 #endif
545 int ff_rewind_min_step; /* FF/Rewind minimum step size */
546 int ff_rewind_accel; /* FF/Rewind acceleration (in seconds per doubling) */
548 int peak_meter_release; /* units per read out */
549 int peak_meter_hold; /* hold time for peak meter in 1/100 s */
550 int peak_meter_clip_hold; /* hold time for clips */
551 bool peak_meter_dbfs; /* show linear or dbfs values */
552 int peak_meter_min; /* range minimum */
553 int peak_meter_max; /* range maximum */
555 unsigned char wps_file[MAX_FILENAME+1]; /* last wps */
556 #ifdef HAVE_LCD_BITMAP
557 unsigned char sbs_file[MAX_FILENAME+1]; /* last statusbar skin */
558 #endif
559 #ifdef HAVE_REMOTE_LCD
560 unsigned char rwps_file[MAX_FILENAME+1]; /* last remote-wps */
561 unsigned char rsbs_file[MAX_FILENAME+1]; /* last remote statusbar skin */
562 #endif
563 unsigned char lang_file[MAX_FILENAME+1]; /* last language */
564 unsigned char playlist_catalog_dir[MAX_FILENAME+1];
565 int skip_length; /* skip length */
566 int max_files_in_dir; /* Max entries in directory (file browser) */
567 int max_files_in_playlist; /* Max entries in playlist */
568 int volume_type; /* how volume is displayed: 0=graphic, 1=percent */
569 int battery_display; /* how battery is displayed: 0=graphic, 1=percent */
570 bool show_icons; /* 0=hide 1=show */
571 int statusbar; /* STATUSBAR_* enum values */
572 #ifdef HAVE_REMOTE_LCD
573 int remote_statusbar;
574 #endif
576 #if CONFIG_KEYPAD == RECORDER_PAD
577 bool buttonbar; /* 0=hide, 1=show */
578 #endif
580 #ifdef HAVE_LCD_BITMAP
581 int scrollbar; /* SCROLLBAR_* enum values */
582 int scrollbar_width;
583 #endif
585 /* goto current song when exiting WPS */
586 bool browse_current; /* 1=goto current song,
587 0=goto previous location */
588 bool scroll_paginated; /* 0=dont 1=do */
589 int scroll_speed; /* long texts scrolling speed: 1-30 */
590 int bidir_limit; /* bidir scroll length limit */
591 int scroll_delay; /* delay (in 1/10s) before starting scroll */
592 int scroll_step; /* pixels to advance per update */
594 /* auto bookmark settings */
595 int autoloadbookmark; /* auto load option: 0=off, 1=ask, 2=on */
596 int autocreatebookmark; /* auto create option: 0=off, 1=ask, 2=on */
597 int usemrb; /* use MRB list: 0=No, 1=Yes*/
599 #ifdef HAVE_DIRCACHE
600 bool dircache; /* enable directory cache */
601 #endif
602 #ifdef HAVE_TAGCACHE
603 #ifdef HAVE_TC_RAMCACHE
604 bool tagcache_ram; /* load tagcache to ram? */
605 #endif
606 bool tagcache_autoupdate; /* automatically keep tagcache in sync? */
607 bool runtimedb; /* runtime database active? */
608 #endif /* HAVE_TAGCACHE */
610 #if LCD_DEPTH > 1
611 unsigned char backdrop_file[MAX_FILENAME+1]; /* backdrop bitmap file */
612 #endif
614 #ifdef HAVE_LCD_COLOR
615 int bg_color; /* background color native format */
616 int fg_color; /* foreground color native format */
617 int lss_color; /* background color for the selector or start color for the gradient */
618 int lse_color; /* end color for the selector gradient */
619 int lst_color; /* color of the text for the selector */
620 unsigned char colors_file[MAX_FILENAME+1];
621 #endif
623 /* playlist/playback settings */
624 int repeat_mode; /* 0=off 1=repeat all 2=repeat one 3=shuffle 4=ab */
625 int next_folder; /* move to next folder */
626 int recursive_dir_insert; /* should directories be inserted recursively */
627 bool fade_on_stop; /* fade on pause/unpause/stop */
628 bool playlist_shuffle;
629 bool warnon_erase_dynplaylist; /* warn when erasing dynamic playlist */
631 /* playlist viewer settings */
632 bool playlist_viewer_icons; /* display icons on viewer */
633 bool playlist_viewer_indices; /* display playlist indices on viewer */
634 int playlist_viewer_track_display; /* how to display tracks in viewer */
636 /* voice UI settings */
637 bool talk_menu; /* enable voice UI */
638 int talk_dir; /* voiced directories mode: 0=off 1=number 2=spell */
639 bool talk_dir_clip; /* use directory .talk clips */
640 int talk_file; /* voice file mode: 0=off, 1=number, 2=spell */
641 bool talk_file_clip; /* use file .talk clips */
642 bool talk_filetype; /* say file type */
643 bool talk_battery_level;
645 /* file browser sorting */
646 bool sort_case; /* dir sort order: 0=case insensitive, 1=sensitive */
647 int sort_dir; /* 0=alpha, 1=date (old first), 2=date (new first) */
648 int sort_file; /* 0=alpha, 1=date, 2=date (new first), 3=type */
649 int interpret_numbers; /* true=strnatcmp, false=strcmp */
651 /* power settings */
652 int poweroff; /* idle power off timer */
653 int battery_capacity; /* in mAh */
655 #if BATTERY_TYPES_COUNT > 1
656 int battery_type; /* for units which can take multiple types (Ondio). */
657 #endif
658 #ifdef HAVE_SPDIF_POWER
659 bool spdif_enable; /* S/PDIF power on/off */
660 #endif
661 #ifdef HAVE_USB_CHARGING_ENABLE
662 bool usb_charging;
663 #endif
665 /* device settings */
666 #ifdef HAVE_LCD_CONTRAST
667 int contrast; /* lcd contrast */
668 #endif
670 #ifdef HAVE_LCD_BITMAP
671 #ifdef HAVE_LCD_INVERT
672 bool invert; /* invert display */
673 #endif
674 #ifdef HAVE_LCD_FLIP
675 bool flip_display; /* turn display (and button layout) by 180 degrees */
676 #endif
677 int cursor_style; /* style of the selection cursor */
678 int screen_scroll_step;
679 int show_path_in_browser; /* 0=off, 1=current directory, 2=full path */
680 bool offset_out_of_view;
681 unsigned char icon_file[MAX_FILENAME+1];
682 unsigned char viewers_icon_file[MAX_FILENAME+1];
683 unsigned char font_file[MAX_FILENAME+1]; /* last font */
684 #ifdef HAVE_REMOTE_LCD
685 unsigned char remote_font_file[MAX_FILENAME+1]; /* last font */
686 #endif
687 unsigned char kbd_file[MAX_FILENAME+1]; /* last keyboard */
688 #endif /* HAVE_LCD_BITMAP */
690 #ifdef HAVE_LCD_CHARCELLS
691 int jump_scroll; /* Fast jump when scrolling */
692 int jump_scroll_delay; /* Delay between jump scroll screens */
693 #endif
695 int backlight_timeout; /* backlight off timeout: 0-18 0=never,
696 1=always,
697 then according to timeout_values[] */
698 bool caption_backlight; /* turn on backlight at end and start of track */
699 bool bl_filter_first_keypress; /* filter first keypress when dark? */
700 #if CONFIG_CHARGING
701 int backlight_timeout_plugged;
702 #endif
703 #ifdef HAVE_BACKLIGHT
704 #ifdef HAS_BUTTON_HOLD
705 int backlight_on_button_hold; /* what to do with backlight when hold
706 switch is on */
707 #endif
708 #ifdef HAVE_LCD_SLEEP_SETTING
709 int lcd_sleep_after_backlight_off; /* when to put lcd to sleep after backlight
710 has turned off */
711 #endif
712 #endif
713 #if defined(HAVE_BACKLIGHT_FADING_INT_SETTING)
714 int backlight_fade_in; /* backlight fade in timing: 0..3 */
715 int backlight_fade_out; /* backlight fade in timing: 0..7 */
716 #elif defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
717 bool backlight_fade_in;
718 bool backlight_fade_out;
719 #endif
720 #ifdef HAVE_BACKLIGHT_BRIGHTNESS
721 int brightness;
722 #endif
724 #ifdef HAVE_REMOTE_LCD
725 /* remote lcd */
726 int remote_contrast; /* lcd contrast: 0-63 0=low 63=high */
727 int remote_backlight_timeout; /* backlight off timeout: 0-18 0=never,
728 1=always, then according to timeout_values[] */
729 int remote_backlight_timeout_plugged;
730 int remote_scroll_speed; /* long texts scrolling speed: 1-30 */
731 int remote_scroll_delay; /* delay (in 1/10s) before starting scroll */
732 int remote_scroll_step; /* pixels to advance per update */
733 int remote_bidir_limit; /* bidir scroll length limit */
734 bool remote_invert; /* invert display */
735 bool remote_flip_display; /* turn display (and button layout) by 180 degrees */
736 bool remote_caption_backlight; /* turn on backlight at end and start of track */
737 bool remote_bl_filter_first_keypress; /* filter first remote keypress when remote dark? */
738 unsigned char remote_icon_file[MAX_FILENAME+1];
739 unsigned char remote_viewers_icon_file[MAX_FILENAME+1];
740 #ifdef HAS_REMOTE_BUTTON_HOLD
741 int remote_backlight_on_button_hold; /* what to do with remote backlight when hold
742 switch is on */
743 #endif
744 #ifdef HAVE_REMOTE_LCD_TICKING
745 bool remote_reduce_ticking; /* 0=normal operation,
746 1=EMI reduce on with cost more CPU. */
747 #endif
748 #endif /* HAVE_REMOTE_LCD */
750 #if CONFIG_CODEC == MAS3507D
751 bool line_in; /* false=off, true=active */
752 #endif
754 #ifdef HAVE_BUTTON_LIGHT
755 int buttonlight_timeout;
756 #endif
757 #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
758 int buttonlight_brightness;
759 #endif
761 #ifdef IPOD_ACCESSORY_PROTOCOL
762 int serial_bitrate; /* 0=auto 1=9600 2=19200 3=38400 4=57600 */
763 #endif
764 #ifdef HAVE_ACCESSORY_SUPPLY
765 bool accessory_supply; /* 0=off 1=on, accessory power supply for iPod */
766 #endif
768 #ifdef HAVE_SPEAKER
769 bool speaker_enabled;
770 #endif
771 bool prevent_skip;
773 #ifdef HAVE_TOUCHSCREEN
774 int touch_mode;
775 struct touchscreen_parameter ts_calibration_data;
776 #endif
778 #ifdef HAVE_PITCHSCREEN
779 /* pitch screen settings */
780 bool pitch_mode_semitone;
781 #if CONFIG_CODEC == SWCODEC
782 bool pitch_mode_timestretch;
783 #endif
784 #endif
785 /* If values are just added to the end, no need to bump plugin API
786 version. */
787 /* new stuff to be added at the end */
789 #ifdef USB_ENABLE_HID
790 bool usb_hid;
791 int usb_keypad_mode;
792 #endif
794 #ifdef HAVE_LCD_BITMAP
795 unsigned char ui_vp_config[64]; /* viewport string for the lists */
796 #ifdef HAVE_REMOTE_LCD
797 unsigned char remote_ui_vp_config[64]; /* viewport string for the remote lists */
798 #endif
799 #endif
801 #if CONFIG_CODEC == SWCODEC
802 int compressor_threshold;
803 int compressor_makeup_gain;
804 int compressor_ratio;
805 int compressor_knee;
806 int compressor_release_time;
807 #endif
809 #ifdef HAVE_MORSE_INPUT
810 bool morse_input; /* text input method setting */
811 #endif
815 /** global variables **/
816 extern long lasttime;
817 /* global settings */
818 extern struct user_settings global_settings;
819 /* global status */
820 extern struct system_status global_status;
822 #endif /* __SETTINGS_H__ */