summaryrefslogtreecommitdiff
path: root/apps/settings_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/settings_menu.c')
-rw-r--r--apps/settings_menu.c485
1 files changed, 2 insertions, 483 deletions
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 054dd145a9..79c4d9d6e5 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -83,6 +83,7 @@ void dac_line_in(bool enable);
83#if LCD_DEPTH > 1 83#if LCD_DEPTH > 1
84#include "backdrop.h" 84#include "backdrop.h"
85#endif 85#endif
86#include "menus/exported_menus.h"
86 87
87#ifdef CONFIG_CHARGING 88#ifdef CONFIG_CHARGING
88static bool car_adapter_mode(void) 89static bool car_adapter_mode(void)
@@ -733,40 +734,6 @@ static bool peak_meter_menu(void)
733} 734}
734#endif /* HAVE_LCD_BITMAP */ 735#endif /* HAVE_LCD_BITMAP */
735 736
736static bool shuffle(void)
737{
738 return set_bool( str(LANG_SHUFFLE), &global_settings.playlist_shuffle );
739}
740
741static bool repeat_mode(void)
742{
743 bool result;
744 static const struct opt_items names[] = {
745 { STR(LANG_OFF) },
746 { STR(LANG_REPEAT_ALL) },
747 { STR(LANG_REPEAT_ONE) },
748 { STR(LANG_SHUFFLE) },
749#if (AB_REPEAT_ENABLE == 1)
750 { STR(LANG_REPEAT_AB) }
751#endif
752 };
753 int old_repeat = global_settings.repeat_mode;
754
755 result = set_option( str(LANG_REPEAT), &global_settings.repeat_mode,
756 INT, names, NUM_REPEAT_MODES, NULL );
757
758 if (old_repeat != global_settings.repeat_mode &&
759 (audio_status() & AUDIO_STATUS_PLAY))
760 audio_flush_and_reload_tracks();
761
762 return result;
763}
764
765static bool play_selected(void)
766{
767 return set_bool( str(LANG_PLAY_SELECTED), &global_settings.play_selected );
768}
769
770static bool dir_filter(void) 737static bool dir_filter(void)
771{ 738{
772 static const struct opt_items names[] = { 739 static const struct opt_items names[] = {
@@ -825,23 +792,6 @@ static bool sort_dir(void)
825 return ret; 792 return ret;
826} 793}
827 794
828static bool resume(void)
829{
830 return set_bool( str(LANG_RESUME), &global_settings.resume);
831}
832
833#ifdef HAVE_SPDIF_POWER
834static bool spdif(void)
835{
836 bool rc = set_bool_options(str(LANG_SPDIF_ENABLE),
837 &global_settings.spdif_enable,
838 STR(LANG_ON),
839 STR(LANG_OFF),
840 spdif_power_enable);
841 return rc;
842}
843#endif
844
845static bool autocreatebookmark(void) 795static bool autocreatebookmark(void)
846{ 796{
847 bool retval = false; 797 bool retval = false;
@@ -1153,68 +1103,6 @@ static bool max_files_in_playlist(void)
1153 NULL, 1000, 1000, 20000, NULL ); 1103 NULL, 1000, 1000, 20000, NULL );
1154} 1104}
1155 1105
1156#if CONFIG_CODEC == SWCODEC
1157static bool buffer_margin(void)
1158{
1159 int ret;
1160 static const struct opt_items names[] = {
1161 { "5s", TALK_ID(5, UNIT_SEC) },
1162 { "15s", TALK_ID(15, UNIT_SEC) },
1163 { "30s", TALK_ID(30, UNIT_SEC) },
1164 { "1min", TALK_ID(1, UNIT_MIN) },
1165 { "2min", TALK_ID(2, UNIT_MIN) },
1166 { "3min", TALK_ID(3, UNIT_MIN) },
1167 { "5min", TALK_ID(5, UNIT_MIN) },
1168 { "10min", TALK_ID(10, UNIT_MIN) }
1169 };
1170
1171 ret = set_option(str(LANG_MP3BUFFER_MARGIN), &global_settings.buffer_margin,
1172 INT, names, 8, NULL);
1173 audio_set_buffer_margin(global_settings.buffer_margin);
1174
1175 return ret;
1176}
1177#else
1178static bool buffer_margin(void)
1179{
1180 return set_int(str(LANG_MP3BUFFER_MARGIN), "s", UNIT_SEC,
1181 &global_settings.buffer_margin,
1182 audio_set_buffer_margin, 1, 0, 7, NULL );
1183}
1184#endif
1185
1186static bool ff_rewind_min_step(void)
1187{
1188 static const struct opt_items names[] = {
1189 { "1s", TALK_ID(1, UNIT_SEC) },
1190 { "2s", TALK_ID(2, UNIT_SEC) },
1191 { "3s", TALK_ID(3, UNIT_SEC) },
1192 { "4s", TALK_ID(4, UNIT_SEC) },
1193 { "5s", TALK_ID(5, UNIT_SEC) },
1194 { "6s", TALK_ID(6, UNIT_SEC) },
1195 { "8s", TALK_ID(8, UNIT_SEC) },
1196 { "10s", TALK_ID(10, UNIT_SEC) },
1197 { "15s", TALK_ID(15, UNIT_SEC) },
1198 { "20s", TALK_ID(20, UNIT_SEC) },
1199 { "25s", TALK_ID(25, UNIT_SEC) },
1200 { "30s", TALK_ID(30, UNIT_SEC) },
1201 { "45s", TALK_ID(45, UNIT_SEC) },
1202 { "60s", TALK_ID(60, UNIT_SEC) }
1203 };
1204 return set_option(str(LANG_FFRW_STEP), &global_settings.ff_rewind_min_step,
1205 INT, names, 14, NULL );
1206}
1207
1208static bool set_fade_on_stop(void)
1209{
1210 return set_bool( str(LANG_FADE_ON_STOP), &global_settings.fade_on_stop );
1211}
1212
1213static bool set_party_mode(void)
1214{
1215 return set_bool( str(LANG_PARTY_MODE), &global_settings.party_mode );
1216}
1217
1218#ifdef CONFIG_BACKLIGHT 1106#ifdef CONFIG_BACKLIGHT
1219static bool set_bl_filter_first_keypress(void) 1107static bool set_bl_filter_first_keypress(void)
1220{ 1108{
@@ -1234,30 +1122,6 @@ static bool set_remote_bl_filter_first_keypress(void)
1234#endif 1122#endif
1235#endif 1123#endif
1236 1124
1237static bool ff_rewind_accel(void)
1238{
1239 static const struct opt_items names[] = {
1240 { STR(LANG_OFF) },
1241 { "2x/1s", TALK_ID(1, UNIT_SEC) },
1242 { "2x/2s", TALK_ID(2, UNIT_SEC) },
1243 { "2x/3s", TALK_ID(3, UNIT_SEC) },
1244 { "2x/4s", TALK_ID(4, UNIT_SEC) },
1245 { "2x/5s", TALK_ID(5, UNIT_SEC) },
1246 { "2x/6s", TALK_ID(6, UNIT_SEC) },
1247 { "2x/7s", TALK_ID(7, UNIT_SEC) },
1248 { "2x/8s", TALK_ID(8, UNIT_SEC) },
1249 { "2x/9s", TALK_ID(9, UNIT_SEC) },
1250 { "2x/10s", TALK_ID(10, UNIT_SEC) },
1251 { "2x/11s", TALK_ID(11, UNIT_SEC) },
1252 { "2x/12s", TALK_ID(12, UNIT_SEC) },
1253 { "2x/13s", TALK_ID(13, UNIT_SEC) },
1254 { "2x/14s", TALK_ID(14, UNIT_SEC) },
1255 { "2x/15s", TALK_ID(15, UNIT_SEC) }
1256 };
1257 return set_option(str(LANG_FFRW_ACCEL), &global_settings.ff_rewind_accel,
1258 INT, names, 16, NULL );
1259}
1260
1261static bool browse_current(void) 1125static bool browse_current(void)
1262{ 1126{
1263 return set_bool( str(LANG_FOLLOW), &global_settings.browse_current ); 1127 return set_bool( str(LANG_FOLLOW), &global_settings.browse_current );
@@ -1373,62 +1237,6 @@ static bool button_bar(void)
1373#endif /* CONFIG_KEYPAD == RECORDER_PAD */ 1237#endif /* CONFIG_KEYPAD == RECORDER_PAD */
1374#endif /* HAVE_LCD_BITMAP */ 1238#endif /* HAVE_LCD_BITMAP */
1375 1239
1376static bool ff_rewind_settings_menu(void)
1377{
1378 int m;
1379 bool result;
1380
1381 static const struct menu_item items[] = {
1382 { ID2P(LANG_FFRW_STEP), ff_rewind_min_step },
1383 { ID2P(LANG_FFRW_ACCEL), ff_rewind_accel },
1384 };
1385
1386 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1387 NULL, NULL, NULL);
1388 result = menu_run(m);
1389 menu_exit(m);
1390
1391 return result;
1392}
1393
1394static bool id3_order(void)
1395{
1396 return set_bool_options( str(LANG_ID3_ORDER),
1397 &global_settings.id3_v1_first,
1398 STR(LANG_ID3_V1_FIRST),
1399 STR(LANG_ID3_V2_FIRST),
1400 mpeg_id3_options);
1401}
1402
1403static bool next_folder(void)
1404{
1405 static const struct opt_items names[] = {
1406 { STR(LANG_SET_BOOL_NO) },
1407 { STR(LANG_SET_BOOL_YES) },
1408 { STR(LANG_RANDOM) },
1409 };
1410 return set_option(str(LANG_NEXT_FOLDER),
1411 &global_settings.next_folder,
1412 INT, names, 3, NULL );
1413}
1414
1415static bool audioscrobbler(void)
1416{
1417 bool result = set_bool_options(str(LANG_AUDIOSCROBBLER),
1418 &global_settings.audioscrobbler,
1419 STR(LANG_ON),
1420 STR(LANG_OFF),
1421 NULL);
1422
1423 if (!scrobbler_is_enabled() && global_settings.audioscrobbler)
1424 gui_syncsplash(HZ*2, true, str(LANG_PLEASE_REBOOT));
1425
1426 if(scrobbler_is_enabled() && !global_settings.audioscrobbler)
1427 scrobbler_shutdown();
1428
1429 return result;
1430}
1431
1432static bool codepage_setting(void) 1240static bool codepage_setting(void)
1433{ 1241{
1434 static const struct opt_items names[] = { 1242 static const struct opt_items names[] = {
@@ -1451,193 +1259,6 @@ static bool codepage_setting(void)
1451 INT, names, 13, set_codepage ); 1259 INT, names, 13, set_codepage );
1452} 1260}
1453 1261
1454#if CONFIG_CODEC == SWCODEC
1455static bool replaygain(void)
1456{
1457 bool result = set_bool(str(LANG_REPLAYGAIN_ENABLE),
1458 &global_settings.replaygain);
1459
1460 dsp_set_replaygain(true);
1461 return result;
1462}
1463
1464static bool replaygain_mode(void)
1465{
1466 static const struct opt_items names[] = {
1467 { STR(LANG_TRACK_GAIN) },
1468 { STR(LANG_ALBUM_GAIN) },
1469 { STR(LANG_SHUFFLE_GAIN) },
1470 };
1471 bool result = set_option(str(LANG_REPLAYGAIN_MODE),
1472 &global_settings.replaygain_type, INT, names, 3, NULL);
1473
1474 dsp_set_replaygain(true);
1475 return result;
1476}
1477
1478static bool replaygain_noclip(void)
1479{
1480 bool result = set_bool(str(LANG_REPLAYGAIN_NOCLIP),
1481 &global_settings.replaygain_noclip);
1482
1483 dsp_set_replaygain(true);
1484 return result;
1485}
1486
1487static void replaygain_preamp_format(char* buffer, int buffer_size, int value,
1488 const char* unit)
1489{
1490 int v = abs(value);
1491
1492 snprintf(buffer, buffer_size, "%s%d.%d %s", value < 0 ? "-" : "",
1493 v / 10, v % 10, unit);
1494}
1495
1496static bool replaygain_preamp(void)
1497{
1498 bool result = set_int(str(LANG_REPLAYGAIN_PREAMP), str(LANG_UNIT_DB),
1499 UNIT_DB, &global_settings.replaygain_preamp, NULL, 1, -120, 120,
1500 replaygain_preamp_format);
1501
1502 dsp_set_replaygain(true);
1503 return result;
1504}
1505
1506static bool replaygain_settings_menu(void)
1507{
1508 int m;
1509 bool result;
1510
1511 static const struct menu_item items[] = {
1512 { ID2P(LANG_REPLAYGAIN_ENABLE), replaygain },
1513 { ID2P(LANG_REPLAYGAIN_NOCLIP), replaygain_noclip },
1514 { ID2P(LANG_REPLAYGAIN_MODE), replaygain_mode },
1515 { ID2P(LANG_REPLAYGAIN_PREAMP), replaygain_preamp },
1516 };
1517
1518 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1519 NULL, NULL, NULL);
1520 result = menu_run(m);
1521 menu_exit(m);
1522 return result;
1523}
1524
1525static bool crossfade(void)
1526{
1527 static const struct opt_items names[] = {
1528 { STR(LANG_OFF) },
1529 { STR(LANG_SHUFFLE) },
1530 { STR(LANG_TRACKSKIP) },
1531 { STR(LANG_SHUFFLE_TRACKSKIP) },
1532 { STR(LANG_ALWAYS) },
1533 };
1534
1535 bool ret;
1536
1537 ret=set_option( str(LANG_CROSSFADE_ENABLE),
1538 &global_settings.crossfade, INT, names, 5, NULL);
1539 audio_set_crossfade(global_settings.crossfade);
1540 return ret;
1541}
1542
1543static bool crossfade_fade_in_delay(void)
1544{
1545 bool ret;
1546
1547 ret = set_int(str(LANG_CROSSFADE_FADE_IN_DELAY), "s", UNIT_SEC,
1548 &global_settings.crossfade_fade_in_delay,
1549 NULL, 1, 0, 7, NULL );
1550 audio_set_crossfade(global_settings.crossfade);
1551 return ret;
1552}
1553
1554static bool crossfade_fade_out_delay(void)
1555{
1556 bool ret;
1557
1558 ret = set_int(str(LANG_CROSSFADE_FADE_OUT_DELAY), "s", UNIT_SEC,
1559 &global_settings.crossfade_fade_out_delay,
1560 NULL, 1, 0, 7, NULL );
1561 audio_set_crossfade(global_settings.crossfade);
1562 return ret;
1563}
1564
1565static bool crossfade_fade_in_duration(void)
1566{
1567 bool ret;
1568
1569 ret = set_int(str(LANG_CROSSFADE_FADE_IN_DURATION), "s", UNIT_SEC,
1570 &global_settings.crossfade_fade_in_duration,
1571 NULL, 1, 0, 15, NULL );
1572 audio_set_crossfade(global_settings.crossfade);
1573 return ret;
1574}
1575
1576static bool crossfade_fade_out_duration(void)
1577{
1578 bool ret;
1579
1580 ret = set_int(str(LANG_CROSSFADE_FADE_OUT_DURATION), "s", UNIT_SEC,
1581 &global_settings.crossfade_fade_out_duration,
1582 NULL, 1, 0, 15, NULL );
1583 audio_set_crossfade(global_settings.crossfade);
1584 return ret;
1585}
1586
1587static bool crossfade_fade_out_mixmode(void)
1588{
1589 static const struct opt_items names[] = {
1590 { STR(LANG_CROSSFADE) },
1591 { STR(LANG_MIX) },
1592 };
1593 bool ret;
1594 ret=set_option( str(LANG_CROSSFADE_FADE_OUT_MODE),
1595 &global_settings.crossfade_fade_out_mixmode, INT, names, 2, NULL);
1596
1597 return ret;
1598}
1599
1600/**
1601 * Menu to configure the crossfade settings.
1602 */
1603static bool crossfade_settings_menu(void)
1604{
1605 int m;
1606 bool result;
1607
1608 static const struct menu_item items[] = {
1609 { ID2P(LANG_CROSSFADE_ENABLE), crossfade },
1610 { ID2P(LANG_CROSSFADE_FADE_IN_DELAY), crossfade_fade_in_delay },
1611 { ID2P(LANG_CROSSFADE_FADE_IN_DURATION), crossfade_fade_in_duration },
1612 { ID2P(LANG_CROSSFADE_FADE_OUT_DELAY), crossfade_fade_out_delay },
1613 { ID2P(LANG_CROSSFADE_FADE_OUT_DURATION), crossfade_fade_out_duration },
1614 { ID2P(LANG_CROSSFADE_FADE_OUT_MODE), crossfade_fade_out_mixmode },
1615 };
1616
1617 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1618 NULL, NULL, NULL);
1619 result = menu_run(m);
1620 menu_exit(m);
1621 return result;
1622}
1623
1624static bool beep(void)
1625{
1626 static const struct opt_items names[] = {
1627 { STR(LANG_OFF) },
1628 { STR(LANG_WEAK) },
1629 { STR(LANG_MODERATE) },
1630 { STR(LANG_STRONG) },
1631 };
1632 bool ret;
1633 ret=set_option( str(LANG_BEEP),
1634 &global_settings.beep, INT, names, 4, NULL);
1635
1636 return ret;
1637}
1638#endif
1639
1640
1641#ifdef HAVE_DIRCACHE 1262#ifdef HAVE_DIRCACHE
1642static bool dircache(void) 1263static bool dircache(void)
1643{ 1264{
@@ -1716,111 +1337,9 @@ static bool tagcache_settings_menu(void)
1716} 1337}
1717#endif 1338#endif
1718 1339
1719#ifdef HAVE_HEADPHONE_DETECTION
1720static bool unplug_mode(void)
1721{
1722 static const struct opt_items names[] = {
1723 { STR(LANG_OFF) },
1724 { STR(LANG_PAUSE) },
1725 { STR(LANG_UNPLUG_RESUME) },
1726 };
1727 bool ret;
1728 ret=set_option( str(LANG_UNPLUG),
1729 &global_settings.unplug_mode, INT, names, 3, NULL);
1730
1731 return ret;
1732}
1733
1734static bool unplug_rw(void)
1735{
1736 bool ret;
1737
1738 ret = set_int(str(LANG_UNPLUG_RW), "s", UNIT_SEC,
1739 &global_settings.unplug_rw,
1740 NULL, 1, 0, 15, NULL );
1741 audio_set_crossfade(global_settings.unplug_rw);
1742 return ret;
1743}
1744
1745static bool unplug_autoresume(void)
1746{
1747 return set_bool( str(LANG_UNPLUG_DISABLE_AUTORESUME),
1748 &global_settings.unplug_autoresume );
1749}
1750
1751static bool unplug_menu(void)
1752{
1753 int m;
1754 bool result;
1755
1756 static const struct menu_item items[] = {
1757 { ID2P(LANG_UNPLUG), unplug_mode },
1758 { ID2P(LANG_UNPLUG_RW), unplug_rw },
1759 { ID2P(LANG_UNPLUG_DISABLE_AUTORESUME), unplug_autoresume },
1760 };
1761
1762 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1763 NULL, NULL, NULL);
1764 result = menu_run(m);
1765 menu_exit(m);
1766 return result;
1767}
1768#endif
1769
1770bool playback_settings_menu(void) 1340bool playback_settings_menu(void)
1771{ 1341{
1772 int m; 1342 return do_menu(&playback_menu_item);
1773 bool result;
1774
1775 static const struct menu_item items[] = {
1776 { ID2P(LANG_SHUFFLE), shuffle },
1777 { ID2P(LANG_REPEAT), repeat_mode },
1778 { ID2P(LANG_PLAY_SELECTED), play_selected },
1779 { ID2P(LANG_RESUME), resume },
1780 { ID2P(LANG_WIND_MENU), ff_rewind_settings_menu },
1781 { ID2P(LANG_MP3BUFFER_MARGIN), buffer_margin },
1782 { ID2P(LANG_FADE_ON_STOP), set_fade_on_stop },
1783 { ID2P(LANG_PARTY_MODE), set_party_mode },
1784#if CONFIG_CODEC == SWCODEC
1785 { ID2P(LANG_CROSSFADE), crossfade_settings_menu },
1786 { ID2P(LANG_REPLAYGAIN), replaygain_settings_menu },
1787 { ID2P(LANG_BEEP), beep },
1788#endif
1789#ifdef HAVE_SPDIF_POWER
1790 { ID2P(LANG_SPDIF_ENABLE), spdif },
1791#endif
1792 { ID2P(LANG_ID3_ORDER), id3_order },
1793 { ID2P(LANG_NEXT_FOLDER), next_folder },
1794#ifdef HAVE_HEADPHONE_DETECTION
1795 { ID2P(LANG_UNPLUG), unplug_menu },
1796#endif
1797 { ID2P(LANG_AUDIOSCROBBLER), audioscrobbler}
1798 };
1799
1800 bool old_shuffle = global_settings.playlist_shuffle;
1801
1802 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
1803 NULL, NULL, NULL);
1804 result = menu_run(m);
1805 menu_exit(m);
1806
1807 if ((old_shuffle != global_settings.playlist_shuffle)
1808 && (audio_status() & AUDIO_STATUS_PLAY))
1809 {
1810#if CONFIG_CODEC == SWCODEC
1811 dsp_set_replaygain(true);
1812#endif
1813
1814 if (global_settings.playlist_shuffle)
1815 {
1816 playlist_randomise(NULL, current_tick, true);
1817 }
1818 else
1819 {
1820 playlist_sort(NULL, true);
1821 }
1822 }
1823 return result;
1824} 1343}
1825 1344
1826static bool bookmark_settings_menu(void) 1345static bool bookmark_settings_menu(void)