summaryrefslogtreecommitdiff
path: root/apps/recorder/recording.c
diff options
context:
space:
mode:
authorDan Everton <dan@iocaine.org>2006-03-25 13:35:31 +0000
committerDan Everton <dan@iocaine.org>2006-03-25 13:35:31 +0000
commitb66477adccfd08987e409182e15bb17e70283fae (patch)
tree46861838424afed2c2d7a6e41d429064d08f0e45 /apps/recorder/recording.c
parent2b71fa855d57c1dcd19411882d545002603a9dc3 (diff)
downloadrockbox-b66477adccfd08987e409182e15bb17e70283fae.tar.gz
rockbox-b66477adccfd08987e409182e15bb17e70283fae.zip
Support the recording screen on the LCD remote. Also adds support for the peakmeter in the rremote WPS. Patch from Martin Scarratt (task 4818).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9246 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder/recording.c')
-rw-r--r--apps/recorder/recording.c173
1 files changed, 129 insertions, 44 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 92275a580e..84fef9f3a1 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -43,6 +43,7 @@
43#include "lang.h" 43#include "lang.h"
44#include "font.h" 44#include "font.h"
45#include "icons.h" 45#include "icons.h"
46#include "icon.h"
46#include "screens.h" 47#include "screens.h"
47#include "peakmeter.h" 48#include "peakmeter.h"
48#include "statusbar.h" 49#include "statusbar.h"
@@ -60,6 +61,7 @@
60#include "sound.h" 61#include "sound.h"
61#include "ata.h" 62#include "ata.h"
62#include "splash.h" 63#include "splash.h"
64#include "screen_access.h"
63#ifdef HAVE_RECORDING 65#ifdef HAVE_RECORDING
64 66
65 67
@@ -104,6 +106,17 @@
104#define REC_DEC BUTTON_LEFT 106#define REC_DEC BUTTON_LEFT
105#endif 107#endif
106 108
109#if (CONFIG_REMOTE_KEYPAD == H100_REMOTE) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
110#define REC_RC_SHUTDOWN (BUTTON_RC_STOP | BUTTON_REPEAT)
111#define REC_RC_STOPEXIT BUTTON_RC_STOP
112#define REC_RC_RECPAUSE BUTTON_RC_ON
113#define REC_RC_INC BUTTON_RC_BITRATE
114#define REC_RC_DEC BUTTON_RC_SOURCE
115#define REC_RC_NEXT BUTTON_RC_FF
116#define REC_RC_PREV BUTTON_RC_REW
117#define REC_RC_SETTINGS BUTTON_RC_MODE
118#endif
119
107bool f2_rec_screen(void); 120bool f2_rec_screen(void);
108bool f3_rec_screen(void); 121bool f3_rec_screen(void);
109 122
@@ -508,6 +521,7 @@ bool recording_screen(void)
508 bool led_state = false; 521 bool led_state = false;
509 int led_countdown = 2; 522 int led_countdown = 2;
510#endif 523#endif
524 int i;
511 525
512#ifdef HAVE_UDA1380 526#ifdef HAVE_UDA1380
513/*calculate no. of digital steps to each analogue step. Assuming 527/*calculate no. of digital steps to each analogue step. Assuming
@@ -565,10 +579,13 @@ bool recording_screen(void)
565 579
566 settings_apply_trigger(); 580 settings_apply_trigger();
567 581
568 lcd_setfont(FONT_SYSFIXED); 582 FOR_NB_SCREENS(i)
569 lcd_getstringsize("M", &w, &h); 583 {
570 lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8); 584 screens[i].setfont(FONT_SYSFIXED);
571 585 screens[i].getstringsize("M", &w, &h);
586 screens[i].setmargins(global_settings.invert_cursor ? 0 : w, 8);
587 }
588
572 if(rec_create_directory() > 0) 589 if(rec_create_directory() > 0)
573 have_recorded = true; 590 have_recorded = true;
574 591
@@ -628,7 +645,7 @@ bool recording_screen(void)
628#endif /* CONFIG_LED */ 645#endif /* CONFIG_LED */
629 646
630 /* Wait for a button a while (HZ/10) drawing the peak meter */ 647 /* Wait for a button a while (HZ/10) drawing the peak meter */
631 button = peak_meter_draw_get_btn(0, 8 + h*2, LCD_WIDTH, h); 648 button = peak_meter_draw_get_btn(0, 8 + h*2, h*2);
632 649
633 if (last_audio_stat != audio_stat) 650 if (last_audio_stat != audio_stat)
634 { 651 {
@@ -643,6 +660,12 @@ bool recording_screen(void)
643 { 660 {
644 case REC_STOPEXIT: 661 case REC_STOPEXIT:
645 case REC_SHUTDOWN: 662 case REC_SHUTDOWN:
663#ifdef REC_RC_STOPEXIT
664 case REC_RC_STOPEXIT:
665#endif
666#ifdef REC_RC_SHUTDOWN
667 case REC_RC_SHUTDOWN:
668#endif
646 /* turn off the trigger */ 669 /* turn off the trigger */
647 peak_meter_trigger(false); 670 peak_meter_trigger(false);
648 peak_meter_set_trigger_listener(NULL); 671 peak_meter_set_trigger_listener(NULL);
@@ -663,6 +686,9 @@ bool recording_screen(void)
663 break; 686 break;
664 687
665 case REC_RECPAUSE: 688 case REC_RECPAUSE:
689#ifdef REC_RC_RECPAUSE
690 case REC_RC_RECPAUSE:
691#endif
666#ifdef REC_RECPAUSE_PRE 692#ifdef REC_RECPAUSE_PRE
667 if (lastbutton != REC_RECPAUSE_PRE) 693 if (lastbutton != REC_RECPAUSE_PRE)
668 break; 694 break;
@@ -715,6 +741,9 @@ bool recording_screen(void)
715 741
716#ifdef REC_PREV 742#ifdef REC_PREV
717 case REC_PREV: 743 case REC_PREV:
744#ifdef REC_RC_PREV
745 case REC_RC_PREV:
746#endif
718 cursor--; 747 cursor--;
719 adjust_cursor(); 748 adjust_cursor();
720 update_countdown = 1; /* Update immediately */ 749 update_countdown = 1; /* Update immediately */
@@ -723,6 +752,9 @@ bool recording_screen(void)
723 752
724#ifdef REC_NEXT 753#ifdef REC_NEXT
725 case REC_NEXT: 754 case REC_NEXT:
755#ifdef REC_RC_NEXT
756 case REC_RC_NEXT:
757#endif
726 cursor++; 758 cursor++;
727 adjust_cursor(); 759 adjust_cursor();
728 update_countdown = 1; /* Update immediately */ 760 update_countdown = 1; /* Update immediately */
@@ -731,6 +763,10 @@ bool recording_screen(void)
731 763
732 case REC_INC: 764 case REC_INC:
733 case REC_INC | BUTTON_REPEAT: 765 case REC_INC | BUTTON_REPEAT:
766#ifdef REC_RC_INC
767 case REC_RC_INC:
768 case REC_RC_INC | BUTTON_REPEAT:
769#endif
734 switch(cursor) 770 switch(cursor)
735 { 771 {
736 case 0: 772 case 0:
@@ -788,6 +824,10 @@ bool recording_screen(void)
788 824
789 case REC_DEC: 825 case REC_DEC:
790 case REC_DEC | BUTTON_REPEAT: 826 case REC_DEC | BUTTON_REPEAT:
827#ifdef REC_RC_INC
828 case REC_RC_DEC:
829 case REC_RC_DEC | BUTTON_REPEAT:
830#endif
791 switch(cursor) 831 switch(cursor)
792 { 832 {
793 case 0: 833 case 0:
@@ -848,6 +888,9 @@ bool recording_screen(void)
848 888
849#ifdef REC_SETTINGS 889#ifdef REC_SETTINGS
850 case REC_SETTINGS: 890 case REC_SETTINGS:
891#ifdef REC_RC_SETTINGS
892 case REC_RC_SETTINGS:
893#endif
851 if(audio_stat != AUDIO_STATUS_RECORD) 894 if(audio_stat != AUDIO_STATUS_RECORD)
852 { 895 {
853#if CONFIG_LED == LED_REAL 896#if CONFIG_LED == LED_REAL
@@ -874,8 +917,11 @@ bool recording_screen(void)
874 set_gain(); 917 set_gain();
875 update_countdown = 1; /* Update immediately */ 918 update_countdown = 1; /* Update immediately */
876 919
877 lcd_setfont(FONT_SYSFIXED); 920 FOR_NB_SCREENS(i)
878 lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8); 921 {
922 screens[i].setfont(FONT_SYSFIXED);
923 screens[i].setmargins(global_settings.invert_cursor ? 0 : w, 8);
924 }
879 } 925 }
880 break; 926 break;
881#endif 927#endif
@@ -943,7 +989,8 @@ bool recording_screen(void)
943 if (button != BUTTON_NONE) 989 if (button != BUTTON_NONE)
944 lastbutton = button; 990 lastbutton = button;
945 991
946 lcd_setfont(FONT_SYSFIXED); 992 FOR_NB_SCREENS(i)
993 screens[i].setfont(FONT_SYSFIXED);
947 994
948 seconds = audio_recorded_time() / HZ; 995 seconds = audio_recorded_time() / HZ;
949 996
@@ -957,14 +1004,16 @@ bool recording_screen(void)
957 update_countdown = 5; 1004 update_countdown = 5;
958 last_seconds = seconds; 1005 last_seconds = seconds;
959 1006
960 lcd_clear_display(); 1007 FOR_NB_SCREENS(i)
1008 screens[i].clear_display();
961 1009
962 hours = seconds / 3600; 1010 hours = seconds / 3600;
963 minutes = (seconds - (hours * 3600)) / 60; 1011 minutes = (seconds - (hours * 3600)) / 60;
964 snprintf(buf, 32, "%s %02d:%02d:%02d", 1012 snprintf(buf, 32, "%s %02d:%02d:%02d",
965 str(LANG_RECORDING_TIME), 1013 str(LANG_RECORDING_TIME),
966 hours, minutes, seconds%60); 1014 hours, minutes, seconds%60);
967 lcd_puts(0, 0, buf); 1015 FOR_NB_SCREENS(i)
1016 screens[i].puts(0, 0, buf);
968 1017
969 dseconds = rec_timesplit_seconds(); 1018 dseconds = rec_timesplit_seconds();
970 num_recorded_bytes = audio_num_recorded_bytes(); 1019 num_recorded_bytes = audio_num_recorded_bytes();
@@ -997,7 +1046,8 @@ bool recording_screen(void)
997 str(LANG_RECORDING_SIZE), buf2); 1046 str(LANG_RECORDING_SIZE), buf2);
998 } 1047 }
999 } 1048 }
1000 lcd_puts(0, 1, buf); 1049 FOR_NB_SCREENS(i)
1050 screens[i].puts(0, 1, buf);
1001 1051
1002 /* We will do file splitting regardless, either at the end of 1052 /* We will do file splitting regardless, either at the end of
1003 a split interval, or when the filesize approaches the 2GB 1053 a split interval, or when the filesize approaches the 2GB
@@ -1017,10 +1067,15 @@ bool recording_screen(void)
1017 buf2, sizeof(buf2))); 1067 buf2, sizeof(buf2)));
1018 1068
1019 if (global_settings.invert_cursor && (pos++ == cursor)) 1069 if (global_settings.invert_cursor && (pos++ == cursor))
1020 lcd_puts_style(0, 3, buf, STYLE_INVERT); 1070 {
1071 FOR_NB_SCREENS(i)
1072 screens[i].puts_style_offset(0, 4, buf, STYLE_INVERT,0);
1073 }
1021 else 1074 else
1022 lcd_puts(0, 3, buf); 1075 {
1023 1076 FOR_NB_SCREENS(i)
1077 screens[i].puts(0, 4, buf);
1078 }
1024 1079
1025 if(global_settings.rec_source == SOURCE_MIC) 1080 if(global_settings.rec_source == SOURCE_MIC)
1026 { 1081 {
@@ -1059,9 +1114,15 @@ bool recording_screen(void)
1059 buf2, sizeof(buf2))); 1114 buf2, sizeof(buf2)));
1060#endif 1115#endif
1061 if(global_settings.invert_cursor && ((1==cursor)||(2==cursor))) 1116 if(global_settings.invert_cursor && ((1==cursor)||(2==cursor)))
1062 lcd_puts_style(0, 4, buf, STYLE_INVERT); 1117 {
1118 FOR_NB_SCREENS(i)
1119 screens[i].puts_style_offset(0, 5, buf, STYLE_INVERT,0);
1120 }
1063 else 1121 else
1064 lcd_puts(0, 4, buf); 1122 {
1123 FOR_NB_SCREENS(i)
1124 screens[i].puts(0, 5, buf);
1125 }
1065 } 1126 }
1066 else if(global_settings.rec_source == SOURCE_LINE) 1127 else if(global_settings.rec_source == SOURCE_LINE)
1067 { 1128 {
@@ -1104,9 +1165,16 @@ bool recording_screen(void)
1104 buf2, sizeof(buf2))); 1165 buf2, sizeof(buf2)));
1105#endif /* HAVE_UDA1380 */ 1166#endif /* HAVE_UDA1380 */
1106 if(global_settings.invert_cursor && ((1==cursor)||(2==cursor))) 1167 if(global_settings.invert_cursor && ((1==cursor)||(2==cursor)))
1107 lcd_puts_style(0, 4, buf, STYLE_INVERT); 1168 {
1169 FOR_NB_SCREENS(i)
1170 screens[i].puts_style_offset(0, 5, buf, STYLE_INVERT,0);
1171 }
1108 else 1172 else
1109 lcd_puts(0, 4, buf); 1173 {
1174 FOR_NB_SCREENS(i)
1175 screens[i].puts(0, 5, buf);
1176 }
1177
1110#ifdef HAVE_UDA1380 1178#ifdef HAVE_UDA1380
1111 snprintf(buf, 32, "%s:%s (%s)", 1179 snprintf(buf, 32, "%s:%s (%s)",
1112 str(LANG_RECORDING_RIGHT), 1180 str(LANG_RECORDING_RIGHT),
@@ -1134,39 +1202,59 @@ bool recording_screen(void)
1134 buf2, sizeof(buf2))); 1202 buf2, sizeof(buf2)));
1135#endif /* HAVE_UDA1380 */ 1203#endif /* HAVE_UDA1380 */
1136 if(global_settings.invert_cursor && ((1==cursor)||(3==cursor))) 1204 if(global_settings.invert_cursor && ((1==cursor)||(3==cursor)))
1137 lcd_puts_style(0, 5, buf, STYLE_INVERT); 1205 {
1206 FOR_NB_SCREENS(i)
1207 screens[i].puts_style_offset(0, 6, buf, STYLE_INVERT,0);
1208 }
1138 else 1209 else
1139 lcd_puts(0, 5, buf); 1210 {
1140 } 1211 FOR_NB_SCREENS(i)
1141 switch(cursor) 1212 screens[i].puts(0, 6, buf);
1142 { 1213 }
1143 case 1:
1144 put_cursorxy(0, 4, true);
1145
1146 if(global_settings.rec_source != SOURCE_MIC)
1147 put_cursorxy(0, 5, true);
1148
1149 break;
1150 case 2:
1151 put_cursorxy(0, 4, true);
1152 break;
1153 case 3:
1154 put_cursorxy(0, 5, true);
1155 break;
1156 default:
1157 put_cursorxy(0, 0, true);
1158 } 1214 }
1159 1215
1216 if(!global_settings.invert_cursor){
1217 switch(cursor)
1218 {
1219 case 1:
1220 FOR_NB_SCREENS(i)
1221 screen_put_cursorxy(&screens[i], 0, 5, true);
1222
1223 if(global_settings.rec_source != SOURCE_MIC)
1224 {
1225 FOR_NB_SCREENS(i)
1226 screen_put_cursorxy(&screens[i], 0, 6, true);
1227 }
1228 break;
1229 case 2:
1230 FOR_NB_SCREENS(i)
1231 screen_put_cursorxy(&screens[i], 0, 5, true);
1232 break;
1233 case 3:
1234 FOR_NB_SCREENS(i)
1235 screen_put_cursorxy(&screens[i], 0, 6, true);
1236 break;
1237 default:
1238 FOR_NB_SCREENS(i)
1239 screen_put_cursorxy(&screens[i], 0, 4, true);
1240 }
1241 }
1242
1160 snprintf(buf, 32, "%s %s", 1243 snprintf(buf, 32, "%s %s",
1161 freq_str[global_settings.rec_frequency], 1244 freq_str[global_settings.rec_frequency],
1162 global_settings.rec_channels? 1245 global_settings.rec_channels?
1163 str(LANG_CHANNEL_MONO):str(LANG_CHANNEL_STEREO)); 1246 str(LANG_CHANNEL_MONO):str(LANG_CHANNEL_STEREO));
1164 lcd_puts(0, 7, buf); 1247
1248 /* Main screen only for this info */
1249 lcd_puts(0, 8, buf);
1165 1250
1166 gui_syncstatusbar_draw(&statusbars, true); 1251 gui_syncstatusbar_draw(&statusbars, true);
1167 peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h);
1168 1252
1169 lcd_update(); 1253 FOR_NB_SCREENS(i)
1254 {
1255 peak_meter_screen(&screens[i], 0, 8 + h*2, h*2);
1256 screens[i].update();
1257 }
1170 1258
1171 /* draw the trigger status */ 1259 /* draw the trigger status */
1172 if (peak_meter_trigger_status() != TRIG_OFF) 1260 if (peak_meter_trigger_status() != TRIG_OFF)
@@ -1227,9 +1315,6 @@ bool recording_screen(void)
1227 ata_set_led_enabled(true); 1315 ata_set_led_enabled(true);
1228#endif 1316#endif
1229 return been_in_usb_mode; 1317 return been_in_usb_mode;
1230/*
1231#endif
1232*/
1233} 1318}
1234 1319
1235#ifdef REC_F2 1320#ifdef REC_F2