diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-07-11 05:41:23 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-07-11 05:41:23 +0000 |
commit | a5278fa3db2582c49d04507b31bd08405df5adb7 (patch) | |
tree | 853ffc4e0967b37b808320f99260e56e3ecdfdd4 /apps/recorder | |
parent | 50dc0cabe3bfa3aeee1cba40d1e31c69a073227f (diff) | |
download | rockbox-a5278fa3db2582c49d04507b31bd08405df5adb7.tar.gz rockbox-a5278fa3db2582c49d04507b31bd08405df5adb7.zip |
Rearrange and cleanup settings code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13851 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/recording.c | 79 | ||||
-rw-r--r-- | apps/recorder/recording.h | 1 |
2 files changed, 80 insertions, 0 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index a085bbbc03..30e3c315c8 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -69,7 +69,86 @@ | |||
69 | #include "action.h" | 69 | #include "action.h" |
70 | #include "radio.h" | 70 | #include "radio.h" |
71 | #ifdef HAVE_RECORDING | 71 | #ifdef HAVE_RECORDING |
72 | /* This array holds the record timer interval lengths, in seconds */ | ||
73 | static const unsigned long rec_timer_seconds[] = | ||
74 | { | ||
75 | 0, /* 0 means OFF */ | ||
76 | 5*60, /* 00:05 */ | ||
77 | 10*60, /* 00:10 */ | ||
78 | 15*60, /* 00:15 */ | ||
79 | 30*60, /* 00:30 */ | ||
80 | 60*60, /* 01:00 */ | ||
81 | 74*60, /* 74:00 */ | ||
82 | 80*60, /* 80:00 */ | ||
83 | 2*60*60, /* 02:00 */ | ||
84 | 4*60*60, /* 04:00 */ | ||
85 | 6*60*60, /* 06:00 */ | ||
86 | 8*60*60, /* 08:00 */ | ||
87 | 10L*60*60, /* 10:00 */ | ||
88 | 12L*60*60, /* 12:00 */ | ||
89 | 18L*60*60, /* 18:00 */ | ||
90 | 24L*60*60 /* 24:00 */ | ||
91 | }; | ||
92 | |||
93 | static unsigned int rec_timesplit_seconds(void) | ||
94 | { | ||
95 | return rec_timer_seconds[global_settings.rec_timesplit]; | ||
96 | } | ||
97 | |||
98 | /* This array holds the record size interval lengths, in bytes */ | ||
99 | static const unsigned long rec_size_bytes[] = | ||
100 | { | ||
101 | 0, /* 0 means OFF */ | ||
102 | 5*1024*1024, /* 5MB */ | ||
103 | 10*1024*1024, /* 10MB */ | ||
104 | 15*1024*1024, /* 15MB */ | ||
105 | 32*1024*1024, /* 32MB */ | ||
106 | 64*1024*1024, /* 64MB */ | ||
107 | 75*1024*1024, /* 75MB */ | ||
108 | 100*1024*1024, /* 100MB */ | ||
109 | 128*1024*1024, /* 128MB */ | ||
110 | 256*1024*1024, /* 256MB */ | ||
111 | 512*1024*1024, /* 512MB */ | ||
112 | 650*1024*1024, /* 650MB */ | ||
113 | 700*1024*1024, /* 700MB */ | ||
114 | 1024*1024*1024, /* 1GB */ | ||
115 | 1536*1024*1024, /* 1.5GB */ | ||
116 | 1792*1024*1024, /* 1.75GB */ | ||
117 | }; | ||
118 | |||
119 | static unsigned long rec_sizesplit_bytes(void) | ||
120 | { | ||
121 | return rec_size_bytes[global_settings.rec_sizesplit]; | ||
122 | } | ||
123 | /* | ||
124 | * Time strings used for the trigger durations. | ||
125 | * Keep synchronous to trigger_times in settings_apply_trigger | ||
126 | */ | ||
127 | const char * const trig_durations[TRIG_DURATION_COUNT] = | ||
128 | { | ||
129 | "0s", "1s", "2s", "5s", | ||
130 | "10s", "15s", "20s", "25s", "30s", | ||
131 | "1min", "2min", "5min", "10min" | ||
132 | }; | ||
72 | 133 | ||
134 | void settings_apply_trigger(void) | ||
135 | { | ||
136 | /* Keep synchronous to trig_durations and trig_durations_conf*/ | ||
137 | static const long trigger_times[TRIG_DURATION_COUNT] = { | ||
138 | 0, HZ, 2*HZ, 5*HZ, | ||
139 | 10*HZ, 15*HZ, 20*HZ, 25*HZ, 30*HZ, | ||
140 | 60*HZ, 2*60*HZ, 5*60*HZ, 10*60*HZ | ||
141 | }; | ||
142 | |||
143 | peak_meter_define_trigger( | ||
144 | global_settings.rec_start_thres, | ||
145 | trigger_times[global_settings.rec_start_duration], | ||
146 | MIN(trigger_times[global_settings.rec_start_duration] / 2, 2*HZ), | ||
147 | global_settings.rec_stop_thres, | ||
148 | trigger_times[global_settings.rec_stop_postrec], | ||
149 | trigger_times[global_settings.rec_stop_gap] | ||
150 | ); | ||
151 | } | ||
73 | /* recording screen status flags */ | 152 | /* recording screen status flags */ |
74 | enum rec_status_flags | 153 | enum rec_status_flags |
75 | { | 154 | { |
diff --git a/apps/recorder/recording.h b/apps/recorder/recording.h index 50a73856cf..2c3869a4fb 100644 --- a/apps/recorder/recording.h +++ b/apps/recorder/recording.h | |||
@@ -24,6 +24,7 @@ bool in_recording_screen(void); | |||
24 | bool recording_screen(bool no_source); | 24 | bool recording_screen(bool no_source); |
25 | char *rec_create_filename(char *buf); | 25 | char *rec_create_filename(char *buf); |
26 | int rec_create_directory(void); | 26 | int rec_create_directory(void); |
27 | void settings_apply_trigger(void); | ||
27 | 28 | ||
28 | /* If true, start recording automatically when recording_sreen() is entered */ | 29 | /* If true, start recording automatically when recording_sreen() is entered */ |
29 | extern bool recording_start_automatic; | 30 | extern bool recording_start_automatic; |