diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-11-10 23:18:33 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-11-10 23:18:33 +0000 |
commit | afe0da9e1677c5164291150286531ccd46ebef10 (patch) | |
tree | dc4299188d85bb2ea7babd08b57813b4df03ba8b /apps | |
parent | 8e4a0e0aabc9c35cc6b9bc9506e629dabf291031 (diff) | |
download | rockbox-afe0da9e1677c5164291150286531ccd46ebef10.tar.gz rockbox-afe0da9e1677c5164291150286531ccd46ebef10.zip |
Recording settings are now persistent. Added a Recording Settings menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2818 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lang/english.lang | 24 | ||||
-rw-r--r-- | apps/main_menu.c | 1 | ||||
-rw-r--r-- | apps/recorder/recording.c | 203 | ||||
-rw-r--r-- | apps/settings.c | 49 | ||||
-rw-r--r-- | apps/settings.h | 19 | ||||
-rw-r--r-- | apps/sound_menu.c | 57 | ||||
-rw-r--r-- | apps/sound_menu.h | 1 |
7 files changed, 251 insertions, 103 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index d190614a78..6ded417b2d 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -1118,7 +1118,27 @@ desc: in the recording settings | |||
1118 | eng: "Source" | 1118 | eng: "Source" |
1119 | new: | 1119 | new: |
1120 | 1120 | ||
1121 | id: LANG_RECORDING_CHANNEL | 1121 | id: LANG_RECORDING_CHANNELS |
1122 | desc: in the recording settings | 1122 | desc: in the recording settings |
1123 | eng: "Channel" | 1123 | eng: "Channels" |
1124 | new: | ||
1125 | |||
1126 | id: LANG_RECORDING_SRC_MIC | ||
1127 | desc: in the recording settings | ||
1128 | eng: "Mic" | ||
1129 | new: | ||
1130 | |||
1131 | id: LANG_RECORDING_SRC_LINE | ||
1132 | desc: in the recording settings | ||
1133 | eng: "Line In" | ||
1134 | new: | ||
1135 | |||
1136 | id: LANG_RECORDING_SRC_DIGITAL | ||
1137 | desc: in the recording settings | ||
1138 | eng: "Digital" | ||
1139 | new: | ||
1140 | |||
1141 | id: LANG_RECORDING_SETTINGS | ||
1142 | desc: in the main menu | ||
1143 | eng: "Recording settings" | ||
1124 | new: | 1144 | new: |
diff --git a/apps/main_menu.c b/apps/main_menu.c index 5399c996c9..12bd2274cb 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c | |||
@@ -228,6 +228,7 @@ bool main_menu(void) | |||
228 | { str(LANG_SOUND_SETTINGS), sound_menu }, | 228 | { str(LANG_SOUND_SETTINGS), sound_menu }, |
229 | { str(LANG_GENERAL_SETTINGS), settings_menu }, | 229 | { str(LANG_GENERAL_SETTINGS), settings_menu }, |
230 | #ifdef HAVE_MAS3587F | 230 | #ifdef HAVE_MAS3587F |
231 | { str(LANG_RECORDING_SETTINGS), recording_menu }, | ||
231 | { str(LANG_RECORDING), recording_screen }, | 232 | { str(LANG_RECORDING), recording_screen }, |
232 | #endif | 233 | #endif |
233 | #ifdef HAVE_LCD_BITMAP | 234 | #ifdef HAVE_LCD_BITMAP |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 3ec4249f3c..70aa1257ce 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include "peakmeter.h" | 35 | #include "peakmeter.h" |
36 | #include "status.h" | 36 | #include "status.h" |
37 | #include "menu.h" | 37 | #include "menu.h" |
38 | #include "sound_menu.h" | ||
38 | 39 | ||
39 | bool f2_rec_screen(void); | 40 | bool f2_rec_screen(void); |
40 | bool f3_rec_screen(void); | 41 | bool f3_rec_screen(void); |
@@ -46,14 +47,6 @@ extern int mp3buf_write; | |||
46 | extern int mp3buf_read; | 47 | extern int mp3buf_read; |
47 | extern bool recording; | 48 | extern bool recording; |
48 | 49 | ||
49 | int mic_gain = 8; | ||
50 | int left_gain = 2; | ||
51 | int right_gain = 2; | ||
52 | unsigned int recording_quality = 5; | ||
53 | unsigned int recording_frequency = 0; | ||
54 | unsigned int recording_channel_mode = 0; | ||
55 | unsigned int recording_source = 0; | ||
56 | |||
57 | #define SOURCE_MIC 0 | 50 | #define SOURCE_MIC 0 |
58 | #define SOURCE_LINE 1 | 51 | #define SOURCE_LINE 1 |
59 | #define SOURCE_SPDIF 2 | 52 | #define SOURCE_SPDIF 2 |
@@ -70,13 +63,15 @@ char *freq_str[6] = | |||
70 | 63 | ||
71 | static void set_gain(void) | 64 | static void set_gain(void) |
72 | { | 65 | { |
73 | if(recording_source == SOURCE_MIC) | 66 | if(global_settings.rec_source == SOURCE_MIC) |
74 | { | 67 | { |
75 | mpeg_set_recording_gain(left_gain, 0, mic_gain); | 68 | mpeg_set_recording_gain(global_settings.rec_left_gain, 0, |
69 | global_settings.rec_mic_gain); | ||
76 | } | 70 | } |
77 | else | 71 | else |
78 | { | 72 | { |
79 | mpeg_set_recording_gain(left_gain, right_gain, 0); | 73 | mpeg_set_recording_gain(global_settings.rec_left_gain, |
74 | global_settings.rec_right_gain, 0); | ||
80 | } | 75 | } |
81 | } | 76 | } |
82 | 77 | ||
@@ -107,7 +102,7 @@ int cursor; | |||
107 | 102 | ||
108 | void adjust_cursor(void) | 103 | void adjust_cursor(void) |
109 | { | 104 | { |
110 | if(recording_source == SOURCE_LINE) | 105 | if(global_settings.rec_source == SOURCE_LINE) |
111 | { | 106 | { |
112 | if(cursor < 0) | 107 | if(cursor < 0) |
113 | cursor = 0; | 108 | cursor = 0; |
@@ -140,8 +135,10 @@ bool recording_screen(void) | |||
140 | 135 | ||
141 | peak_meter_enabled = true; | 136 | peak_meter_enabled = true; |
142 | 137 | ||
143 | mpeg_set_recording_options(recording_frequency, recording_quality, | 138 | mpeg_set_recording_options(global_settings.rec_frequency, |
144 | recording_source, recording_channel_mode); | 139 | global_settings.rec_quality, |
140 | global_settings.rec_source, | ||
141 | global_settings.rec_channels); | ||
145 | 142 | ||
146 | lcd_setfont(FONT_UI); | 143 | lcd_setfont(FONT_UI); |
147 | lcd_getstringsize("M", &w, &h); | 144 | lcd_getstringsize("M", &w, &h); |
@@ -189,30 +186,37 @@ bool recording_screen(void) | |||
189 | switch(cursor) | 186 | switch(cursor) |
190 | { | 187 | { |
191 | case 0: | 188 | case 0: |
192 | if(recording_source == SOURCE_MIC) | 189 | if(global_settings.rec_source == SOURCE_MIC) |
193 | { | 190 | { |
194 | mic_gain++; | 191 | global_settings.rec_mic_gain++; |
195 | if(mic_gain > mpeg_sound_max(SOUND_MIC_GAIN)) | 192 | if(global_settings.rec_mic_gain > |
196 | mic_gain = mpeg_sound_max(SOUND_MIC_GAIN); | 193 | mpeg_sound_max(SOUND_MIC_GAIN)) |
194 | global_settings.rec_mic_gain = | ||
195 | mpeg_sound_max(SOUND_MIC_GAIN); | ||
197 | } | 196 | } |
198 | else | 197 | else |
199 | { | 198 | { |
200 | gain = MAX(left_gain, right_gain) + 1; | 199 | gain = MAX(global_settings.rec_left_gain, |
200 | global_settings.rec_right_gain) + 1; | ||
201 | if(gain > mpeg_sound_max(SOUND_MIC_GAIN)) | 201 | if(gain > mpeg_sound_max(SOUND_MIC_GAIN)) |
202 | gain = mpeg_sound_max(SOUND_MIC_GAIN); | 202 | gain = mpeg_sound_max(SOUND_MIC_GAIN); |
203 | left_gain = gain; | 203 | global_settings.rec_left_gain = gain; |
204 | right_gain = gain; | 204 | global_settings.rec_right_gain = gain; |
205 | } | 205 | } |
206 | break; | 206 | break; |
207 | case 1: | 207 | case 1: |
208 | left_gain++; | 208 | global_settings.rec_left_gain++; |
209 | if(left_gain > mpeg_sound_max(SOUND_LEFT_GAIN)) | 209 | if(global_settings.rec_left_gain > |
210 | left_gain = mpeg_sound_max(SOUND_LEFT_GAIN); | 210 | mpeg_sound_max(SOUND_LEFT_GAIN)) |
211 | global_settings.rec_left_gain = | ||
212 | mpeg_sound_max(SOUND_LEFT_GAIN); | ||
211 | break; | 213 | break; |
212 | case 2: | 214 | case 2: |
213 | right_gain++; | 215 | global_settings.rec_right_gain++; |
214 | if(right_gain > mpeg_sound_max(SOUND_RIGHT_GAIN)) | 216 | if(global_settings.rec_right_gain > |
215 | right_gain = mpeg_sound_max(SOUND_RIGHT_GAIN); | 217 | mpeg_sound_max(SOUND_RIGHT_GAIN)) |
218 | global_settings.rec_right_gain = | ||
219 | mpeg_sound_max(SOUND_RIGHT_GAIN); | ||
216 | break; | 220 | break; |
217 | } | 221 | } |
218 | set_gain(); | 222 | set_gain(); |
@@ -223,36 +227,50 @@ bool recording_screen(void) | |||
223 | switch(cursor) | 227 | switch(cursor) |
224 | { | 228 | { |
225 | case 0: | 229 | case 0: |
226 | if(recording_source == SOURCE_MIC) | 230 | if(global_settings.rec_source == SOURCE_MIC) |
227 | { | 231 | { |
228 | mic_gain--; | 232 | global_settings.rec_mic_gain--; |
229 | if(mic_gain < mpeg_sound_min(SOUND_MIC_GAIN)) | 233 | if(global_settings.rec_mic_gain < |
230 | mic_gain = mpeg_sound_min(SOUND_MIC_GAIN); | 234 | mpeg_sound_min(SOUND_MIC_GAIN)) |
235 | global_settings.rec_mic_gain = | ||
236 | mpeg_sound_min(SOUND_MIC_GAIN); | ||
231 | } | 237 | } |
232 | else | 238 | else |
233 | { | 239 | { |
234 | gain = MAX(left_gain, right_gain) - 1; | 240 | gain = MAX(global_settings.rec_left_gain, |
241 | global_settings.rec_right_gain) - 1; | ||
235 | if(gain < mpeg_sound_min(SOUND_LEFT_GAIN)) | 242 | if(gain < mpeg_sound_min(SOUND_LEFT_GAIN)) |
236 | gain = mpeg_sound_min(SOUND_LEFT_GAIN); | 243 | gain = mpeg_sound_min(SOUND_LEFT_GAIN); |
237 | left_gain = gain; | 244 | global_settings.rec_left_gain = gain; |
238 | right_gain = gain; | 245 | global_settings.rec_right_gain = gain; |
239 | } | 246 | } |
240 | break; | 247 | break; |
241 | case 1: | 248 | case 1: |
242 | left_gain--; | 249 | global_settings.rec_left_gain--; |
243 | if(left_gain < mpeg_sound_min(SOUND_LEFT_GAIN)) | 250 | if(global_settings.rec_left_gain < |
244 | left_gain = mpeg_sound_min(SOUND_LEFT_GAIN); | 251 | mpeg_sound_min(SOUND_LEFT_GAIN)) |
252 | global_settings.rec_left_gain = | ||
253 | mpeg_sound_min(SOUND_LEFT_GAIN); | ||
245 | break; | 254 | break; |
246 | case 2: | 255 | case 2: |
247 | right_gain--; | 256 | global_settings.rec_right_gain--; |
248 | if(right_gain < mpeg_sound_min(SOUND_MIC_GAIN)) | 257 | if(global_settings.rec_right_gain < |
249 | right_gain = mpeg_sound_min(SOUND_MIC_GAIN); | 258 | mpeg_sound_min(SOUND_MIC_GAIN)) |
259 | global_settings.rec_right_gain = | ||
260 | mpeg_sound_min(SOUND_MIC_GAIN); | ||
250 | break; | 261 | break; |
251 | } | 262 | } |
252 | set_gain(); | 263 | set_gain(); |
253 | update_countdown = 1; /* Update immediately */ | 264 | update_countdown = 1; /* Update immediately */ |
254 | break; | 265 | break; |
255 | 266 | ||
267 | case BUTTON_F1: | ||
268 | if (recording_menu()) | ||
269 | return SYS_USB_CONNECTED; | ||
270 | settings_save(); | ||
271 | update_countdown = 1; /* Update immediately */ | ||
272 | break; | ||
273 | |||
256 | case BUTTON_F2: | 274 | case BUTTON_F2: |
257 | if (f2_rec_screen()) | 275 | if (f2_rec_screen()) |
258 | return SYS_USB_CONNECTED; | 276 | return SYS_USB_CONNECTED; |
@@ -282,18 +300,20 @@ bool recording_screen(void) | |||
282 | peak_meter_draw(0, 8 + h, LCD_WIDTH, h); | 300 | peak_meter_draw(0, 8 + h, LCD_WIDTH, h); |
283 | 301 | ||
284 | /* Show mic gain if input source is Mic */ | 302 | /* Show mic gain if input source is Mic */ |
285 | if(recording_source == 0) | 303 | if(global_settings.rec_source == 0) |
286 | { | 304 | { |
287 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN), | 305 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN), |
288 | fmt_gain(SOUND_MIC_GAIN, mic_gain, | 306 | fmt_gain(SOUND_MIC_GAIN, |
307 | global_settings.rec_mic_gain, | ||
289 | buf2, sizeof(buf2))); | 308 | buf2, sizeof(buf2))); |
290 | lcd_puts(0, 3, buf); | 309 | lcd_puts(0, 3, buf); |
291 | } | 310 | } |
292 | else | 311 | else |
293 | { | 312 | { |
294 | if(recording_source == SOURCE_LINE) | 313 | if(global_settings.rec_source == SOURCE_LINE) |
295 | { | 314 | { |
296 | gain = MAX(left_gain, right_gain); | 315 | gain = MAX(global_settings.rec_left_gain, |
316 | global_settings.rec_right_gain); | ||
297 | 317 | ||
298 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN), | 318 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN), |
299 | fmt_gain(SOUND_LEFT_GAIN, gain, | 319 | fmt_gain(SOUND_LEFT_GAIN, gain, |
@@ -301,12 +321,14 @@ bool recording_screen(void) | |||
301 | lcd_puts(0, 3, buf); | 321 | lcd_puts(0, 3, buf); |
302 | 322 | ||
303 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_LEFT), | 323 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_LEFT), |
304 | fmt_gain(SOUND_LEFT_GAIN, left_gain, | 324 | fmt_gain(SOUND_LEFT_GAIN, |
325 | global_settings.rec_left_gain, | ||
305 | buf2, sizeof(buf2))); | 326 | buf2, sizeof(buf2))); |
306 | lcd_puts(0, 4, buf); | 327 | lcd_puts(0, 4, buf); |
307 | 328 | ||
308 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_RIGHT), | 329 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_RIGHT), |
309 | fmt_gain(SOUND_RIGHT_GAIN, right_gain, | 330 | fmt_gain(SOUND_RIGHT_GAIN, |
331 | global_settings.rec_right_gain, | ||
310 | buf2, sizeof(buf2))); | 332 | buf2, sizeof(buf2))); |
311 | lcd_puts(0, 5, buf); | 333 | lcd_puts(0, 5, buf); |
312 | } | 334 | } |
@@ -314,14 +336,14 @@ bool recording_screen(void) | |||
314 | 336 | ||
315 | status_draw(); | 337 | status_draw(); |
316 | 338 | ||
317 | if(recording_source != SOURCE_SPDIF) | 339 | if(global_settings.rec_source != SOURCE_SPDIF) |
318 | put_cursorxy(0, 3 + cursor, true); | 340 | put_cursorxy(0, 3 + cursor, true); |
319 | 341 | ||
320 | snprintf(buf, 32, "%s %s [%d]", | 342 | snprintf(buf, 32, "%s %s [%d]", |
321 | freq_str[recording_frequency], | 343 | freq_str[global_settings.rec_frequency], |
322 | recording_channel_mode? | 344 | global_settings.rec_channels? |
323 | str(LANG_CHANNEL_MONO):str(LANG_CHANNEL_STEREO), | 345 | str(LANG_CHANNEL_MONO):str(LANG_CHANNEL_STEREO), |
324 | recording_quality); | 346 | global_settings.rec_quality); |
325 | lcd_puts(0, 6, buf); | 347 | lcd_puts(0, 6, buf); |
326 | } | 348 | } |
327 | else | 349 | else |
@@ -357,7 +379,7 @@ bool f2_rec_screen(void) | |||
357 | 379 | ||
358 | /* Recording quality */ | 380 | /* Recording quality */ |
359 | lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_RECORDING_QUALITY)); | 381 | lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_RECORDING_QUALITY)); |
360 | snprintf(buf, 32, "%d", recording_quality); | 382 | snprintf(buf, 32, "%d", global_settings.rec_quality); |
361 | lcd_putsxy(0, LCD_HEIGHT/2-h, buf); | 383 | lcd_putsxy(0, LCD_HEIGHT/2-h, buf); |
362 | lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], | 384 | lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], |
363 | LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); | 385 | LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); |
@@ -366,14 +388,14 @@ bool f2_rec_screen(void) | |||
366 | snprintf(buf, sizeof buf, "%s:", str(LANG_RECORDING_FREQUENCY)); | 388 | snprintf(buf, sizeof buf, "%s:", str(LANG_RECORDING_FREQUENCY)); |
367 | lcd_getstringsize(buf,&w,&h); | 389 | lcd_getstringsize(buf,&w,&h); |
368 | lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, buf); | 390 | lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, buf); |
369 | ptr = freq_str[recording_frequency]; | 391 | ptr = freq_str[global_settings.rec_frequency]; |
370 | lcd_getstringsize(ptr, &w, &h); | 392 | lcd_getstringsize(ptr, &w, &h); |
371 | lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr); | 393 | lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr); |
372 | lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow], | 394 | lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow], |
373 | LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true); | 395 | LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true); |
374 | 396 | ||
375 | /* Channel mode */ | 397 | /* Channel mode */ |
376 | switch ( recording_channel_mode ) { | 398 | switch ( global_settings.rec_channels ) { |
377 | case 0: | 399 | case 0: |
378 | ptr = str(LANG_CHANNEL_STEREO); | 400 | ptr = str(LANG_CHANNEL_STEREO); |
379 | break; | 401 | break; |
@@ -383,9 +405,9 @@ bool f2_rec_screen(void) | |||
383 | break; | 405 | break; |
384 | } | 406 | } |
385 | 407 | ||
386 | lcd_getstringsize(str(LANG_RECORDING_CHANNEL), &w, &h); | 408 | lcd_getstringsize(str(LANG_RECORDING_CHANNELS), &w, &h); |
387 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, | 409 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, |
388 | str(LANG_RECORDING_CHANNEL)); | 410 | str(LANG_RECORDING_CHANNELS)); |
389 | lcd_getstringsize(str(LANG_F2_MODE), &w, &h); | 411 | lcd_getstringsize(str(LANG_F2_MODE), &w, &h); |
390 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F2_MODE)); | 412 | lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F2_MODE)); |
391 | lcd_getstringsize(ptr, &w, &h); | 413 | lcd_getstringsize(ptr, &w, &h); |
@@ -398,25 +420,25 @@ bool f2_rec_screen(void) | |||
398 | switch (button_get(true)) { | 420 | switch (button_get(true)) { |
399 | case BUTTON_LEFT: | 421 | case BUTTON_LEFT: |
400 | case BUTTON_F2 | BUTTON_LEFT: | 422 | case BUTTON_F2 | BUTTON_LEFT: |
401 | recording_quality++; | 423 | global_settings.rec_quality++; |
402 | if(recording_quality > 7) | 424 | if(global_settings.rec_quality > 7) |
403 | recording_quality = 0; | 425 | global_settings.rec_quality = 0; |
404 | used = true; | 426 | used = true; |
405 | break; | 427 | break; |
406 | 428 | ||
407 | case BUTTON_DOWN: | 429 | case BUTTON_DOWN: |
408 | case BUTTON_F2 | BUTTON_DOWN: | 430 | case BUTTON_F2 | BUTTON_DOWN: |
409 | recording_frequency++; | 431 | global_settings.rec_frequency++; |
410 | if(recording_frequency > 5) | 432 | if(global_settings.rec_frequency > 5) |
411 | recording_frequency = 0; | 433 | global_settings.rec_frequency = 0; |
412 | used = true; | 434 | used = true; |
413 | break; | 435 | break; |
414 | 436 | ||
415 | case BUTTON_RIGHT: | 437 | case BUTTON_RIGHT: |
416 | case BUTTON_F2 | BUTTON_RIGHT: | 438 | case BUTTON_F2 | BUTTON_RIGHT: |
417 | recording_channel_mode++; | 439 | global_settings.rec_channels++; |
418 | if(recording_channel_mode > 1) | 440 | if(global_settings.rec_channels > 1) |
419 | recording_channel_mode = 0; | 441 | global_settings.rec_channels = 0; |
420 | used = true; | 442 | used = true; |
421 | break; | 443 | break; |
422 | 444 | ||
@@ -436,27 +458,30 @@ bool f2_rec_screen(void) | |||
436 | } | 458 | } |
437 | } | 459 | } |
438 | 460 | ||
439 | mpeg_set_recording_options(recording_frequency, recording_quality, | 461 | mpeg_set_recording_options(global_settings.rec_frequency, |
440 | recording_source, recording_channel_mode); | 462 | global_settings.rec_quality, |
463 | global_settings.rec_source, | ||
464 | global_settings.rec_channels); | ||
441 | 465 | ||
442 | // settings_save(); | 466 | set_gain(); |
467 | |||
468 | settings_save(); | ||
443 | lcd_setfont(FONT_UI); | 469 | lcd_setfont(FONT_UI); |
444 | 470 | ||
445 | return false; | 471 | return false; |
446 | } | 472 | } |
447 | 473 | ||
448 | char *src_str[] = | ||
449 | { | ||
450 | "Mic", | ||
451 | "Line In", | ||
452 | "Digital" | ||
453 | }; | ||
454 | |||
455 | bool f3_rec_screen(void) | 474 | bool f3_rec_screen(void) |
456 | { | 475 | { |
457 | bool exit = false; | 476 | bool exit = false; |
458 | bool used = false; | 477 | bool used = false; |
459 | int w, h; | 478 | int w, h; |
479 | char *src_str[] = | ||
480 | { | ||
481 | str(LANG_RECORDING_SRC_MIC), | ||
482 | str(LANG_RECORDING_SRC_LINE), | ||
483 | str(LANG_RECORDING_SRC_DIGITAL) | ||
484 | }; | ||
460 | 485 | ||
461 | lcd_setfont(FONT_SYSFIXED); | 486 | lcd_setfont(FONT_SYSFIXED); |
462 | lcd_getstringsize("A",&w,&h); | 487 | lcd_getstringsize("A",&w,&h); |
@@ -469,7 +494,7 @@ bool f3_rec_screen(void) | |||
469 | 494 | ||
470 | /* Recording source */ | 495 | /* Recording source */ |
471 | lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_RECORDING_SOURCE)); | 496 | lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_RECORDING_SOURCE)); |
472 | ptr = src_str[recording_source]; | 497 | ptr = src_str[global_settings.rec_source]; |
473 | lcd_getstringsize(ptr, &w, &h); | 498 | lcd_getstringsize(ptr, &w, &h); |
474 | lcd_putsxy(0, LCD_HEIGHT/2-h, ptr); | 499 | lcd_putsxy(0, LCD_HEIGHT/2-h, ptr); |
475 | lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], | 500 | lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], |
@@ -480,25 +505,25 @@ bool f3_rec_screen(void) | |||
480 | switch (button_get(true)) { | 505 | switch (button_get(true)) { |
481 | case BUTTON_LEFT: | 506 | case BUTTON_LEFT: |
482 | case BUTTON_F3 | BUTTON_LEFT: | 507 | case BUTTON_F3 | BUTTON_LEFT: |
483 | recording_source++; | 508 | global_settings.rec_source++; |
484 | if(recording_source > 2) | 509 | if(global_settings.rec_source > 2) |
485 | recording_source = 0; | 510 | global_settings.rec_source = 0; |
486 | used = true; | 511 | used = true; |
487 | break; | 512 | break; |
488 | 513 | ||
489 | case BUTTON_DOWN: | 514 | case BUTTON_DOWN: |
490 | case BUTTON_F3 | BUTTON_DOWN: | 515 | case BUTTON_F3 | BUTTON_DOWN: |
491 | recording_frequency++; | 516 | global_settings.rec_frequency++; |
492 | if(recording_frequency > 5) | 517 | if(global_settings.rec_frequency > 5) |
493 | recording_frequency = 0; | 518 | global_settings.rec_frequency = 0; |
494 | used = true; | 519 | used = true; |
495 | break; | 520 | break; |
496 | 521 | ||
497 | case BUTTON_RIGHT: | 522 | case BUTTON_RIGHT: |
498 | case BUTTON_F3 | BUTTON_RIGHT: | 523 | case BUTTON_F3 | BUTTON_RIGHT: |
499 | recording_channel_mode++; | 524 | global_settings.rec_channels++; |
500 | if(recording_channel_mode > 1) | 525 | if(global_settings.rec_channels > 1) |
501 | recording_channel_mode = 0; | 526 | global_settings.rec_channels = 0; |
502 | used = true; | 527 | used = true; |
503 | break; | 528 | break; |
504 | 529 | ||
@@ -518,10 +543,14 @@ bool f3_rec_screen(void) | |||
518 | } | 543 | } |
519 | } | 544 | } |
520 | 545 | ||
521 | mpeg_set_recording_options(recording_frequency, recording_quality, | 546 | mpeg_set_recording_options(global_settings.rec_frequency, |
522 | recording_source, recording_channel_mode); | 547 | global_settings.rec_quality, |
548 | global_settings.rec_source, | ||
549 | global_settings.rec_channels); | ||
523 | 550 | ||
524 | // settings_save(); | 551 | set_gain(); |
552 | |||
553 | settings_save(); | ||
525 | lcd_setfont(FONT_UI); | 554 | lcd_setfont(FONT_UI); |
526 | 555 | ||
527 | return false; | 556 | return false; |
diff --git a/apps/settings.c b/apps/settings.c index 417f0f324f..9ef224e069 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -99,12 +99,14 @@ offset abs | |||
99 | peak_meter_dbfs (bit 7) | 99 | peak_meter_dbfs (bit 7) |
100 | 0x1f 0x33 <peak meter min either in -db or in percent> | 100 | 0x1f 0x33 <peak meter min either in -db or in percent> |
101 | 0x20 0x34 <peak meter max either in -db or in percent> | 101 | 0x20 0x34 <peak meter max either in -db or in percent> |
102 | 0x21 0x35 <repeat mode> | 102 | 0x21 0x35 <repeat mode (bit 0-1), rec. channels (bit 2), |
103 | mic gain (bit 4-7)> | ||
104 | 0x22 0x36 <rec. quality (bit 0-2), source (bit 3-4), frequency (bit 5-7)> | ||
105 | 0x23 0x37 <rec. left gain (bit 0-3)> | ||
106 | 0x24 0x38 <rec. right gain (bit 0-3)> | ||
103 | 107 | ||
104 | <all unused space filled with 0xff> | ||
105 | 108 | ||
106 | the geeky but useless statistics part: | 109 | <all unused space filled with 0xff> |
107 | 0x24 <total uptime in seconds: 32 bits uint, actually unused for now> | ||
108 | 110 | ||
109 | 0x2a <checksum 2 bytes: xor of 0x0-0x29> | 111 | 0x2a <checksum 2 bytes: xor of 0x0-0x29> |
110 | 112 | ||
@@ -329,9 +331,16 @@ int settings_save( void ) | |||
329 | (global_settings.peak_meter_dbfs ? 0x80 : 0); | 331 | (global_settings.peak_meter_dbfs ? 0x80 : 0); |
330 | config_block[0x1f] = (unsigned char)global_settings.peak_meter_min; | 332 | config_block[0x1f] = (unsigned char)global_settings.peak_meter_min; |
331 | config_block[0x20] = (unsigned char)global_settings.peak_meter_max; | 333 | config_block[0x20] = (unsigned char)global_settings.peak_meter_max; |
332 | config_block[0x21] = (unsigned char)global_settings.repeat_mode; | 334 | config_block[0x21] = (unsigned char) |
333 | 335 | ((global_settings.repeat_mode & 3) | | |
334 | memcpy(&config_block[0x24], &global_settings.total_uptime, 4); | 336 | ((global_settings.rec_channels & 1) << 2) | |
337 | ((global_settings.rec_mic_gain & 0x0f) << 3)); | ||
338 | config_block[0x22] = (unsigned char) | ||
339 | ((global_settings.rec_quality & 7) | | ||
340 | ((global_settings.rec_source & 1) << 3) | | ||
341 | ((global_settings.rec_frequency & 7) << 5)); | ||
342 | config_block[0x23] = (unsigned char)global_settings.rec_left_gain; | ||
343 | config_block[0x24] = (unsigned char)global_settings.rec_right_gain; | ||
335 | 344 | ||
336 | strncpy(&config_block[0xb8], global_settings.wps_file, MAX_FILENAME); | 345 | strncpy(&config_block[0xb8], global_settings.wps_file, MAX_FILENAME); |
337 | strncpy(&config_block[0xcc], global_settings.lang_file, MAX_FILENAME); | 346 | strncpy(&config_block[0xcc], global_settings.lang_file, MAX_FILENAME); |
@@ -565,10 +574,24 @@ void settings_load(void) | |||
565 | global_settings.peak_meter_max = config_block[0x20]; | 574 | global_settings.peak_meter_max = config_block[0x20]; |
566 | 575 | ||
567 | if (config_block[0x21] != 0xFF) | 576 | if (config_block[0x21] != 0xFF) |
568 | global_settings.repeat_mode = config_block[0x21]; | 577 | { |
578 | global_settings.repeat_mode = config_block[0x21] & 3; | ||
579 | global_settings.rec_channels = (config_block[0x21] >> 2) & 1; | ||
580 | global_settings.rec_mic_gain = (config_block[0x21] >> 4) & 0x0f; | ||
581 | } | ||
582 | |||
583 | if (config_block[0x22] != 0xFF) | ||
584 | { | ||
585 | global_settings.rec_quality = config_block[0x22] & 7; | ||
586 | global_settings.rec_source = (config_block[0x22] >> 3) & 3; | ||
587 | global_settings.rec_frequency = (config_block[0x22] >> 5) & 7; | ||
588 | } | ||
589 | |||
590 | if (config_block[0x23] != 0xFF) | ||
591 | global_settings.rec_left_gain = config_block[0x23] & 0x0f; | ||
569 | 592 | ||
570 | if (config_block[0x24] != 0xFF) | 593 | if (config_block[0x24] != 0xFF) |
571 | memcpy(&global_settings.total_uptime, &config_block[0x24], 4); | 594 | global_settings.rec_right_gain = config_block[0x24] & 0x0f; |
572 | 595 | ||
573 | memcpy(&global_settings.resume_first_index, &config_block[0xF4], 4); | 596 | memcpy(&global_settings.resume_first_index, &config_block[0xF4], 4); |
574 | memcpy(&global_settings.resume_seed, &config_block[0xF8], 4); | 597 | memcpy(&global_settings.resume_seed, &config_block[0xF8], 4); |
@@ -731,6 +754,13 @@ void settings_reset(void) { | |||
731 | global_settings.bass_boost = mpeg_sound_default(SOUND_SUPERBASS); | 754 | global_settings.bass_boost = mpeg_sound_default(SOUND_SUPERBASS); |
732 | global_settings.avc = mpeg_sound_default(SOUND_AVC); | 755 | global_settings.avc = mpeg_sound_default(SOUND_AVC); |
733 | global_settings.channel_config = mpeg_sound_default(SOUND_CHANNELS); | 756 | global_settings.channel_config = mpeg_sound_default(SOUND_CHANNELS); |
757 | global_settings.rec_quality = 5; | ||
758 | global_settings.rec_source = 0; /* 0=mic */ | ||
759 | global_settings.rec_frequency = 0; /* 0=44.1kHz */ | ||
760 | global_settings.rec_channels = 0; /* 0=Stereo */ | ||
761 | global_settings.rec_mic_gain = 8; | ||
762 | global_settings.rec_left_gain = 2; /* 0dB */ | ||
763 | global_settings.rec_right_gain = 2; /* 0dB */ | ||
734 | global_settings.resume = RESUME_ASK; | 764 | global_settings.resume = RESUME_ASK; |
735 | global_settings.contrast = DEFAULT_CONTRAST_SETTING; | 765 | global_settings.contrast = DEFAULT_CONTRAST_SETTING; |
736 | global_settings.poweroff = DEFAULT_POWEROFF_SETTING; | 766 | global_settings.poweroff = DEFAULT_POWEROFF_SETTING; |
@@ -744,7 +774,6 @@ void settings_reset(void) { | |||
744 | global_settings.repeat_mode = REPEAT_ALL; | 774 | global_settings.repeat_mode = REPEAT_ALL; |
745 | global_settings.playlist_shuffle = false; | 775 | global_settings.playlist_shuffle = false; |
746 | global_settings.discharge = 0; | 776 | global_settings.discharge = 0; |
747 | global_settings.total_uptime = 0; | ||
748 | global_settings.timeformat = 0; | 777 | global_settings.timeformat = 0; |
749 | global_settings.volume_type = 0; | 778 | global_settings.volume_type = 0; |
750 | global_settings.battery_type = 0; | 779 | global_settings.battery_type = 0; |
diff --git a/apps/settings.h b/apps/settings.h index 655b2e0245..2622d314f7 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -61,12 +61,27 @@ struct user_settings | |||
61 | int bass_boost; /* bass boost 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 */ | 62 | int avc; /* auto volume correct: 0=disable, 1=2s 2=4s 3=8s */ |
63 | int channel_config; /* Stereo, Mono, Mono left, Mono right */ | 63 | int channel_config; /* Stereo, Mono, Mono left, Mono right */ |
64 | |||
65 | int rec_quality; /* 0-7 */ | ||
66 | int rec_source; /* 0=mic, 1=line, 2=S/PDIF */ | ||
67 | int rec_frequency; /* 0 = 44.1kHz | ||
68 | 1 = 48kHz | ||
69 | 2 = 32kHz | ||
70 | 3 = 22.05kHz | ||
71 | 4 = 24kHz | ||
72 | 5 = 16kHz */ | ||
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 */ | ||
64 | 77 | ||
65 | /* device settings */ | 78 | /* device settings */ |
66 | 79 | ||
67 | int contrast; /* lcd contrast: 0-100 0=low 100=high */ | 80 | int contrast; /* lcd contrast: 0-100 0=low 100=high */ |
68 | int poweroff; /* power off timer */ | 81 | int poweroff; /* power off timer */ |
69 | int backlight_timeout; /* backlight off timeout: 0-18 0=never,1=always,then according to timeout_values[] */ | 82 | int backlight_timeout; /* backlight off timeout: 0-18 0=never, |
83 | 1=always, | ||
84 | then according to timeout_values[] */ | ||
70 | bool backlight_on_when_charging; | 85 | bool backlight_on_when_charging; |
71 | bool discharge; /* maintain charge of at least: false = 90%, true = 10% */ | 86 | bool discharge; /* maintain charge of at least: false = 90%, true = 10% */ |
72 | 87 | ||
@@ -115,8 +130,6 @@ struct user_settings | |||
115 | bool browse_current; /* 1=goto current song, | 130 | bool browse_current; /* 1=goto current song, |
116 | 0=goto previous location */ | 131 | 0=goto previous location */ |
117 | 132 | ||
118 | /* geeky persistent statistics */ | ||
119 | unsigned int total_uptime; /* total uptime since rockbox was first booted */ | ||
120 | }; | 133 | }; |
121 | 134 | ||
122 | /* prototypes */ | 135 | /* prototypes */ |
diff --git a/apps/sound_menu.c b/apps/sound_menu.c index 2938e3a527..0f5421e221 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c | |||
@@ -183,7 +183,42 @@ static bool avc(void) | |||
183 | return set_option(str(LANG_DECAY), &global_settings.avc, | 183 | return set_option(str(LANG_DECAY), &global_settings.avc, |
184 | names, 4, set_avc); | 184 | names, 4, set_avc); |
185 | } | 185 | } |
186 | #endif /* ARCHOS_RECORDER */ | 186 | |
187 | static bool recsource(void) | ||
188 | { | ||
189 | char *names[] = {str(LANG_RECORDING_SRC_MIC), str(LANG_RECORDING_SRC_LINE), | ||
190 | str(LANG_RECORDING_SRC_DIGITAL) }; | ||
191 | return set_option(str(LANG_RECORDING_SOURCE), | ||
192 | &global_settings.rec_source, | ||
193 | names, 3, NULL ); | ||
194 | } | ||
195 | |||
196 | static bool recfrequency(void) | ||
197 | { | ||
198 | char *names[] = {"44.1kHz", "48kHz", "32kHz", | ||
199 | "22.05kHz", "24kHz", "16kHz"}; | ||
200 | |||
201 | return set_option(str(LANG_RECORDING_FREQUENCY), | ||
202 | &global_settings.rec_frequency, | ||
203 | names, 6, NULL ); | ||
204 | } | ||
205 | |||
206 | static bool recchannels(void) | ||
207 | { | ||
208 | char *names[] = {str(LANG_CHANNEL_STEREO), str(LANG_CHANNEL_MONO)}; | ||
209 | |||
210 | return set_option(str(LANG_RECORDING_CHANNELS), | ||
211 | &global_settings.rec_channels, | ||
212 | names, 2, NULL ); | ||
213 | } | ||
214 | |||
215 | static bool recquality(void) | ||
216 | { | ||
217 | return set_int(str(LANG_RECORDING_QUALITY), "", | ||
218 | &global_settings.rec_quality, | ||
219 | NULL, 1, 0, 7 ); | ||
220 | } | ||
221 | #endif /* HAVE_MAS3587F */ | ||
187 | 222 | ||
188 | static void set_chanconf(int val) | 223 | static void set_chanconf(int val) |
189 | { | 224 | { |
@@ -221,3 +256,23 @@ bool sound_menu(void) | |||
221 | 256 | ||
222 | return result; | 257 | return result; |
223 | } | 258 | } |
259 | |||
260 | #ifdef HAVE_MAS3587F | ||
261 | bool recording_menu(void) | ||
262 | { | ||
263 | int m; | ||
264 | bool result; | ||
265 | struct menu_items items[] = { | ||
266 | { str(LANG_RECORDING_QUALITY), recquality }, | ||
267 | { str(LANG_RECORDING_FREQUENCY), recfrequency }, | ||
268 | { str(LANG_RECORDING_SOURCE), recsource }, | ||
269 | { str(LANG_RECORDING_CHANNELS), recchannels }, | ||
270 | }; | ||
271 | |||
272 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); | ||
273 | result = menu_run(m); | ||
274 | menu_exit(m); | ||
275 | |||
276 | return result; | ||
277 | } | ||
278 | #endif | ||
diff --git a/apps/sound_menu.h b/apps/sound_menu.h index 5063a288d9..8c1f4db089 100644 --- a/apps/sound_menu.h +++ b/apps/sound_menu.h | |||
@@ -22,5 +22,6 @@ | |||
22 | #include "menu.h" | 22 | #include "menu.h" |
23 | 23 | ||
24 | bool sound_menu(void); | 24 | bool sound_menu(void); |
25 | bool recording_menu(void); | ||
25 | 26 | ||
26 | #endif | 27 | #endif |