summaryrefslogtreecommitdiff
path: root/apps/recorder
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-11-19 21:07:44 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-11-19 21:07:44 +0000
commitd703389780f5c7a627bff3f6daf6d72e4547a9db (patch)
treefc7920b35b0219827c01d341eeea8d58244e0962 /apps/recorder
parent11055c04712a83000064888b253681e0d928b701 (diff)
downloadrockbox-d703389780f5c7a627bff3f6daf6d72e4547a9db.tar.gz
rockbox-d703389780f5c7a627bff3f6daf6d72e4547a9db.zip
More recording stability, plus some feedback
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2860 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder')
-rw-r--r--apps/recorder/recording.c50
1 files changed, 43 insertions, 7 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 50d5982a62..491907666f 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -25,6 +25,7 @@
25#include "system.h" 25#include "system.h"
26#include "lcd.h" 26#include "lcd.h"
27#include "mpeg.h" 27#include "mpeg.h"
28#include "mas.h"
28#include "button.h" 29#include "button.h"
29#include "kernel.h" 30#include "kernel.h"
30#include "settings.h" 31#include "settings.h"
@@ -116,6 +117,18 @@ void adjust_cursor(void)
116 } 117 }
117} 118}
118 119
120#define BLINK_INTERVAL 2
121
122unsigned int frame_times[] =
123{
124 2400, /* 48kHz */
125 2612, /* 44.1kHz */
126 3600, /* 32kHz */
127 2400, /* 24kHz */
128 2612, /* 22.05kHz */
129 3200 /* 16kHz */
130};
131
119bool recording_screen(void) 132bool recording_screen(void)
120{ 133{
121 int button; 134 int button;
@@ -127,6 +140,10 @@ bool recording_screen(void)
127 int w, h; 140 int w, h;
128 int update_countdown = 1; 141 int update_countdown = 1;
129 bool have_recorded = false; 142 bool have_recorded = false;
143 bool blink_toggle = false;
144 unsigned long seconds;
145 unsigned long last_seconds = 0;
146 int hours, minutes;
130 147
131 cursor = 0; 148 cursor = 0;
132 mpeg_stop(); 149 mpeg_stop();
@@ -176,6 +193,7 @@ bool recording_screen(void)
176 mpeg_record(""); 193 mpeg_record("");
177 status_set_playmode(STATUS_RECORD); 194 status_set_playmode(STATUS_RECORD);
178 update_countdown = 1; /* Update immediately */ 195 update_countdown = 1; /* Update immediately */
196 last_seconds = 0;
179 } 197 }
180 break; 198 break;
181 199
@@ -306,13 +324,31 @@ bool recording_screen(void)
306 { 324 {
307 timeout = current_tick + HZ/10; 325 timeout = current_tick + HZ/10;
308 326
327 seconds = mpeg_num_recorded_frames();
328 seconds *= frame_times[global_settings.rec_frequency];
329 seconds /= 100000;
330
309 update_countdown--; 331 update_countdown--;
310 if(update_countdown == 0) 332 if(update_countdown == 0 || seconds > last_seconds)
311 { 333 {
312 update_countdown = 10; 334 update_countdown = 5;
313 335 last_seconds = seconds;
336
314 lcd_clear_display(); 337 lcd_clear_display();
315 peak_meter_draw(0, 8 + h, LCD_WIDTH, h); 338
339 if(mpeg_status() & MPEG_STATUS_RECORD)
340 {
341 blink_toggle = blink_toggle?false:true;
342 if(blink_toggle)
343 lcd_puts(0, 0, "Recording");
344 }
345
346 hours = seconds / 3600;
347 minutes = (seconds - (hours * 3600)) / 60;
348 snprintf(buf, 32, "%02d:%02d:%02d",
349 hours, minutes, seconds%60);
350 lcd_puts(0, 1, buf);
351 peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h);
316 352
317 /* Show mic gain if input source is Mic */ 353 /* Show mic gain if input source is Mic */
318 if(global_settings.rec_source == 0) 354 if(global_settings.rec_source == 0)
@@ -363,9 +399,9 @@ bool recording_screen(void)
363 } 399 }
364 else 400 else
365 { 401 {
366 lcd_clearrect(0, 8 + h, LCD_WIDTH, h); 402 lcd_clearrect(0, 8 + h*2, LCD_WIDTH, h);
367 peak_meter_draw(0, 8 + h, LCD_WIDTH, h); 403 peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h);
368 lcd_update_rect(0, 8 + h, LCD_WIDTH, h); 404 lcd_update_rect(0, 8 + h*2, LCD_WIDTH, h);
369 } 405 }
370 lcd_update(); 406 lcd_update();
371 } 407 }