diff options
Diffstat (limited to 'apps/settings_menu.c')
-rw-r--r-- | apps/settings_menu.c | 155 |
1 files changed, 115 insertions, 40 deletions
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index b6d6b2bdac..65e40f9f10 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -1110,44 +1110,6 @@ static bool id3_order(void) | |||
1110 | mpeg_id3_options); | 1110 | mpeg_id3_options); |
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | #if CONFIG_CODEC == SWCODEC | ||
1114 | static bool crossfade(void) | ||
1115 | { | ||
1116 | static const struct opt_items names[] = { | ||
1117 | { STR(LANG_OFF) }, | ||
1118 | { STR(LANG_CROSSFADE) }, | ||
1119 | { STR(LANG_MIX) }, | ||
1120 | }; | ||
1121 | bool ret; | ||
1122 | |||
1123 | ret = set_option( str(LANG_CROSSFADE), | ||
1124 | &global_settings.crossfade, INT, names, 3, NULL); | ||
1125 | audio_set_crossfade(global_settings.crossfade); | ||
1126 | |||
1127 | return ret; | ||
1128 | } | ||
1129 | |||
1130 | static bool crossfade_duration(void) | ||
1131 | { | ||
1132 | static const struct opt_items names[] = { | ||
1133 | { "1s", TALK_ID(1, UNIT_SEC) }, | ||
1134 | { "2s", TALK_ID(2, UNIT_SEC) }, | ||
1135 | { "4s", TALK_ID(4, UNIT_SEC) }, | ||
1136 | { "6s", TALK_ID(6, UNIT_SEC) }, | ||
1137 | { "8s", TALK_ID(8, UNIT_SEC) }, | ||
1138 | { "10s", TALK_ID(10, UNIT_SEC) }, | ||
1139 | { "12s", TALK_ID(12, UNIT_SEC) }, | ||
1140 | { "14s", TALK_ID(14, UNIT_SEC) }, | ||
1141 | }; | ||
1142 | bool ret; | ||
1143 | ret=set_option( str(LANG_CROSSFADE_DURATION), | ||
1144 | &global_settings.crossfade_duration, INT, names, 8, NULL); | ||
1145 | audio_set_crossfade(global_settings.crossfade); | ||
1146 | |||
1147 | return ret; | ||
1148 | } | ||
1149 | #endif | ||
1150 | |||
1151 | static bool next_folder(void) | 1113 | static bool next_folder(void) |
1152 | { | 1114 | { |
1153 | return set_bool( str(LANG_NEXT_FOLDER), &global_settings.next_folder ); | 1115 | return set_bool( str(LANG_NEXT_FOLDER), &global_settings.next_folder ); |
@@ -1239,6 +1201,120 @@ static bool replaygain_settings_menu(void) | |||
1239 | return result; | 1201 | return result; |
1240 | } | 1202 | } |
1241 | 1203 | ||
1204 | static bool crossfade(void) | ||
1205 | { | ||
1206 | static const struct opt_items names[] = { | ||
1207 | { STR(LANG_OFF) }, | ||
1208 | { STR(LANG_SHUFFLE) }, | ||
1209 | { STR(LANG_ALWAYS) }, | ||
1210 | }; | ||
1211 | |||
1212 | bool ret; | ||
1213 | |||
1214 | ret=set_option( str(LANG_CROSSFADE_ENABLE), | ||
1215 | &global_settings.crossfade, INT, names, 3, NULL); | ||
1216 | |||
1217 | audio_set_crossfade(global_settings.crossfade); | ||
1218 | |||
1219 | return ret; | ||
1220 | } | ||
1221 | |||
1222 | static const struct opt_items crossfade_time[] = { | ||
1223 | { "0s", TALK_ID(0, UNIT_SEC) }, | ||
1224 | { "1s", TALK_ID(1, UNIT_SEC) }, | ||
1225 | { "2s", TALK_ID(2, UNIT_SEC) }, | ||
1226 | { "3s", TALK_ID(3, UNIT_SEC) }, | ||
1227 | { "4s", TALK_ID(4, UNIT_SEC) }, | ||
1228 | { "5s", TALK_ID(5, UNIT_SEC) }, | ||
1229 | { "6s", TALK_ID(6, UNIT_SEC) }, | ||
1230 | { "7s", TALK_ID(7, UNIT_SEC) }, | ||
1231 | { "8s", TALK_ID(8, UNIT_SEC) }, | ||
1232 | { "9s", TALK_ID(9, UNIT_SEC) }, | ||
1233 | { "10s", TALK_ID(10, UNIT_SEC) }, | ||
1234 | { "11s", TALK_ID(11, UNIT_SEC) }, | ||
1235 | { "12s", TALK_ID(12, UNIT_SEC) }, | ||
1236 | { "13s", TALK_ID(13, UNIT_SEC) }, | ||
1237 | { "14s", TALK_ID(14, UNIT_SEC) }, | ||
1238 | { "15s", TALK_ID(15, UNIT_SEC) }, | ||
1239 | }; | ||
1240 | |||
1241 | static bool crossfade_fade_in_delay(void) | ||
1242 | { | ||
1243 | bool ret; | ||
1244 | ret=set_option( str(LANG_CROSSFADE_FADE_IN_DELAY), | ||
1245 | &global_settings.crossfade_fade_in_delay, INT, crossfade_time, 8, NULL); | ||
1246 | audio_set_crossfade(global_settings.crossfade); | ||
1247 | |||
1248 | return ret; | ||
1249 | } | ||
1250 | |||
1251 | static bool crossfade_fade_out_delay(void) | ||
1252 | { | ||
1253 | bool ret; | ||
1254 | ret=set_option( str(LANG_CROSSFADE_FADE_OUT_DELAY), | ||
1255 | &global_settings.crossfade_fade_out_delay, INT, crossfade_time, 8, NULL); | ||
1256 | audio_set_crossfade(global_settings.crossfade); | ||
1257 | |||
1258 | return ret; | ||
1259 | } | ||
1260 | |||
1261 | static bool crossfade_fade_in_duration(void) | ||
1262 | { | ||
1263 | bool ret; | ||
1264 | ret=set_option( str(LANG_CROSSFADE_FADE_IN_DURATION), | ||
1265 | &global_settings.crossfade_fade_in_duration, INT, crossfade_time, 16, NULL); | ||
1266 | audio_set_crossfade(global_settings.crossfade); | ||
1267 | |||
1268 | return ret; | ||
1269 | } | ||
1270 | |||
1271 | static bool crossfade_fade_out_duration(void) | ||
1272 | { | ||
1273 | bool ret; | ||
1274 | ret=set_option( str(LANG_CROSSFADE_FADE_OUT_DURATION), | ||
1275 | &global_settings.crossfade_fade_out_duration, INT, crossfade_time, 16, NULL); | ||
1276 | audio_set_crossfade(global_settings.crossfade); | ||
1277 | |||
1278 | return ret; | ||
1279 | } | ||
1280 | |||
1281 | static bool crossfade_fade_out_mixmode(void) | ||
1282 | { | ||
1283 | static const struct opt_items names[] = { | ||
1284 | { STR(LANG_CROSSFADE) }, | ||
1285 | { STR(LANG_MIX) }, | ||
1286 | }; | ||
1287 | bool ret; | ||
1288 | ret=set_option( str(LANG_CROSSFADE_FADE_OUT_MODE), | ||
1289 | &global_settings.crossfade_fade_out_mixmode, INT, names, 2, NULL); | ||
1290 | |||
1291 | return ret; | ||
1292 | } | ||
1293 | |||
1294 | /** | ||
1295 | * Menu to configure the crossfade settings. | ||
1296 | */ | ||
1297 | static bool crossfade_settings_menu(void) | ||
1298 | { | ||
1299 | int m; | ||
1300 | bool result; | ||
1301 | |||
1302 | static const struct menu_item items[] = { | ||
1303 | { ID2P(LANG_CROSSFADE_ENABLE), crossfade }, | ||
1304 | { ID2P(LANG_CROSSFADE_FADE_IN_DELAY), crossfade_fade_in_delay }, | ||
1305 | { ID2P(LANG_CROSSFADE_FADE_IN_DURATION), crossfade_fade_in_duration }, | ||
1306 | { ID2P(LANG_CROSSFADE_FADE_OUT_DELAY), crossfade_fade_out_delay }, | ||
1307 | { ID2P(LANG_CROSSFADE_FADE_OUT_DURATION), crossfade_fade_out_duration }, | ||
1308 | { ID2P(LANG_CROSSFADE_FADE_OUT_MODE), crossfade_fade_out_mixmode }, | ||
1309 | }; | ||
1310 | |||
1311 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | ||
1312 | NULL, NULL, NULL); | ||
1313 | result = menu_run(m); | ||
1314 | menu_exit(m); | ||
1315 | return result; | ||
1316 | } | ||
1317 | |||
1242 | static bool beep(void) | 1318 | static bool beep(void) |
1243 | { | 1319 | { |
1244 | static const struct opt_items names[] = { | 1320 | static const struct opt_items names[] = { |
@@ -1289,8 +1365,7 @@ static bool playback_settings_menu(void) | |||
1289 | { ID2P(LANG_MP3BUFFER_MARGIN), buffer_margin }, | 1365 | { ID2P(LANG_MP3BUFFER_MARGIN), buffer_margin }, |
1290 | { ID2P(LANG_FADE_ON_STOP), set_fade_on_stop }, | 1366 | { ID2P(LANG_FADE_ON_STOP), set_fade_on_stop }, |
1291 | #if CONFIG_CODEC == SWCODEC | 1367 | #if CONFIG_CODEC == SWCODEC |
1292 | { ID2P(LANG_CROSSFADE), crossfade }, | 1368 | { ID2P(LANG_CROSSFADE), crossfade_settings_menu }, |
1293 | { ID2P(LANG_CROSSFADE_DURATION), crossfade_duration }, | ||
1294 | { ID2P(LANG_REPLAYGAIN), replaygain_settings_menu }, | 1369 | { ID2P(LANG_REPLAYGAIN), replaygain_settings_menu }, |
1295 | { ID2P(LANG_BEEP), beep }, | 1370 | { ID2P(LANG_BEEP), beep }, |
1296 | #endif | 1371 | #endif |