summaryrefslogtreecommitdiff
path: root/apps/recorder/recording.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder/recording.c')
-rw-r--r--apps/recorder/recording.c166
1 files changed, 18 insertions, 148 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 0d4f12742f..e6b06d56dc 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -65,75 +65,9 @@
65#include "ata.h" 65#include "ata.h"
66#include "splash.h" 66#include "splash.h"
67#include "screen_access.h" 67#include "screen_access.h"
68#include "action.h"
68#ifdef HAVE_RECORDING 69#ifdef HAVE_RECORDING
69 70
70
71#if CONFIG_KEYPAD == RECORDER_PAD
72#define REC_SHUTDOWN (BUTTON_OFF | BUTTON_REPEAT)
73#define REC_STOPEXIT BUTTON_OFF
74#define REC_RECPAUSE BUTTON_PLAY
75#define REC_INC BUTTON_RIGHT
76#define REC_DEC BUTTON_LEFT
77#define REC_NEXT BUTTON_DOWN
78#define REC_PREV BUTTON_UP
79#define REC_SETTINGS BUTTON_F1
80#define REC_F2 BUTTON_F2
81#define REC_F3 BUTTON_F3
82
83#elif CONFIG_KEYPAD == ONDIO_PAD /* only limited features */
84#define REC_SHUTDOWN (BUTTON_OFF | BUTTON_REPEAT)
85#define REC_STOPEXIT BUTTON_OFF
86#define REC_RECPAUSE_PRE BUTTON_MENU
87#define REC_RECPAUSE (BUTTON_MENU | BUTTON_REL)
88#define REC_INC BUTTON_RIGHT
89#define REC_DEC BUTTON_LEFT
90#define REC_NEXT BUTTON_DOWN
91#define REC_PREV BUTTON_UP
92#define REC_SETTINGS (BUTTON_MENU | BUTTON_REPEAT)
93
94#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
95#define REC_SHUTDOWN (BUTTON_OFF | BUTTON_REPEAT)
96#define REC_STOPEXIT BUTTON_OFF
97#define REC_RECPAUSE BUTTON_ON
98#define REC_NEWFILE BUTTON_REC
99#define REC_INC BUTTON_RIGHT
100#define REC_DEC BUTTON_LEFT
101#define REC_NEXT BUTTON_DOWN
102#define REC_PREV BUTTON_UP
103#define REC_SETTINGS BUTTON_MODE
104
105#define REC_RC_SHUTDOWN (BUTTON_RC_STOP | BUTTON_REPEAT)
106#define REC_RC_STOPEXIT BUTTON_RC_STOP
107#define REC_RC_RECPAUSE BUTTON_RC_ON
108#define REC_RC_NEWFILE BUTTON_RC_REC
109#define REC_RC_INC BUTTON_RC_BITRATE
110#define REC_RC_DEC BUTTON_RC_SOURCE
111#define REC_RC_NEXT BUTTON_RC_FF
112#define REC_RC_PREV BUTTON_RC_REW
113#define REC_RC_SETTINGS BUTTON_RC_MODE
114#define BUTTON_RC_DISPLAY BUTTON_RC_VOL_DOWN
115
116#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD)
117#define REC_SHUTDOWN (BUTTON_POWER | BUTTON_REPEAT)
118#define REC_STOPEXIT (BUTTON_PLAY | BUTTON_REPEAT)
119#define REC_RECPAUSE_PRE BUTTON_PLAY
120#define REC_RECPAUSE (BUTTON_PLAY | BUTTON_REL)
121#define REC_INC BUTTON_RIGHT
122#define REC_DEC BUTTON_LEFT
123#define REC_NEXT BUTTON_DOWN
124#define REC_PREV BUTTON_UP
125#define REC_NEWFILE_PRE BUTTON_REC
126#define REC_SETTINGS (BUTTON_REC | BUTTON_REPEAT)
127#define REC_NEWFILE (BUTTON_REC | BUTTON_REL)
128
129#elif CONFIG_KEYPAD == GMINI100_PAD
130#define REC_SHUTDOWN (BUTTON_OFF | BUTTON_REPEAT)
131#define REC_STOPEXIT BUTTON_OFF
132#define REC_RECPAUSE BUTTON_ON
133#define REC_INC BUTTON_RIGHT
134#define REC_DEC BUTTON_LEFT
135#endif
136
137#define PM_HEIGHT ((LCD_HEIGHT >= 72) ? 2 : 1) 71#define PM_HEIGHT ((LCD_HEIGHT >= 72) ? 2 : 1)
138 72
139bool f2_rec_screen(void); 73bool f2_rec_screen(void);
@@ -830,8 +764,7 @@ bool recording_screen(void)
830 764
831 switch(button) 765 switch(button)
832 { 766 {
833#ifdef BUTTON_RC_DISPLAY 767 case ACTION_REC_LCD:
834 case BUTTON_RC_DISPLAY:
835 if (remote_display_on) 768 if (remote_display_on)
836 { 769 {
837 remote_display_on = false; 770 remote_display_on = false;
@@ -849,15 +782,8 @@ bool recording_screen(void)
849 screen_update = NB_SCREENS; 782 screen_update = NB_SCREENS;
850 } 783 }
851 break; 784 break;
852#endif 785
853 case REC_STOPEXIT: 786 case ACTION_STD_CANCEL:
854 case REC_SHUTDOWN:
855#ifdef REC_RC_STOPEXIT
856 case REC_RC_STOPEXIT:
857#endif
858#ifdef REC_RC_SHUTDOWN
859 case REC_RC_SHUTDOWN:
860#endif
861 /* turn off the trigger */ 787 /* turn off the trigger */
862 peak_meter_trigger(false); 788 peak_meter_trigger(false);
863 peak_meter_set_trigger_listener(NULL); 789 peak_meter_set_trigger_listener(NULL);
@@ -877,27 +803,8 @@ bool recording_screen(void)
877 update_countdown = 1; /* Update immediately */ 803 update_countdown = 1; /* Update immediately */
878 break; 804 break;
879 805
880 case REC_RECPAUSE: 806 case ACTION_REC_PAUSE:
881#ifdef REC_RC_RECPAUSE 807 case ACTION_REC_NEWFILE:
882 case REC_RC_RECPAUSE:
883#endif
884#ifdef REC_RECPAUSE_PRE
885 if (lastbutton != REC_RECPAUSE_PRE)
886 break;
887#endif
888#ifdef REC_NEWFILE
889 case REC_NEWFILE:
890#endif
891#ifdef REC_RC_NEWFILE
892 case REC_RC_NEWFILE:
893#endif
894#ifdef REC_NEWFILE_PRE
895 if (button == REC_NEWFILE){
896 if (lastbutton != REC_NEWFILE_PRE)
897 break;
898 }
899#endif
900
901 /* Only act if the mpeg is stopped */ 808 /* Only act if the mpeg is stopped */
902 if(!(audio_stat & AUDIO_STATUS_RECORD)) 809 if(!(audio_stat & AUDIO_STATUS_RECORD))
903 { 810 {
@@ -928,19 +835,13 @@ bool recording_screen(void)
928 } 835 }
929 else 836 else
930 { 837 {
931#ifdef REC_NEWFILE
932 /*if new file button pressed, start new file */ 838 /*if new file button pressed, start new file */
933 if ((button == REC_NEWFILE) 839 if (button == ACTION_REC_NEWFILE)
934#ifdef REC_RC_NEWFILE
935 || (button == REC_RC_NEWFILE)
936#endif
937 )
938 { 840 {
939 audio_new_file(rec_create_filename(path_buffer)); 841 audio_new_file(rec_create_filename(path_buffer));
940 last_seconds = 0; 842 last_seconds = 0;
941 } 843 }
942 else 844 else
943#endif
944 /* if pause button pressed, pause or resume */ 845 /* if pause button pressed, pause or resume */
945 { 846 {
946 if(audio_stat & AUDIO_STATUS_PAUSE) 847 if(audio_stat & AUDIO_STATUS_PAUSE)
@@ -960,34 +861,19 @@ bool recording_screen(void)
960 update_countdown = 1; /* Update immediately */ 861 update_countdown = 1; /* Update immediately */
961 break; 862 break;
962 863
963#ifdef REC_PREV 864 case ACTION_STD_PREV:
964 case REC_PREV:
965#ifdef REC_RC_PREV
966 case REC_RC_PREV:
967#endif
968 cursor--; 865 cursor--;
969 adjust_cursor(); 866 adjust_cursor();
970 update_countdown = 1; /* Update immediately */ 867 update_countdown = 1; /* Update immediately */
971 break; 868 break;
972#endif
973 869
974#ifdef REC_NEXT 870 case ACTION_STD_NEXT:
975 case REC_NEXT:
976#ifdef REC_RC_NEXT
977 case REC_RC_NEXT:
978#endif
979 cursor++; 871 cursor++;
980 adjust_cursor(); 872 adjust_cursor();
981 update_countdown = 1; /* Update immediately */ 873 update_countdown = 1; /* Update immediately */
982 break; 874 break;
983#endif
984 875
985 case REC_INC: 876 case ACTION_SETTINGS_INC:
986 case REC_INC | BUTTON_REPEAT:
987#ifdef REC_RC_INC
988 case REC_RC_INC:
989 case REC_RC_INC | BUTTON_REPEAT:
990#endif
991 switch(cursor) 877 switch(cursor)
992 { 878 {
993 case 0: 879 case 0:
@@ -1055,12 +941,7 @@ bool recording_screen(void)
1055 update_countdown = 1; /* Update immediately */ 941 update_countdown = 1; /* Update immediately */
1056 break; 942 break;
1057 943
1058 case REC_DEC: 944 case ACTION_SETTINGS_DEC:
1059 case REC_DEC | BUTTON_REPEAT:
1060#ifdef REC_RC_DEC
1061 case REC_RC_DEC:
1062 case REC_RC_DEC | BUTTON_REPEAT:
1063#endif
1064 switch(cursor) 945 switch(cursor)
1065 { 946 {
1066 case 0: 947 case 0:
@@ -1128,11 +1009,7 @@ bool recording_screen(void)
1128 update_countdown = 1; /* Update immediately */ 1009 update_countdown = 1; /* Update immediately */
1129 break; 1010 break;
1130 1011
1131#ifdef REC_SETTINGS 1012 case ACTION_STD_MENU:
1132 case REC_SETTINGS:
1133#ifdef REC_RC_SETTINGS
1134 case REC_RC_SETTINGS:
1135#endif
1136 if(audio_stat != AUDIO_STATUS_RECORD) 1013 if(audio_stat != AUDIO_STATUS_RECORD)
1137 { 1014 {
1138#if CONFIG_LED == LED_REAL 1015#if CONFIG_LED == LED_REAL
@@ -1178,10 +1055,8 @@ bool recording_screen(void)
1178 } 1055 }
1179 } 1056 }
1180 break; 1057 break;
1181#endif 1058#if CONFIG_KEYPAD == RECORDER_PAD
1182 1059 case ACTION_REC_F2:
1183#ifdef REC_F2
1184 case REC_F2:
1185 if(audio_stat != AUDIO_STATUS_RECORD) 1060 if(audio_stat != AUDIO_STATUS_RECORD)
1186 { 1061 {
1187#if CONFIG_LED == LED_REAL 1062#if CONFIG_LED == LED_REAL
@@ -1197,10 +1072,8 @@ bool recording_screen(void)
1197 update_countdown = 1; /* Update immediately */ 1072 update_countdown = 1; /* Update immediately */
1198 } 1073 }
1199 break; 1074 break;
1200#endif
1201 1075
1202#ifdef REC_F3 1076 case ACTION_REC_F3:
1203 case REC_F3:
1204 if(audio_stat & AUDIO_STATUS_RECORD) 1077 if(audio_stat & AUDIO_STATUS_RECORD)
1205 { 1078 {
1206 audio_new_file(rec_create_filename(path_buffer)); 1079 audio_new_file(rec_create_filename(path_buffer));
@@ -1653,8 +1526,7 @@ bool recording_screen(void)
1653 1526
1654 while(1) 1527 while(1)
1655 { 1528 {
1656 button = button_get(true); 1529 if (action_userabort(TIMEOUT_NOBLOCK))
1657 if(button == (REC_STOPEXIT | BUTTON_REL))
1658 break; 1530 break;
1659 } 1531 }
1660 } 1532 }
@@ -1690,7 +1562,7 @@ bool recording_screen(void)
1690 return been_in_usb_mode; 1562 return been_in_usb_mode;
1691} 1563}
1692 1564
1693#ifdef REC_F2 1565#if CONFIG_KEYPAD == RECORDER_PAD
1694bool f2_rec_screen(void) 1566bool f2_rec_screen(void)
1695{ 1567{
1696 bool exit = false; 1568 bool exit = false;
@@ -1826,9 +1698,7 @@ bool f2_rec_screen(void)
1826 1698
1827 return false; 1699 return false;
1828} 1700}
1829#endif /* #ifdef REC_F2 */
1830 1701
1831#ifdef REC_F3
1832bool f3_rec_screen(void) 1702bool f3_rec_screen(void)
1833{ 1703{
1834 bool exit = false; 1704 bool exit = false;
@@ -1931,7 +1801,7 @@ bool f3_rec_screen(void)
1931 1801
1932 return false; 1802 return false;
1933} 1803}
1934#endif /* #ifdef REC_F3 */ 1804#endif /* #ifdef RECORDER_PAD */
1935 1805
1936#if CONFIG_CODEC == SWCODEC 1806#if CONFIG_CODEC == SWCODEC
1937void audio_beep(int duration) 1807void audio_beep(int duration)