summaryrefslogtreecommitdiff
path: root/apps/settings.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-11-10 23:18:33 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-11-10 23:18:33 +0000
commitafe0da9e1677c5164291150286531ccd46ebef10 (patch)
treedc4299188d85bb2ea7babd08b57813b4df03ba8b /apps/settings.c
parent8e4a0e0aabc9c35cc6b9bc9506e629dabf291031 (diff)
downloadrockbox-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/settings.c')
-rw-r--r--apps/settings.c49
1 files changed, 39 insertions, 10 deletions
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)
1000x1f 0x33 <peak meter min either in -db or in percent> 1000x1f 0x33 <peak meter min either in -db or in percent>
1010x20 0x34 <peak meter max either in -db or in percent> 1010x20 0x34 <peak meter max either in -db or in percent>
1020x21 0x35 <repeat mode> 1020x21 0x35 <repeat mode (bit 0-1), rec. channels (bit 2),
103 mic gain (bit 4-7)>
1040x22 0x36 <rec. quality (bit 0-2), source (bit 3-4), frequency (bit 5-7)>
1050x23 0x37 <rec. left gain (bit 0-3)>
1060x24 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>
1070x24 <total uptime in seconds: 32 bits uint, actually unused for now>
108 110
1090x2a <checksum 2 bytes: xor of 0x0-0x29> 1110x2a <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;