blob: 6b34543c277e332ec2588566e73433c2372675be [file] [log] [blame]
Björn Stenbergf80d8a702002-06-27 00:20:00 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by wavey@wavey.org
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#ifndef __SETTINGS_H__
21#define __SETTINGS_H__
22
23#include <stdbool.h>
Hardeep Sidhue9d40582003-07-15 02:34:10 +000024#include "config.h"
Björn Stenberg6224cdb2002-08-16 14:41:47 +000025#include "file.h"
Miika Pekkarinenab78b042005-10-07 17:38:05 +000026#include "dircache.h"
Linus Nielsen Feltzing7ddf0d62004-04-20 10:23:57 +000027#include "timefuncs.h"
Linus Nielsen Feltzing0ad617c2005-08-21 23:01:12 +000028#include "abrepeat.h"
Björn Stenbergf80d8a702002-06-27 00:20:00 +000029
Björn Stenberg26964fd2002-09-01 19:50:45 +000030#define ROCKBOX_DIR "/.rockbox"
Linus Nielsen Feltzingd887c172005-09-01 08:14:09 +000031#define ROCKBOX_DIR_LEN 9
Daniel Stenberg0f689582004-01-08 12:40:25 +000032#define FONT_DIR "/fonts"
33#define LANG_DIR "/langs"
Daniel Stenberg0b4576c2005-11-12 21:48:06 +000034#define WPS_DIR ROCKBOX_DIR "/wps"
Christi Scarborough32a43e22005-11-18 15:33:05 +000035#define THEME_DIR ROCKBOX_DIR "/themes"
Björn Stenbergde5477c2003-09-29 21:26:53 +000036#define PLUGIN_DIR ROCKBOX_DIR"/rocks"
Linus Nielsen Feltzingef7293f2004-01-21 14:58:40 +000037#define REC_BASE_DIR "/recordings"
Björn Stenberg26964fd2002-09-01 19:50:45 +000038
Björn Stenbergdea31222002-10-08 15:42:40 +000039#define MAX_FILENAME 20
40
Björn Stenberg6c33c512004-09-19 21:58:37 +000041/* button definitions */
Daniel Stenberg1753e982005-06-18 21:38:05 +000042#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
43 (CONFIG_KEYPAD == IRIVER_H300_PAD)
Linus Nielsen Feltzinge68ccbd2004-11-19 10:54:59 +000044#define SETTINGS_INC BUTTON_UP
45#define SETTINGS_DEC BUTTON_DOWN
46#define SETTINGS_OK BUTTON_SELECT
47#define SETTINGS_OK2 BUTTON_LEFT
48#define SETTINGS_CANCEL BUTTON_OFF
Jens Arnold9ed26cb2005-06-18 08:41:16 +000049#define SETTINGS_CANCEL2 BUTTON_MODE
Linus Nielsen Feltzinge68ccbd2004-11-19 10:54:59 +000050
51#elif CONFIG_KEYPAD == RECORDER_PAD
Björn Stenberg6c33c512004-09-19 21:58:37 +000052#define SETTINGS_INC BUTTON_UP
53#define SETTINGS_DEC BUTTON_DOWN
Björn Stenbergff4b21d2004-10-04 23:08:41 +000054#define SETTINGS_OK BUTTON_PLAY
55#define SETTINGS_OK2 BUTTON_LEFT
56#define SETTINGS_CANCEL BUTTON_OFF
57#define SETTINGS_CANCEL2 BUTTON_F1
Björn Stenberg6c33c512004-09-19 21:58:37 +000058
Jörg Hohensohn593cc002004-09-28 22:13:26 +000059#elif CONFIG_KEYPAD == PLAYER_PAD
Björn Stenberg6c33c512004-09-19 21:58:37 +000060#define SETTINGS_INC BUTTON_RIGHT
61#define SETTINGS_DEC BUTTON_LEFT
Björn Stenbergff4b21d2004-10-04 23:08:41 +000062#define SETTINGS_OK BUTTON_PLAY
63#define SETTINGS_CANCEL BUTTON_STOP
64#define SETTINGS_CANCEL2 BUTTON_MENU
Björn Stenberg6c33c512004-09-19 21:58:37 +000065
Jörg Hohensohn593cc002004-09-28 22:13:26 +000066#elif CONFIG_KEYPAD == ONDIO_PAD
Jens Arnold4dab0d22004-10-24 21:45:37 +000067#define SETTINGS_INC BUTTON_UP
68#define SETTINGS_DEC BUTTON_DOWN
69#define SETTINGS_OK BUTTON_RIGHT
70#define SETTINGS_OK2 BUTTON_LEFT
71#define SETTINGS_CANCEL BUTTON_MENU
72#define SETTINGS_CANCEL2 BUTTON_OFF
Björn Stenberg6c33c512004-09-19 21:58:37 +000073
Jens Arnold259e3542005-01-23 01:01:14 +000074#elif CONFIG_KEYPAD == GMINI100_PAD
75#define SETTINGS_INC BUTTON_UP
76#define SETTINGS_DEC BUTTON_DOWN
77#define SETTINGS_OK BUTTON_PLAY
78#define SETTINGS_OK2 BUTTON_LEFT
79#define SETTINGS_CANCEL BUTTON_OFF
80#define SETTINGS_CANCEL2 BUTTON_MENU
81
Dave Chapmanfe772402005-11-19 03:19:12 +000082#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
83 (CONFIG_KEYPAD == IPOD_NANO_PAD)
84#define SETTINGS_INC BUTTON_SCROLL_FWD
85#define SETTINGS_DEC BUTTON_SCROLL_BACK
86#define SETTINGS_OK BUTTON_SELECT
Dave Chapman64e52392005-11-12 16:07:17 +000087#define SETTINGS_CANCEL BUTTON_MENU
88
Björn Stenberg6c33c512004-09-19 21:58:37 +000089#endif
90
Björn Stenbergf80d8a702002-06-27 00:20:00 +000091/* data structures */
92
Björn Stenberga108ec22004-01-14 00:13:04 +000093#define BOOKMARK_NO 0
94#define BOOKMARK_YES 1
95#define BOOKMARK_ASK 2
96#define BOOKMARK_UNIQUE_ONLY 2
97#define BOOKMARK_RECENT_ONLY_YES 3
98#define BOOKMARK_RECENT_ONLY_ASK 4
Eric Linenberg7eb27112002-09-04 03:38:37 +000099#define FF_REWIND_1000 0
100#define FF_REWIND_2000 1
101#define FF_REWIND_3000 2
102#define FF_REWIND_4000 3
103#define FF_REWIND_5000 4
104#define FF_REWIND_6000 5
105#define FF_REWIND_8000 6
106#define FF_REWIND_10000 7
107#define FF_REWIND_15000 8
108#define FF_REWIND_20000 9
109#define FF_REWIND_25000 10
110#define FF_REWIND_30000 11
111#define FF_REWIND_45000 12
112#define FF_REWIND_60000 13
113
Linus Nielsen Feltzing68482bb2005-04-04 09:12:12 +0000114#define TRIG_MODE_OFF 0
115#define TRIG_MODE_NOREARM 1
116#define TRIG_MODE_REARM 2
117
118#define TRIG_DURATION_COUNT 13
Linus Nielsen Feltzingb3e49e22005-08-18 07:02:03 +0000119extern const char * const trig_durations[TRIG_DURATION_COUNT];
Björn Stenbergde5477c2003-09-29 21:26:53 +0000120
Miika Pekkarinene7461b32005-11-06 16:40:20 +0000121#define CROSSFADE_ENABLE_SHUFFLE 1
122#define CROSSFADE_ENABLE_ALWAYS 2
Miika Pekkarinen90161c92005-07-22 16:46:27 +0000123
Jörg Hohensohnb1403ee2004-07-23 23:01:20 +0000124/* These define "virtual pointers", which could either be a literal string,
125 or a mean a string ID if the pointer is in a certain range.
126 This helps to save space for menus and options. */
127
128#define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */
129#ifdef SIMULATOR
130/* a space which is defined in stubs.c */
Jens Arnoldabe77a12004-08-01 21:50:57 +0000131extern unsigned char vp_dummy[VIRT_SIZE];
Jörg Hohensohnb1403ee2004-07-23 23:01:20 +0000132#define VIRT_PTR vp_dummy
133#else
134/* a location where we won't store strings, 0 is the fastest */
135#define VIRT_PTR ((unsigned char*)0)
136#endif
137
138/* form a "virtual pointer" out of a language ID */
139#define ID2P(id) (VIRT_PTR + id)
140
141/* resolve a pointer which could be a virtualized ID or a literal */
Daniel Stenbergf981ea92005-12-05 22:44:42 +0000142#define P2STR(p) (char *)((p>=VIRT_PTR && p<=VIRT_PTR+VIRT_SIZE) ? str(p-VIRT_PTR) : p)
Jörg Hohensohnb1403ee2004-07-23 23:01:20 +0000143
144/* get the string ID from a virtual pointer, -1 if not virtual */
145#define P2ID(p) ((p>=VIRT_PTR && p<=VIRT_PTR+VIRT_SIZE) ? p-VIRT_PTR : -1)
146
147
Björn Stenbergf80d8a702002-06-27 00:20:00 +0000148struct user_settings
149{
150 /* audio settings */
151
152 int volume; /* audio output volume: 0-100 0=off 100=max */
153 int balance; /* stereo balance: 0-100 0=left 50=bal 100=right */
154 int bass; /* bass eq: 0-100 0=off 100=max */
155 int treble; /* treble eq: 0-100 0=low 100=high */
156 int loudness; /* loudness eq: 0-100 0=off 100=max */
Linus Nielsen Feltzing94da3b52004-06-22 12:37:42 +0000157 int avc; /* auto volume correct: 0=off, 1=20ms, 2=2s 3=4s 4=8s */
Jens Arnold76b257f2005-01-12 00:24:15 +0000158 int channel_config; /* Stereo, Mono, Custom, Mono left, Mono right, Karaoke */
159 int stereo_width; /* 0-255% */
Anton Oleynikov2654d912005-12-04 14:33:10 +0000160#ifdef HAVE_UDA1380
161 int sound_scaling; /* Off, Volume, Bass, Current metric */
162#endif
Linus Nielsen Feltzing7bade1a2004-07-06 12:17:14 +0000163 int mdb_strength; /* 0-127dB */
164 int mdb_harmonics; /* 0-100% */
165 int mdb_center; /* 20-300Hz */
166 int mdb_shape; /* 50-300Hz */
167 bool mdb_enable; /* true/false */
168 bool superbass; /* true/false */
Linus Nielsen Feltzingafe0da92002-11-10 23:18:33 +0000169
Jens Arnoldd6c05452005-08-29 21:15:27 +0000170#if CONFIG_CODEC == SWCODEC
Miika Pekkarinene7461b32005-11-06 16:40:20 +0000171 int crossfade; /* Enable crossfade (0=off,1=shuffle,2=always) */
172 int crossfade_fade_in_delay; /* Fade in delay (0-15s) */
173 int crossfade_fade_out_delay; /* Fade out delay (0-15s) */
174 int crossfade_fade_in_duration; /* Fade in duration (0-15s) */
175 int crossfade_fade_out_duration; /* Fade out duration (0-15s) */
176 int crossfade_fade_out_mixmode; /* Fade out mode (0=crossfade,1=mix) */
Linus Nielsen Feltzing6271b2b2005-06-09 09:47:00 +0000177#endif
178
Linus Nielsen Feltzingafe0da92002-11-10 23:18:33 +0000179 int rec_quality; /* 0-7 */
180 int rec_source; /* 0=mic, 1=line, 2=S/PDIF */
181 int rec_frequency; /* 0 = 44.1kHz
182 1 = 48kHz
183 2 = 32kHz
184 3 = 22.05kHz
185 4 = 24kHz
186 5 = 16kHz */
187 int rec_channels; /* 0=Stereo, 1=Mono */
188 int rec_mic_gain; /* 0-15 */
189 int rec_left_gain; /* 0-15 */
190 int rec_right_gain; /* 0-15 */
Andye6e54962005-11-12 04:00:56 +0000191#ifdef HAVE_UDA1380
192 int rec_adc_left_gain; /* -128 .. 48 */
193 int rec_adc_right_gain; /* -128 .. 48 */
194#endif
Linus Nielsen Feltzing478da622003-04-20 22:00:30 +0000195 bool rec_editable; /* true means that the bit reservoir is off */
Björn Stenberg56f771e2003-06-04 13:48:50 +0000196
197 /* note: timesplit setting is not saved */
Björn Stenbergcd825602003-06-10 19:24:51 +0000198 int rec_timesplit; /* 0 = off,
199 1 = 00:05, 2 = 00:10, 3 = 00:15, 4 = 00:30
200 5 = 01:00, 6 = 02:00, 7 = 04:00, 8 = 06:00
201 9 = 08:00, 10= 10:00, 11= 12:00, 12= 18:00,
202 13= 24:00 */
Linus Nielsen Feltzing74976c12003-12-31 03:13:29 +0000203
204 int rec_prerecord_time; /* In seconds, 0-30, 0 means OFF */
Linus Nielsen Feltzingef7293f2004-01-21 14:58:40 +0000205 int rec_directory; /* 0=base dir, 1=current dir */
Christi Scarborough8a8bd912005-02-04 10:37:21 +0000206 bool rec_startup; /* true means start Rockbox in recording screen */
Linus Nielsen Feltzingd731cdd2002-07-25 15:55:22 +0000207
Linus Nielsen Feltzing68482bb2005-04-04 09:12:12 +0000208 int rec_start_thres; /* negative: db, positive: % range -87 .. 100 */
209 int rec_start_duration; /* index of trig_durations */
210 int rec_stop_thres; /* negative: db, positive: % */
211 int rec_stop_postrec; /* negative: db, positive: % range -87 .. 100 */
212 int rec_stop_gap; /* index of trig_durations */
213 int rec_trigger_mode; /* see TRIG_MODE_XXX constants */
214
Björn Stenbergf80d8a702002-06-27 00:20:00 +0000215 /* device settings */
216
Björn Stenbergb1079202003-02-27 14:22:30 +0000217 int contrast; /* lcd contrast: 0-63 0=low 63=high */
218 bool invert; /* invert display */
Linus Nielsen Feltzing6c2af7c2005-09-01 08:04:37 +0000219 bool invert_cursor; /* invert the current file in dir browser and menu
220 instead of using the default cursor */
Jörg Hohensohna5e1d062003-12-20 10:00:37 +0000221 bool flip_display; /* turn display (and button layout) by 180 degrees */
Linus Nielsen Feltzing083a6db2002-09-23 11:42:48 +0000222 int poweroff; /* power off timer */
Linus Nielsen Feltzingafe0da92002-11-10 23:18:33 +0000223 int backlight_timeout; /* backlight off timeout: 0-18 0=never,
224 1=always,
225 then according to timeout_values[] */
Jens Arnolda6d409d2005-11-23 20:12:33 +0000226 int backlight_timeout_plugged;
Daniel Stenberg6b569d32005-11-14 23:37:19 +0000227#if CONFIG_BACKLIGHT == BL_IRIVER_H100
Jens Arnold61b9d342005-06-20 17:03:09 +0000228 int backlight_fade_in; /* backlight fade in timing: 0..3 */
229 int backlight_fade_out; /* backlight fade in timing: 0..7 */
230#endif
Uwe Freese0bf70e62002-12-16 22:58:48 +0000231 int battery_capacity; /* in mAh */
Jens Arnold91846a12005-01-30 16:25:46 +0000232 int battery_type; /* for units which can take multiple types (Ondio). */
Björn Stenbergf80d8a702002-06-27 00:20:00 +0000233
Linus Nielsen Feltzing8782bc82005-07-01 09:42:39 +0000234#ifdef HAVE_SPDIF_POWER
235 bool spdif_enable; /* S/PDIF power on/off */
236#endif
Jens Arnoldec9b2022005-09-10 12:28:16 +0000237
Björn Stenbergf80d8a702002-06-27 00:20:00 +0000238 /* resume settings */
239
Christi Scarborough9e8918b2005-06-29 12:23:09 +0000240 bool resume; /* resume option: 0=off, 1=on */
Björn Stenberga108ec22004-01-14 00:13:04 +0000241 int resume_index; /* index in playlist (-1 for no active resume) */
242 int resume_first_index; /* index of first track in playlist */
Jens Arnoldec9b2022005-09-10 12:28:16 +0000243 unsigned long resume_offset; /* byte offset in mp3 file */
Hardeep Sidhu58bafee2003-12-09 08:18:03 +0000244 int resume_seed; /* shuffle seed (-1=no resume shuffle 0=sorted
Björn Stenberga4f39a62004-05-21 20:36:48 +0000245 >0=shuffled) */
Björn Stenbergc78e1b02003-01-09 00:55:00 +0000246
Björn Stenbergdea31222002-10-08 15:42:40 +0000247 unsigned char font_file[MAX_FILENAME+1]; /* last font */
248 unsigned char wps_file[MAX_FILENAME+1]; /* last wps */
249 unsigned char lang_file[MAX_FILENAME+1]; /* last language */
Björn Stenbergf80d8a702002-06-27 00:20:00 +0000250
251 /* misc options */
252
Linus Nielsen Feltzing0ad617c2005-08-21 23:01:12 +0000253 int repeat_mode; /* 0=off 1=repeat all 2=repeat one 3=shuffle 4=ab */
Björn Stenbergfc53fd72005-01-17 11:37:36 +0000254 int dirfilter; /* 0=display all, 1=only supported, 2=only music,
255 3=dirs+playlists, 4=ID3 database */
Linus Nielsen Feltzingc132c482002-07-22 16:39:17 +0000256 bool sort_case; /* dir sort order: 0=case insensitive, 1=sensitive */
Robert Hak5a9e8922002-10-26 05:26:23 +0000257 int volume_type; /* how volume is displayed: 0=graphic, 1=percent */
Jens Arnold9d42e2b2005-01-30 13:48:44 +0000258 int battery_display; /* how battery is displayed: 0=graphic, 1=percent */
Markus Braun22a7a2d2002-10-14 12:50:20 +0000259 int timeformat; /* time format: 0=24 hour clock, 1=12 hour clock */
Eric Linenberg90ca5cf2002-09-05 04:47:24 +0000260 int scroll_speed; /* long texts scrolling speed: 1-30 */
Björn Stenberg60b356e2002-06-27 01:08:11 +0000261 bool playlist_shuffle;
Linus Nielsen Feltzing78ea93d2002-09-18 10:12:16 +0000262 bool play_selected; /* Plays selected file even in shuffle mode */
Eric Linenberg7eb27112002-09-04 03:38:37 +0000263 int ff_rewind_min_step; /* FF/Rewind minimum step size */
Eric Linenberg65240762002-08-28 19:34:07 +0000264 int ff_rewind_accel; /* FF/Rewind acceleration (in seconds per doubling) */
Björn Stenberg457b8a02002-08-26 13:21:14 +0000265 int disk_spindown; /* time until disk spindown, in seconds (0=off) */
Björn Stenberg2b77b4f2002-11-28 22:46:19 +0000266 bool disk_poweroff; /* whether to cut disk power after spindown or not */
Linus Nielsen Feltzingb8ff5f82002-12-05 13:09:51 +0000267 int buffer_margin; /* MP3 buffer watermark margin, in seconds */
Björn Stenbergf80d8a702002-06-27 00:20:00 +0000268
Linus Nielsen Feltzingbb572c42002-09-27 09:31:31 +0000269 int peak_meter_release; /* units per read out */
270 int peak_meter_hold; /* hold time for peak meter in 1/100 s */
271 int peak_meter_clip_hold; /* hold time for clips */
Linus Nielsen Feltzingfd0cc3b2002-10-29 12:09:15 +0000272 bool peak_meter_dbfs; /* show linear or dbfs values */
Björn Stenberg9c16e122003-02-14 14:14:55 +0000273 int peak_meter_min; /* range minimum */
274 int peak_meter_max; /* range maximum */
Björn Stenbergb1c429e2003-10-17 14:49:00 +0000275 bool car_adapter_mode; /* 0=off 1=on */
Linus Nielsen Feltzingbb572c42002-09-27 09:31:31 +0000276
Markus Braunde8fbf02002-08-07 10:35:26 +0000277 /* show status bar */
278 bool statusbar; /* 0=hide, 1=show */
Daniel Stenberg053d9042002-08-22 15:47:30 +0000279
Linus Nielsen Feltzing77936e62004-03-16 13:44:56 +0000280 /* show button bar */
281 bool buttonbar; /* 0=hide, 1=show */
282
Markus Braun000c2db2002-08-30 13:49:32 +0000283 /* show scroll bar */
284 bool scrollbar; /* 0=hide, 1=show */
285
Eric Linenbergecca1232002-09-09 14:25:39 +0000286 /* goto current song when exiting WPS */
287 bool browse_current; /* 1=goto current song,
288 0=goto previous location */
289
Björn Stenbergae22de22002-12-02 16:07:56 +0000290 int runtime; /* current runtime since last charge */
291 int topruntime; /* top known runtime */
Björn Stenberga2e98c12002-12-12 15:20:37 +0000292
293 int bidir_limit; /* bidir scroll length limit */
294 int scroll_delay; /* delay (in 1/10s) before starting scroll */
295 int scroll_step; /* pixels to advance per update */
Björn Stenberga108ec22004-01-14 00:13:04 +0000296
297 /* auto bookmark settings */
298 int autoloadbookmark; /* auto load option: 0=off, 1=ask, 2=on */
299 int autocreatebookmark; /* auto create option: 0=off, 1=ask, 2=on */
300 int usemrb; /* use MRB list: 0=No, 1=Yes*/
Kjell Ericson53f156a2003-05-22 06:42:14 +0000301#ifdef HAVE_LCD_CHARCELLS
302 int jump_scroll; /* Fast jump when scrolling */
Kjell Ericson6143eeb2003-05-27 12:54:11 +0000303 int jump_scroll_delay; /* Delay between jump scroll screens */
Kjell Ericson53f156a2003-05-22 06:42:14 +0000304#endif
Björn Stenberge2628d92003-02-14 15:54:52 +0000305 bool fade_on_stop; /* fade on pause/unpause/stop */
Björn Stenberg86587522003-04-23 09:17:34 +0000306 bool caption_backlight; /* turn on backlight at end and start of track */
Linus Nielsen Feltzing20d031f2003-05-09 16:01:21 +0000307
Jörg Hohensohn593cc002004-09-28 22:13:26 +0000308#ifdef CONFIG_TUNER
Linus Nielsen Feltzing20d031f2003-05-09 16:01:21 +0000309 int fm_freq_step; /* Frequency step for manual tuning, in kHz */
310 bool fm_force_mono; /* Forces Mono mode if true */
311 bool fm_full_range; /* Enables full 10MHz-160MHz range if true, else
312 only 88MHz-108MHz */
Linus Nielsen Feltzing3e92dbe2004-07-12 13:28:44 +0000313 int last_frequency; /* Last frequency for resuming, in FREQ_STEP units,
314 relative to MIN_FREQ */
Linus Nielsen Feltzing20d031f2003-05-09 16:01:21 +0000315#endif
316
317 int max_files_in_dir; /* Max entries in directory (file browser) */
318 int max_files_in_playlist; /* Max entries in playlist */
Björn Stenbergd1a6fa12003-06-05 09:38:26 +0000319 bool show_icons; /* 0=hide 1=show */
Hardeep Sidhu11e7ad52003-07-02 15:54:44 +0000320 int recursive_dir_insert; /* should directories be inserted recursively */
Linus Nielsen Feltzingc22b4112003-11-03 23:36:36 +0000321
322 bool line_in; /* false=off, true=active */
Hardeep Sidhu107ebc52004-01-26 17:05:21 +0000323
Linus Nielsen Feltzing4cdcbb92004-07-27 19:20:51 +0000324 bool id3_v1_first; /* true = ID3V1 has prio over ID3V2 tag */
325
Hardeep Sidhu107ebc52004-01-26 17:05:21 +0000326 /* playlist viewer settings */
327 bool playlist_viewer_icons; /* display icons on viewer */
328 bool playlist_viewer_indices; /* display playlist indices on viewer */
329 int playlist_viewer_track_display; /* how to display tracks in viewer */
Jörg Hohensohn3aa99e12004-03-27 00:11:01 +0000330
331 /* voice UI settings */
332 bool talk_menu; /* enable voice UI */
333 int talk_dir; /* talkbox mode: 0=off 1=number 2=clip@enter 3=clip@hover */
334 int talk_file; /* voice filename mode: 0=off, 1=number, other t.b.d. */
Jörg Hohensohn5c8a2f52004-06-22 09:16:44 +0000335
336 /* file browser sorting */
337 int sort_file; /* 0=alpha, 1=date, 2=date (new first), 3=type */
338 int sort_dir; /* 0=alpha, 1=date (old first), 2=date (new first) */
Christian Gmeiner7c1879b2005-04-15 12:08:49 +0000339
340#ifdef HAVE_REMOTE_LCD
Christi Scarboroughbe789452005-07-05 22:27:54 +0000341 /* remote lcd */
Christian Gmeiner7c1879b2005-04-15 12:08:49 +0000342 int remote_contrast; /* lcd contrast: 0-63 0=low 63=high */
343 bool remote_invert; /* invert display */
344 bool remote_flip_display; /* turn display (and button layout) by 180 degrees */
345 int remote_backlight_timeout; /* backlight off timeout: 0-18 0=never,
346 1=always,
347 then according to timeout_values[] */
Jens Arnolda6d409d2005-11-23 20:12:33 +0000348 int remote_backlight_timeout_plugged;
Jens Arnoldb51f7df2005-11-21 23:55:39 +0000349 bool remote_caption_backlight; /* turn on backlight at end and start of track */
350#ifdef HAVE_REMOTE_LCD_TICKING
Miika Pekkarinen05fdb1a2005-11-19 07:58:20 +0000351 bool remote_reduce_ticking; /* 0=normal operation,
352 1=EMI reduce on with cost more CPU. */
Christian Gmeiner7c1879b2005-04-15 12:08:49 +0000353#endif
Miika Pekkarinen93d8ca52005-11-19 09:26:02 +0000354#endif
Christian Gmeiner7c1879b2005-04-15 12:08:49 +0000355
Hardeep Sidhu71d22812005-07-01 11:25:16 +0000356 bool next_folder; /* move to next folder */
Jens Arnold8102f3d2005-07-02 10:50:42 +0000357 bool runtimedb; /* runtime database active? */
Magnus Holmgren4a537872005-07-24 15:32:28 +0000358
Jens Arnoldd6c05452005-08-29 21:15:27 +0000359#if CONFIG_CODEC == SWCODEC
Magnus Holmgren4a537872005-07-24 15:32:28 +0000360 bool replaygain; /* enable replaygain */
Magnus Holmgren4a537872005-07-24 15:32:28 +0000361 bool replaygain_noclip; /* scale to prevent clips */
Magnus Holmgren4b711c22005-09-24 15:22:48 +0000362 int replaygain_type; /* 0=track gain, 1=album gain, 2=track gain if
363 shuffle is on, album gain otherwise */
Magnus Holmgren5a8eac12005-08-11 18:56:20 +0000364 int replaygain_preamp; /* scale replaygained tracks by this */
Miika Pekkarinen9d7fd182005-08-20 21:17:41 +0000365 int beep; /* system beep volume when changing tracks etc. */
Marcoen Hirschberge13fad32005-11-14 21:56:56 +0000366 bool crossfeed; /* enable crossfeed */
Magnus Holmgren4a537872005-07-24 15:32:28 +0000367#endif
Miika Pekkarinenab78b042005-10-07 17:38:05 +0000368#ifdef HAVE_DIRCACHE
369 bool dircache; /* enable directory cache */
370 int dircache_size; /* directory cache structure last size, 22 bits */
371#endif
Marcoen Hirschbergb0fee172005-12-06 13:27:15 +0000372 int default_codepage; /* set default codepage for tag conversion */
Christi Scarborough4c0b83f2005-11-17 20:14:59 +0000373#ifdef HAVE_REMOTE_LCD
374 unsigned char rwps_file[MAX_FILENAME+1]; /* last remote-wps */
375#endif
Björn Stenbergf80d8a702002-06-27 00:20:00 +0000376};
377
Björn Stenberg26712d52003-06-05 11:11:10 +0000378enum optiontype { INT, BOOL };
379
Jörg Hohensohn42ffbf92004-03-15 08:27:51 +0000380struct opt_items {
Jens Arnoldabe77a12004-08-01 21:50:57 +0000381 unsigned const char* string;
Jean-Philippe Bernardy45e0de32005-02-12 11:26:36 +0000382 long voice_id;
Jörg Hohensohn42ffbf92004-03-15 08:27:51 +0000383};
384
Björn Stenbergf80d8a702002-06-27 00:20:00 +0000385/* prototypes */
386
Jens Arnoldc12e87d2004-09-28 18:09:10 +0000387void settings_calc_config_sector(void);
Björn Stenberg6b25f792002-07-15 11:02:12 +0000388int settings_save(void);
Jörg Hohensohn6ff6d212004-06-19 15:50:02 +0000389void settings_load(int which);
Björn Stenberg6b25f792002-07-15 11:02:12 +0000390void settings_reset(void);
Linus Nielsen Feltzing7bade1a2004-07-06 12:17:14 +0000391void sound_settings_apply(void);
Linus Nielsen Feltzing40ffbb12002-10-03 09:31:01 +0000392void settings_apply(void);
Linus Nielsen Feltzingfd0cc3b2002-10-29 12:09:15 +0000393void settings_apply_pm_range(void);
Björn Stenberg6b25f792002-07-15 11:02:12 +0000394void settings_display(void);
Björn Stenbergf80d8a702002-06-27 00:20:00 +0000395
Jens Arnold8fb33612004-08-18 01:09:31 +0000396bool settings_load_config(const char* file);
Björn Stenbergc5aaab42003-03-10 16:31:02 +0000397bool settings_save_config(void);
Jens Arnold8fb33612004-08-18 01:09:31 +0000398bool set_bool_options(const char* string, bool* variable,
399 const char* yes_str, int yes_voice,
400 const char* no_str, int no_voice,
Jörg Hohensohn42ffbf92004-03-15 08:27:51 +0000401 void (*function)(bool));
Justin Heinere4a27612002-09-05 01:20:10 +0000402
Jens Arnold8fb33612004-08-18 01:09:31 +0000403bool set_bool(const char* string, bool* variable );
404bool set_option(const char* string, void* variable, enum optiontype type,
Jörg Hohensohnb1403ee2004-07-23 23:01:20 +0000405 const struct opt_items* options, int numoptions, void (*function)(int));
Daniel Stenbergf981ea92005-12-05 22:44:42 +0000406bool set_int(const unsigned char* string, const char* unit, int voice_unit,
407 int* variable,
Magnus Holmgren5a8eac12005-08-11 18:56:20 +0000408 void (*function)(int), int step, int min, int max,
409 void (*formatter)(char*, int, int, const char*) );
Jens Arnold8fb33612004-08-18 01:09:31 +0000410bool set_time_screen(const char* string, struct tm *tm);
Björn Stenberga108ec22004-01-14 00:13:04 +0000411int read_line(int fd, char* buffer, int buffer_size);
Björn Stenbergbda4ec12003-02-17 09:53:11 +0000412void set_file(char* filename, char* setting, int maxlen);
Björn Stenberg60b356e2002-06-27 01:08:11 +0000413
Linus Nielsen Feltzingaaa99e72003-11-20 00:33:43 +0000414unsigned int rec_timesplit_seconds(void);
Linus Nielsen Feltzing68482bb2005-04-04 09:12:12 +0000415void settings_apply_trigger(void);
Linus Nielsen Feltzingaaa99e72003-11-20 00:33:43 +0000416
Björn Stenbergf80d8a702002-06-27 00:20:00 +0000417/* global settings */
418extern struct user_settings global_settings;
Heikki Hannikainen4b0e8b02002-08-30 13:24:03 +0000419/* name of directory where configuration, fonts and other data
420 * files are stored */
Björn Stenbergfb067482003-10-17 13:54:48 +0000421extern long lasttime;
Björn Stenbergf80d8a702002-06-27 00:20:00 +0000422
Linus Nielsen Feltzingef7293f2004-01-21 14:58:40 +0000423/* Recording base directory */
Jens Arnoldabe77a12004-08-01 21:50:57 +0000424extern const char rec_base_directory[];
Linus Nielsen Feltzingef7293f2004-01-21 14:58:40 +0000425
Björn Stenbergf80d8a702002-06-27 00:20:00 +0000426/* system defines */
427
Linus Nielsen Feltzing638184f2002-08-13 11:10:11 +0000428#ifdef HAVE_LCD_CHARCELLS
Björn Stenbergcd7691d2002-08-13 17:16:09 +0000429#define MAX_CONTRAST_SETTING 31
Björn Stenberg677c5cc2002-08-13 16:00:10 +0000430#define DEFAULT_CONTRAST_SETTING 30
Linus Nielsen Feltzing638184f2002-08-13 11:10:11 +0000431#else
Björn Stenbergcd7691d2002-08-13 17:16:09 +0000432#define MAX_CONTRAST_SETTING 63
Eric Linenberg1ff25432002-09-04 04:25:20 +0000433#define DEFAULT_CONTRAST_SETTING 38
Linus Nielsen Feltzing638184f2002-08-13 11:10:11 +0000434#endif
Björn Stenbergcd7691d2002-08-13 17:16:09 +0000435#define MIN_CONTRAST_SETTING 5
Björn Stenbergf80d8a702002-06-27 00:20:00 +0000436
Jörg Hohensohn6ff6d212004-06-19 15:50:02 +0000437/* argument bits for settings_load() */
438#define SETTINGS_RTC 1 /* only the settings from the RTC nonvolatile RAM */
439#define SETTINGS_HD 2 /* only the settings fron the disk sector */
440#define SETTINGS_ALL 3 /* both */
441
Björn Stenberga6d0abb2002-10-04 08:48:20 +0000442/* repeat mode options */
Linus Nielsen Feltzing0ad617c2005-08-21 23:01:12 +0000443enum
444{
445 REPEAT_OFF,
446 REPEAT_ALL,
447 REPEAT_ONE,
448 REPEAT_SHUFFLE,
449#ifdef AB_REPEAT_ENABLE
450 REPEAT_AB,
451#endif
452 NUM_REPEAT_MODES
453};
Björn Stenberga6d0abb2002-10-04 08:48:20 +0000454
Björn Stenberga7dcf912002-09-24 19:12:09 +0000455/* dir filter options */
Björn Stenbergde5477c2003-09-29 21:26:53 +0000456/* Note: Any new filter modes need to be added before NUM_FILTER_MODES.
457 * Any new rockbox browse filter modes (accessible through the menu)
458 * must be added after NUM_FILTER_MODES. */
Björn Stenbergfc53fd72005-01-17 11:37:36 +0000459enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, SHOW_PLAYLIST, SHOW_ID3DB,
460 NUM_FILTER_MODES,
Christi Scarborough4c0b83f2005-11-17 20:14:59 +0000461 SHOW_WPS, SHOW_RWPS, SHOW_CFG, SHOW_LNG, SHOW_MOD, SHOW_FONT, SHOW_PLUGINS};
Björn Stenberga7dcf912002-09-24 19:12:09 +0000462
Hardeep Sidhu11e7ad52003-07-02 15:54:44 +0000463/* recursive dir insert options */
464enum { RECURSE_OFF, RECURSE_ON, RECURSE_ASK };
465
Magnus Holmgren4b711c22005-09-24 15:22:48 +0000466/* replaygain types */
467enum { REPLAYGAIN_TRACK = 0, REPLAYGAIN_ALBUM, REPLAYGAIN_SHUFFLE };
468
Björn Stenbergf80d8a702002-06-27 00:20:00 +0000469#endif /* __SETTINGS_H__ */