1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 by wavey@wavey.org
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #ifndef __SETTINGS_H__
21 #define __SETTINGS_H__
26 #define ROCKBOX_DIR "/.rockbox"
28 #define MAX_FILENAME 20
34 #define RESUME_ASK_ONCE 2
37 #define FF_REWIND_1000 0
38 #define FF_REWIND_2000 1
39 #define FF_REWIND_3000 2
40 #define FF_REWIND_4000 3
41 #define FF_REWIND_5000 4
42 #define FF_REWIND_6000 5
43 #define FF_REWIND_8000 6
44 #define FF_REWIND_10000 7
45 #define FF_REWIND_15000 8
46 #define FF_REWIND_20000 9
47 #define FF_REWIND_25000 10
48 #define FF_REWIND_30000 11
49 #define FF_REWIND_45000 12
50 #define FF_REWIND_60000 13
56 int volume
; /* audio output volume: 0-100 0=off 100=max */
57 int balance
; /* stereo balance: 0-100 0=left 50=bal 100=right */
58 int bass
; /* bass eq: 0-100 0=off 100=max */
59 int treble
; /* treble eq: 0-100 0=low 100=high */
60 int loudness
; /* loudness eq: 0-100 0=off 100=max */
61 int bass_boost
; /* bass boost eq: 0-100 0=off 100=max */
62 int avc
; /* auto volume correct: 0=disable, 1=2s 2=4s 3=8s */
63 int channel_config
; /* Stereo, Mono, Mono left, Mono right */
65 int rec_quality
; /* 0-7 */
66 int rec_source
; /* 0=mic, 1=line, 2=S/PDIF */
67 int rec_frequency
; /* 0 = 44.1kHz
73 int rec_channels
; /* 0=Stereo, 1=Mono */
74 int rec_mic_gain
; /* 0-15 */
75 int rec_left_gain
; /* 0-15 */
76 int rec_right_gain
; /* 0-15 */
77 bool rec_editable
; /* true means that the bit reservoir is off */
81 int contrast
; /* lcd contrast: 0-63 0=low 63=high */
82 bool invert
; /* invert display */
83 bool invert_cursor
; /* invert the current file in dir browser and menu
84 instead of using the default cursor */
85 int poweroff
; /* power off timer */
86 int backlight_timeout
; /* backlight off timeout: 0-18 0=never,
88 then according to timeout_values[] */
89 bool backlight_on_when_charging
;
90 bool discharge
; /* maintain charge of at least: false = 85%, true = 10% */
91 bool trickle_charge
; /* do trickle charging: 0=off, 1=on */
92 int battery_capacity
; /* in mAh */
96 int resume
; /* resume option: 0=off, 1=ask, 2=on */
97 int resume_index
; /* index in playlist (-1 for no active resume) */
98 int resume_offset
; /* byte offset in mp3 file */
99 int resume_seed
; /* random seed for playlist shuffle */
100 int resume_first_index
; /* first index of playlist */
102 bool save_queue_resume
; /* save queued songs for resume */
103 int queue_resume
; /* resume queue file?: 0 = no
104 1 = resume at queue index
105 2 = resume at playlist index */
106 int queue_resume_index
; /* queue index (seek point in queue file) */
108 unsigned char resume_file
[MAX_PATH
+1]; /* playlist name (or dir) */
109 unsigned char font_file
[MAX_FILENAME
+1]; /* last font */
110 unsigned char wps_file
[MAX_FILENAME
+1]; /* last wps */
111 unsigned char lang_file
[MAX_FILENAME
+1]; /* last language */
115 int repeat_mode
; /* 0=off 1=repeat all 2=repeat one */
116 int dirfilter
; /* 0=display all, 1=only supported, 2=only music */
117 bool sort_case
; /* dir sort order: 0=case insensitive, 1=sensitive */
118 int volume_type
; /* how volume is displayed: 0=graphic, 1=percent */
119 int battery_type
; /* how battery is displayed: 0=graphic, 1=percent */
120 int timeformat
; /* time format: 0=24 hour clock, 1=12 hour clock */
121 int scroll_speed
; /* long texts scrolling speed: 1-30 */
122 bool playlist_shuffle
;
123 bool play_selected
; /* Plays selected file even in shuffle mode */
124 int ff_rewind_min_step
; /* FF/Rewind minimum step size */
125 int ff_rewind_accel
; /* FF/Rewind acceleration (in seconds per doubling) */
126 int disk_spindown
; /* time until disk spindown, in seconds (0=off) */
127 bool disk_poweroff
; /* whether to cut disk power after spindown or not */
128 int buffer_margin
; /* MP3 buffer watermark margin, in seconds */
130 int peak_meter_release
; /* units per read out */
131 int peak_meter_hold
; /* hold time for peak meter in 1/100 s */
132 int peak_meter_clip_hold
; /* hold time for clips */
133 bool peak_meter_dbfs
; /* show linear or dbfs values */
134 bool peak_meter_performance
; /* true: high performance, else save energy*/
135 int peak_meter_min
; /* range minimum */
136 int peak_meter_max
; /* range maximum */
138 /* show status bar */
139 bool statusbar
; /* 0=hide, 1=show */
141 /* show scroll bar */
142 bool scrollbar
; /* 0=hide, 1=show */
144 /* goto current song when exiting WPS */
145 bool browse_current
; /* 1=goto current song,
146 0=goto previous location */
148 int runtime
; /* current runtime since last charge */
149 int topruntime
; /* top known runtime */
151 int bidir_limit
; /* bidir scroll length limit */
152 int scroll_delay
; /* delay (in 1/10s) before starting scroll */
153 int scroll_step
; /* pixels to advance per update */
154 #ifdef HAVE_LCD_CHARCELLS
155 int jump_scroll
; /* Fast jump when scrolling */
156 int jump_scroll_delay
; /* Delay between jump scroll screens */
158 bool fade_on_stop
; /* fade on pause/unpause/stop */
159 bool caption_backlight
; /* turn on backlight at end and start of track */
162 int fm_freq_step
; /* Frequency step for manual tuning, in kHz */
163 bool fm_force_mono
; /* Forces Mono mode if true */
164 bool fm_full_range
; /* Enables full 10MHz-160MHz range if true, else
168 int max_files_in_dir
; /* Max entries in directory (file browser) */
169 int max_files_in_playlist
; /* Max entries in playlist */
174 int settings_save(void);
175 void settings_load(void);
176 void settings_reset(void);
177 void settings_apply(void);
178 void settings_apply_pm_range(void);
179 void settings_display(void);
181 bool settings_load_config(char* file
);
182 bool settings_save_config(void);
183 bool set_bool_options(char* string
, bool* variable
,
184 char* yes_str
, char* no_str
);
186 bool set_bool(char* string
, bool* variable
);
187 bool set_option(char* string
, int* variable
, char* options
[],
188 int numoptions
, void (*function
)(int));
189 bool set_int(char* string
, char* unit
, int* variable
,
190 void (*function
)(int), int step
, int min
, int max
);
191 bool set_time(char* string
, int timedate
[]);
192 void set_file(char* filename
, char* setting
, int maxlen
);
194 /* global settings */
195 extern struct user_settings global_settings
;
196 /* name of directory where configuration, fonts and other data
197 * files are stored */
198 extern char rockboxdir
[];
202 #ifdef HAVE_LCD_CHARCELLS
203 #define MAX_CONTRAST_SETTING 31
204 #define DEFAULT_CONTRAST_SETTING 30
206 #define MAX_CONTRAST_SETTING 63
207 #define DEFAULT_CONTRAST_SETTING 38
209 #define MIN_CONTRAST_SETTING 5
210 #define DEFAULT_INVERT_SETTING false
211 #define DEFAULT_INVERT_CURSOR_SETTING false
212 #define DEFAULT_POWEROFF_SETTING 0
213 #define DEFAULT_BACKLIGHT_TIMEOUT_SETTING 5
214 #define DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING 0
215 #define DEFAULT_FF_REWIND_MIN_STEP FF_REWIND_1000
216 #define DEFAULT_FF_REWIND_ACCEL_SETTING 3
218 /* repeat mode options */
219 enum { REPEAT_OFF
, REPEAT_ALL
, REPEAT_ONE
, NUM_REPEAT_MODES
};
221 /* dir filter options */
222 enum { SHOW_ALL
, SHOW_SUPPORTED
, SHOW_MUSIC
, SHOW_PLAYLIST
, NUM_FILTER_MODES
};
224 #endif /* __SETTINGS_H__ */