A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita
audio
rust
zig
deno
mpris
rockbox
mpd
1pub const std = @import("std");
2
3pub const EQ_NUM_BANDS = 10;
4pub const QUICKSCREEN_ITEM_COUNT = 4;
5pub const MAX_FILENAME = 32;
6pub const MAX_PATHNAME = 256;
7
8pub const ReplaygainSettings = extern struct {
9 noclip: bool,
10 type: c_int,
11 preamp: c_int,
12};
13
14pub const EqBandSetting = extern struct {
15 cutoff: c_int,
16 gain: c_int,
17 q: c_int,
18};
19
20pub const StorageType = extern union { int_val: c_int };
21
22pub const SoundSetting = extern struct { setting: c_int };
23
24pub const BoolSetting = extern struct { lang_yes: c_int, lang_no: c_int };
25
26pub const FilenameSetting = extern struct {
27 prefix: [*]const u8,
28 suffix: [*]const u8,
29 max_len: c_int,
30};
31
32pub const IntSetting = extern struct {
33 unit: c_int,
34 step: c_int,
35 min: c_int,
36 max: c_int,
37};
38
39pub const ChoiceSettingData = extern struct {
40 desc: [*]const [*]const u8,
41 talks: [*]const c_int,
42};
43
44pub const ChoiceSetting = extern struct {
45 count: c_int,
46 data: ChoiceSettingData,
47};
48
49pub const TableSetting = extern struct {
50 unit: c_int,
51 count: c_int,
52 values: [*]const c_int,
53};
54
55pub const CustomSetting = extern struct {
56 unit: c_int,
57 count: c_int,
58 values: [*]const c_int,
59};
60
61pub const SettingsTypeUnion = extern union {
62 sound_setting: SoundSetting,
63 bool_setting: BoolSetting,
64 filename_setting: FilenameSetting,
65 int_setting: IntSetting,
66 choice_setting: ChoiceSetting,
67 table_setting: TableSetting,
68 custom_setting: CustomSetting,
69};
70
71pub const SettingsList = extern struct {
72 flags: c_uint,
73 lang_id: c_int,
74 default_val: StorageType,
75 cfg_name: [*]const u8,
76 cfg_vals: [*]const u8,
77 settings_type: SettingsTypeUnion,
78};
79
80pub const TouchscreenParameter = extern struct {
81 A: c_int,
82 B: c_int,
83 C: c_int,
84 D: c_int,
85 E: c_int,
86 F: c_int,
87 divider: c_int,
88};
89
90pub const CompressorSettings = extern struct {
91 threshold: c_int,
92 makeup_gain: c_int,
93 ratio: c_int,
94 knee: c_int,
95 release_time: c_int,
96 attack_time: c_int,
97};
98
99pub const UserSettings = extern struct {
100 // Audio settings
101 volume: c_int,
102 balance: c_int,
103 bass: c_int,
104 treble: c_int,
105 channel_config: c_int,
106 stereo_width: c_int,
107
108 bass_cutoff: c_int,
109 treble_cutoff: c_int,
110
111 crossfade: c_int,
112 crossfade_fade_in_delay: c_int,
113 crossfade_fade_out_delay: c_int,
114 crossfade_fade_in_duration: c_int,
115 crossfade_fade_out_duration: c_int,
116 crossfade_fade_out_mixmode: c_int,
117
118 // Replaygain
119 replaygain_settings: ReplaygainSettings,
120
121 // Crossfeed
122 crossfeed: c_int,
123 crossfeed_direct_gain: c_uint,
124 crossfeed_cross_gain: c_uint,
125 crossfeed_hf_attenuation: c_uint,
126 crossfeed_hf_cutoff: c_uint,
127
128 // EQ
129 eq_enabled: u8,
130 eq_precut: c_uint,
131 eq_band_settings: [EQ_NUM_BANDS]EqBandSetting,
132
133 // Misc. swcodec
134 beep: c_int,
135 keyclick: c_int,
136 keyclick_repeats: c_int,
137 dithering_enabled: u8,
138 timestretch_enabled: u8,
139
140 // Misc options
141 list_accel_start_delay: c_int,
142 list_accel_wait: c_int,
143
144 touchpad_sensitivity: c_int,
145 touchpad_deadzone: c_int,
146
147 pause_rewind: c_int,
148 unplug_mode: c_int,
149 unplug_autoresume: u8,
150
151 qs_items: [QUICKSCREEN_ITEM_COUNT]SettingsList,
152
153 timeformat: c_int,
154 disk_spindown: c_int,
155 buffer_margin: c_int,
156
157 dirfilter: c_int,
158 show_filename_ext: c_int,
159 default_codepage: c_int,
160 hold_lr_for_scroll_in_list: u8,
161 play_selected: u8,
162 single_mode: c_int,
163 party_mode: u8,
164 cuesheet: u8,
165 car_adapter_mode: u8,
166 car_adapter_mode_delay: c_int,
167 start_in_screen: c_int,
168 ff_rewind_min_step: c_int,
169 ff_rewind_accel: c_int,
170
171 peak_meter_release: c_int,
172 peak_meter_hold: c_int,
173 peak_meter_clip_hold: c_int,
174 peak_meter_dbfs: u8,
175 peak_meter_min: c_int,
176 peak_meter_max: c_int,
177
178 wps_file: [MAX_FILENAME + 1]u8,
179 sbs_file: [MAX_FILENAME + 1]u8,
180 lang_file: [MAX_FILENAME + 1]u8,
181 playlist_catalog_dir: [MAX_PATHNAME + 1]u8,
182 skip_length: c_int,
183 max_files_in_dir: c_int,
184 max_files_in_playlist: c_int,
185 volume_type: c_int,
186 battery_display: c_int,
187 show_icons: u8,
188 statusbar: c_int,
189
190 scrollbar: c_int,
191 scrollbar_width: c_int,
192
193 list_line_padding: c_int,
194 list_separator_height: c_int,
195 list_separator_color: c_int,
196
197 browse_current: u8,
198 scroll_paginated: u8,
199 list_wraparound: u8,
200 list_order: c_int,
201 scroll_speed: c_int,
202 bidir_limit: c_int,
203 scroll_delay: c_int,
204 scroll_step: c_int,
205
206 autoloadbookmark: c_int,
207 autocreatebookmark: c_int,
208 autoupdatebookmark: u8,
209 usemrb: c_int,
210
211 dircache: u8,
212 tagcache_ram: c_int,
213 tagcache_autoupdate: u8,
214 autoresume_enable: u8,
215 autoresume_automatic: c_int,
216 autoresume_paths: [MAX_PATHNAME + 1]u8,
217 runtimedb: u8,
218 tagcache_scan_paths: [MAX_PATHNAME + 1]u8,
219 tagcache_db_path: [MAX_PATHNAME + 1]u8,
220 backdrop_file: [MAX_PATHNAME + 1]u8,
221
222 bg_color: c_int,
223 fg_color: c_int,
224 lss_color: c_int,
225 lse_color: c_int,
226 lst_color: c_int,
227 colors_file: [MAX_FILENAME + 1]u8,
228
229 browser_default: c_int,
230
231 repeat_mode: c_int,
232 next_folder: c_int,
233 constrain_next_folder: u8,
234 recursive_dir_insert: c_int,
235 fade_on_stop: u8,
236 playlist_shuffle: u8,
237 warnon_erase_dynplaylist: u8,
238 keep_current_track_on_replace_playlist: u8,
239 show_shuffled_adding_options: u8,
240 show_queue_options: c_int,
241 album_art: c_int,
242 rewind_across_tracks: u8,
243
244 playlist_viewer_icons: u8,
245 playlist_viewer_indices: u8,
246 playlist_viewer_track_display: c_int,
247
248 talk_menu: u8,
249 talk_dir: c_int,
250 talk_dir_clip: u8,
251 talk_file: c_int,
252 talk_file_clip: u8,
253 talk_filetype: u8,
254 talk_battery_level: u8,
255 talk_mixer_amp: c_int,
256
257 sort_case: u8,
258 sort_dir: c_int,
259 sort_file: c_int,
260 interpret_numbers: c_int,
261
262 poweroff: c_int,
263 battery_capacity: c_int,
264 battery_type: c_int,
265 spdif_enable: u8,
266 usb_charging: c_int,
267
268 contrast: c_int,
269 invert: u8,
270 flip_display: u8,
271 cursor_style: c_int,
272 screen_scroll_step: c_int,
273 show_path_in_browser: c_int,
274 offset_out_of_view: u8,
275 disable_mainmenu_scrolling: u8,
276 icon_file: [MAX_FILENAME + 1]u8,
277 viewers_icon_file: [MAX_FILENAME + 1]u8,
278 font_file: [MAX_FILENAME + 1]u8,
279 glyphs_to_cache: c_int,
280 kbd_file: [MAX_FILENAME + 1]u8,
281 backlight_timeout: c_int,
282 caption_backlight: u8,
283 bl_filter_first_keypress: u8,
284 backlight_timeout_plugged: c_int,
285 bt_selective_softlock_actions: u8,
286 bt_selective_softlock_actions_mask: c_int,
287 bl_selective_actions: u8,
288 bl_selective_actions_mask: c_int,
289 backlight_on_button_hold: c_int,
290 lcd_sleep_after_backlight_off: c_int,
291 brightness: c_int,
292
293 speaker_mode: c_int,
294 prevent_skip: u8,
295
296 touch_mode: c_int,
297 ts_calibration_data: TouchscreenParameter,
298
299 pitch_mode_semitone: u8,
300 pitch_mode_timestretch: u8,
301
302 usb_hid: u8,
303 usb_keypad_mode: c_int,
304
305 usb_skip_first_drive: u8,
306
307 ui_vp_config: [64]u8,
308 player_name: [64]u8,
309
310 compressor_settings: CompressorSettings,
311
312 sleeptimer_duration: c_int,
313 sleeptimer_on_startup: u8,
314 keypress_restarts_sleeptimer: u8,
315
316 show_shutdown_message: u8,
317
318 hotkey_wps: c_int,
319 hotkey_tree: c_int,
320
321 resume_rewind: c_int,
322
323 depth_3d: c_int,
324
325 roll_off: c_int,
326
327 power_mode: c_int,
328
329 keyclick_hardware: u8,
330
331 start_directory: [MAX_PATHNAME + 1]u8,
332 root_menu_customized: u8,
333 shortcuts_replaces_qs: u8,
334
335 play_frequency: c_int,
336 volume_limit: c_int,
337
338 volume_adjust_mode: c_int,
339 volume_adjust_norm_steps: c_int,
340
341 surround_enabled: c_int,
342 surround_balance: c_int,
343 surround_fx1: c_int,
344 surround_fx2: u8,
345 surround_method2: u8,
346 surround_mix: c_int,
347
348 pbe: c_int,
349 pbe_precut: c_int,
350
351 afr_enabled: c_int,
352
353 governor: c_int,
354 stereosw_mode: c_int,
355};
356
357extern var global_settings: UserSettings;
358
359pub fn get_crossfade_mode() c_int {
360 return global_settings.crossfade;
361}