summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Scarratt <mmmm@rockbox.org>2006-07-22 17:23:05 +0000
committerMartin Scarratt <mmmm@rockbox.org>2006-07-22 17:23:05 +0000
commit9130a2a4a710a93ecc36d57b1f2abb9332567080 (patch)
treeb8b9214c3ad15f135772c285efe80675d5594e57
parent57327044cdfa8258b8bea8a4d837fa4a7d551aff (diff)
downloadrockbox-9130a2a4a710a93ecc36d57b1f2abb9332567080.tar.gz
rockbox-9130a2a4a710a93ecc36d57b1f2abb9332567080.zip
Added options to timesplit recording feature (now renamed filesplit). Choose to split file by either time or filesize. Also have the option to either start a new file or stop recording at split point. Bumped config version so save your settings before you update your build.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10285 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/lang/english.lang117
-rw-r--r--apps/recorder/recording.c53
-rw-r--r--apps/settings.c32
-rw-r--r--apps/settings.h8
-rw-r--r--apps/sound_menu.c70
-rw-r--r--apps/talk.h1
6 files changed, 258 insertions, 23 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index d05549a423..2b227831dc 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -2698,16 +2698,16 @@
2698</phrase> 2698</phrase>
2699<phrase> 2699<phrase>
2700 id: LANG_RECORD_TIMESPLIT 2700 id: LANG_RECORD_TIMESPLIT
2701 desc: Prompt for record timer interval setting, in the record settings menu 2701 desc: Record split menu
2702 user: 2702 user:
2703 <source> 2703 <source>
2704 *: "Time Split" 2704 *: "File Split Options"
2705 </source> 2705 </source>
2706 <dest> 2706 <dest>
2707 *: "Time Split" 2707 *: "File Split Options"
2708 </dest> 2708 </dest>
2709 <voice> 2709 <voice>
2710 *: "Time Split" 2710 *: "File Split Options"
2711 </voice> 2711 </voice>
2712</phrase> 2712</phrase>
2713<phrase> 2713<phrase>
@@ -8669,4 +8669,111 @@
8669 *: "Import modifications" 8669 *: "Import modifications"
8670 </voice> 8670 </voice>
8671</phrase> 8671</phrase>
8672 8672<phrase>
8673 id: LANG_SPLIT_MEASURE
8674 desc: in record timesplit options
8675 <source>
8676 *: "Split Measure"
8677 </source>
8678 <dest>
8679 *: "Split Measure"
8680 </dest>
8681 <voice>
8682 *: "Split Measure"
8683 </voice>
8684</phrase>
8685<phrase>
8686 id: LANG_SPLIT_TYPE
8687 desc: in record timesplit options
8688 <source>
8689 *: "What to do when Splitting"
8690 </source>
8691 <dest>
8692 *: "What to do when Splitting"
8693 </dest>
8694 <voice>
8695 *: "What to do when Splitting"
8696 </voice>
8697</phrase>
8698<phrase>
8699 id: LANG_SPLIT_TIME
8700 desc: in record timesplit options
8701 <source>
8702 *: "Split Time"
8703 </source>
8704 <dest>
8705 *: "Split Time"
8706 </dest>
8707 <voice>
8708 *: "Split Time"
8709 </voice>
8710</phrase>
8711<phrase>
8712 id: LANG_SPLIT_SIZE
8713 desc: in record timesplit options
8714 <source>
8715 *: "Split Filesize"
8716 </source>
8717 <dest>
8718 *: "Split Filesize"
8719 </dest>
8720 <voice>
8721 *: "Split Filesize"
8722 </voice>
8723</phrase>
8724<phrase>
8725 id: LANG_REC_TIME
8726 desc: in record timesplit options
8727 user:
8728 <source>
8729 *: "Time"
8730 </source>
8731 <dest>
8732 *: "Time"
8733 </dest>
8734 <voice>
8735 *: "Time"
8736 </voice>
8737</phrase>
8738<phrase>
8739 id: LANG_REC_SIZE
8740 desc: in record timesplit options
8741 user:
8742 <source>
8743 *: "Filesize"
8744 </source>
8745 <dest>
8746 *: "Filesize"
8747 </dest>
8748 <voice>
8749 *: "Filesize"
8750 </voice>
8751</phrase>
8752<phrase>
8753 id: LANG_START_NEW_FILE
8754 desc: in record timesplit options
8755 user:
8756 <source>
8757 *: "Start new file"
8758 </source>
8759 <dest>
8760 *: "Start new file"
8761 </dest>
8762 <voice>
8763 *: "Start new file"
8764 </voice>
8765</phrase>
8766<phrase>
8767 id: LANG_STOP_RECORDING
8768 desc: in record timesplit options
8769 user:
8770 <source>
8771 *: "Stop recording"
8772 </source>
8773 <dest>
8774 *: "Stop recording"
8775 </dest>
8776 <voice>
8777 *: "Stop recording"
8778 </voice>
8779</phrase>
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 436212a1be..06a6fd9b94 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -830,27 +830,38 @@ bool recording_screen(void)
830 if(update_countdown == 0 || seconds > last_seconds) 830 if(update_countdown == 0 || seconds > last_seconds)
831 { 831 {
832 unsigned int dseconds, dhours, dminutes; 832 unsigned int dseconds, dhours, dminutes;
833 unsigned long num_recorded_bytes; 833 unsigned long num_recorded_bytes, dsize, dmb;
834 int pos = 0; 834 int pos = 0;
835 char spdif_sfreq[8]; 835 char spdif_sfreq[8];
836 836
837 update_countdown = 5; 837 update_countdown = 5;
838 last_seconds = seconds; 838 last_seconds = seconds;
839 839
840 dseconds = rec_timesplit_seconds();
841 dsize = rec_sizesplit_bytes();
842 num_recorded_bytes = audio_num_recorded_bytes();
843
840 FOR_NB_SCREENS(i) 844 FOR_NB_SCREENS(i)
841 screens[i].clear_display(); 845 screens[i].clear_display();
842 846
843 hours = seconds / 3600; 847 if ((global_settings.rec_sizesplit) && (global_settings.rec_split_method))
844 minutes = (seconds - (hours * 3600)) / 60; 848 {
845 snprintf(buf, 32, "%s %02d:%02d:%02d", 849 dmb = dsize/1024/1024;
846 str(LANG_RECORDING_TIME), 850 snprintf(buf, 32, "%s %dMB",
847 hours, minutes, seconds%60); 851 str(LANG_SPLIT_SIZE), dmb);
852 }
853 else
854 {
855 hours = seconds / 3600;
856 minutes = (seconds - (hours * 3600)) / 60;
857 snprintf(buf, 32, "%s %02d:%02d:%02d",
858 str(LANG_RECORDING_TIME),
859 hours, minutes, seconds%60);
860 }
861
848 FOR_NB_SCREENS(i) 862 FOR_NB_SCREENS(i)
849 screens[i].puts(0, 0, buf); 863 screens[i].puts(0, 0, buf);
850 864
851 dseconds = rec_timesplit_seconds();
852 num_recorded_bytes = audio_num_recorded_bytes();
853
854 if(audio_stat & AUDIO_STATUS_PRERECORD) 865 if(audio_stat & AUDIO_STATUS_PRERECORD)
855 { 866 {
856 snprintf(buf, 32, "%s...", str(LANG_RECORD_PRERECORD)); 867 snprintf(buf, 32, "%s...", str(LANG_RECORD_PRERECORD));
@@ -859,7 +870,7 @@ bool recording_screen(void)
859 { 870 {
860 /* Display the split interval if the record timesplit 871 /* Display the split interval if the record timesplit
861 is active */ 872 is active */
862 if (global_settings.rec_timesplit) 873 if ((global_settings.rec_timesplit) && !(global_settings.rec_split_method))
863 { 874 {
864 /* Display the record timesplit interval rather 875 /* Display the record timesplit interval rather
865 than the file size if the record timer is 876 than the file size if the record timer is
@@ -903,13 +914,25 @@ bool recording_screen(void)
903 /* We will do file splitting regardless, either at the end of 914 /* We will do file splitting regardless, either at the end of
904 a split interval, or when the filesize approaches the 2GB 915 a split interval, or when the filesize approaches the 2GB
905 FAT file size (compatibility) limit. */ 916 FAT file size (compatibility) limit. */
906 if (audio_stat && 917 if ((audio_stat && !(global_settings.rec_split_method)
907 ((global_settings.rec_timesplit && (seconds >= dseconds)) 918 && global_settings.rec_timesplit && (seconds >= dseconds))
908 || (num_recorded_bytes >= MAX_FILE_SIZE))) 919 || (audio_stat && global_settings.rec_split_method
920 && global_settings.rec_sizesplit && (num_recorded_bytes >= dsize))
921 || (num_recorded_bytes >= MAX_FILE_SIZE))
909 { 922 {
910 audio_new_file(rec_create_filename(path_buffer)); 923 if (!(global_settings.rec_split_type)
924 || (num_recorded_bytes >= MAX_FILE_SIZE))
925 {
926 audio_new_file(rec_create_filename(path_buffer));
927 last_seconds = 0;
928 }
929 else
930 {
931 peak_meter_trigger(false);
932 peak_meter_set_trigger_listener(NULL);
933 audio_stop_recording();
934 }
911 update_countdown = 1; 935 update_countdown = 1;
912 last_seconds = 0;
913 } 936 }
914 937
915 snprintf(buf, 32, "%s: %s", str(LANG_VOLUME), 938 snprintf(buf, 32, "%s: %s", str(LANG_VOLUME),
diff --git a/apps/settings.c b/apps/settings.c
index e065e78c81..8846fa4bcf 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -94,7 +94,7 @@ const char rec_base_directory[] = REC_BASE_DIR;
94#include "dsp.h" 94#include "dsp.h"
95#endif 95#endif
96 96
97#define CONFIG_BLOCK_VERSION 46 97#define CONFIG_BLOCK_VERSION 47
98#define CONFIG_BLOCK_SIZE 512 98#define CONFIG_BLOCK_SIZE 512
99#define RTC_BLOCK_SIZE 44 99#define RTC_BLOCK_SIZE 44
100 100
@@ -466,7 +466,12 @@ static const struct bit_entry hd_bits[] =
466 {1, S_O(rec_startup), false, "rec screen on startup", off_on }, 466 {1, S_O(rec_startup), false, "rec screen on startup", off_on },
467 {4, S_O(rec_timesplit), 0, "rec timesplit", /* 0...15 */ 467 {4, S_O(rec_timesplit), 0, "rec timesplit", /* 0...15 */
468 "off,00:05,00:10,00:15,00:30,01:00,01:14,01:20,02:00,04:00,06:00,08:00,10:00,12:00,18:00,24:00" }, 468 "off,00:05,00:10,00:15,00:30,01:00,01:14,01:20,02:00,04:00,06:00,08:00,10:00,12:00,18:00,24:00" },
469 {4, S_O(rec_sizesplit), 0, "rec sizesplit", /* 0...15 */
470 "off,5MB,10MB,15MB,32MB,64MB,75MB,100MB,128MB,256MB,512MB,650MB,700MB,1GB,1.5GB,1.75GB" },
469 {1, S_O(rec_channels), 0, "rec channels", "stereo,mono" }, 471 {1, S_O(rec_channels), 0, "rec channels", "stereo,mono" },
472 {1, S_O(rec_split_type), 0, "rec split type", "Split, Stop" },
473 {1, S_O(rec_split_method), 0, "rec split method", "Time,Filesize" },
474
470#ifdef HAVE_SPDIF_IN 475#ifdef HAVE_SPDIF_IN
471 {2, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line,spdif" }, 476 {2, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line,spdif" },
472#else 477#else
@@ -1929,6 +1934,31 @@ unsigned int rec_timesplit_seconds(void)
1929 return rec_timer_seconds[global_settings.rec_timesplit]; 1934 return rec_timer_seconds[global_settings.rec_timesplit];
1930} 1935}
1931 1936
1937/* This array holds the record size interval lengths, in bytes */
1938static const unsigned long rec_size_bytes[] =
1939{
1940 0, /* 0 means OFF */
1941 5*1024*1024, /* 5MB */
1942 10*1024*1024, /* 10MB */
1943 15*1024*1024, /* 15MB */
1944 32*1024*1024, /* 32MB */
1945 64*1024*1024, /* 64MB */
1946 75*1024*1024, /* 75MB */
1947 100*1024*1024, /* 100MB */
1948 128*1024*1024, /* 128MB */
1949 256*1024*1024, /* 256MB */
1950 512*1024*1024, /* 512MB */
1951 650*1024*1024, /* 650MB */
1952 700*1024*1024, /* 700MB */
1953 1024*1024*1024, /* 1GB */
1954 1536*1024*1024, /* 1.5GB */
1955 1792*1024*1024, /* 1.75GB */
1956};
1957
1958unsigned long rec_sizesplit_bytes(void)
1959{
1960 return rec_size_bytes[global_settings.rec_sizesplit];
1961}
1932/* 1962/*
1933 * Time strings used for the trigger durations. 1963 * Time strings used for the trigger durations.
1934 * Keep synchronous to trigger_times in settings_apply_trigger 1964 * Keep synchronous to trigger_times in settings_apply_trigger
diff --git a/apps/settings.h b/apps/settings.h
index 4809c18575..8c47c9253e 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -249,6 +249,13 @@ struct user_settings
249 5 = 01:00, 6 = 02:00, 7 = 04:00, 8 = 06:00 249 5 = 01:00, 6 = 02:00, 7 = 04:00, 8 = 06:00
250 9 = 08:00, 10= 10:00, 11= 12:00, 12= 18:00, 250 9 = 08:00, 10= 10:00, 11= 12:00, 12= 18:00,
251 13= 24:00 */ 251 13= 24:00 */
252 int rec_sizesplit; /* 0 = off,
253 1 = 5MB, 2 = 10MB, 3 = 15MB, 4 = 32MB
254 5 = 64MB, 6 = 75MB, 7 = 100MB, 8 = 128MB
255 9 = 256MB, 10= 512MB, 11= 650MB, 12= 700MB,
256 13= 1GB, 14 = 1.5GB 15 = 1.75MB*/
257 int rec_split_type; /* split/stop */
258 int rec_split_method; /* time/filesize */
252 259
253 int rec_prerecord_time; /* In seconds, 0-30, 0 means OFF */ 260 int rec_prerecord_time; /* In seconds, 0-30, 0 means OFF */
254 int rec_directory; /* 0=base dir, 1=current dir */ 261 int rec_directory; /* 0=base dir, 1=current dir */
@@ -549,6 +556,7 @@ int read_line(int fd, char* buffer, int buffer_size);
549void set_file(char* filename, char* setting, int maxlen); 556void set_file(char* filename, char* setting, int maxlen);
550 557
551unsigned int rec_timesplit_seconds(void); 558unsigned int rec_timesplit_seconds(void);
559unsigned long rec_sizesplit_bytes(void);
552void settings_apply_trigger(void); 560void settings_apply_trigger(void);
553 561
554/* global settings */ 562/* global settings */
diff --git a/apps/sound_menu.c b/apps/sound_menu.c
index d8d5d4ef75..0d65bd8b9e 100644
--- a/apps/sound_menu.c
+++ b/apps/sound_menu.c
@@ -366,11 +366,77 @@ static bool rectimesplit(void)
366 { "18:00" , TALK_ID(18, UNIT_HOUR) }, 366 { "18:00" , TALK_ID(18, UNIT_HOUR) },
367 { "24:00" , TALK_ID(24, UNIT_HOUR) } 367 { "24:00" , TALK_ID(24, UNIT_HOUR) }
368 }; 368 };
369 return set_option(str(LANG_RECORD_TIMESPLIT), 369 return set_option(str(LANG_SPLIT_TIME),
370 &global_settings.rec_timesplit, INT, 370 &global_settings.rec_timesplit, INT,
371 names, 16, NULL ); 371 names, 16, NULL );
372} 372}
373 373
374static bool recsizesplit(void)
375{
376 static const struct opt_items names[] = {
377 { STR(LANG_OFF) },
378 { "5MB" , TALK_ID(5, UNIT_MB) },
379 { "10MB" , TALK_ID(10, UNIT_MB) },
380 { "15MB" , TALK_ID(15, UNIT_MB) },
381 { "32MB" , TALK_ID(32, UNIT_MB) },
382 { "64MB" , TALK_ID(64, UNIT_MB) },
383 { "75MB" , TALK_ID(75, UNIT_MB) },
384 { "100MB" , TALK_ID(100, UNIT_MB) },
385 { "128MB" , TALK_ID(128, UNIT_MB) },
386 { "256MB" , TALK_ID(256, UNIT_MB) },
387 { "512MB" , TALK_ID(512, UNIT_MB) },
388 { "650MB" , TALK_ID(650, UNIT_MB) },
389 { "700MB" , TALK_ID(700, UNIT_MB) },
390 { "1GB" , TALK_ID(1024, UNIT_MB) },
391 { "1.5GB" , TALK_ID(1536, UNIT_MB) },
392 { "1.75GB" , TALK_ID(1792, UNIT_MB) }
393 };
394 return set_option(str(LANG_SPLIT_SIZE),
395 &global_settings.rec_sizesplit, INT,
396 names, 16, NULL );
397}
398
399static bool splitmethod(void)
400{
401 static const struct opt_items names[] = {
402 { STR(LANG_REC_TIME) },
403 { STR(LANG_REC_SIZE) },
404 };
405 bool ret;
406 ret=set_option( str(LANG_SPLIT_MEASURE),
407 &global_settings.rec_split_method, INT, names, 2, NULL);
408 return ret;
409}
410
411static bool splittype(void)
412{
413 static const struct opt_items names[] = {
414 { STR(LANG_START_NEW_FILE) },
415 { STR(LANG_STOP_RECORDING) },
416 };
417 bool ret;
418 ret=set_option( str(LANG_SPLIT_TYPE),
419 &global_settings.rec_split_type, INT, names, 2, NULL);
420 return ret;
421}
422
423static bool filesplitoptionsmenu(void)
424{
425 int m;
426 bool result;
427
428 static const struct menu_item items[] = {
429 { ID2P(LANG_SPLIT_MEASURE), splitmethod },
430 { ID2P(LANG_SPLIT_TYPE), splittype },
431 { ID2P(LANG_SPLIT_TIME), rectimesplit },
432 { ID2P(LANG_SPLIT_SIZE), recsizesplit }
433 };
434 m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
435 NULL, NULL, NULL);
436 result = menu_run(m);
437 menu_exit(m);
438 return result;
439}
374static bool recprerecord(void) 440static bool recprerecord(void)
375{ 441{
376 static const struct opt_items names[] = { 442 static const struct opt_items names[] = {
@@ -931,7 +997,7 @@ bool recording_menu(bool no_source)
931 items[i++].function = receditable; 997 items[i++].function = receditable;
932#endif 998#endif
933 items[i].desc = ID2P(LANG_RECORD_TIMESPLIT); 999 items[i].desc = ID2P(LANG_RECORD_TIMESPLIT);
934 items[i++].function = rectimesplit; 1000 items[i++].function = filesplitoptionsmenu;
935 items[i].desc = ID2P(LANG_RECORD_PRERECORD_TIME); 1001 items[i].desc = ID2P(LANG_RECORD_PRERECORD_TIME);
936 items[i++].function = recprerecord; 1002 items[i++].function = recprerecord;
937 items[i].desc = ID2P(LANG_RECORD_DIRECTORY); 1003 items[i].desc = ID2P(LANG_RECORD_DIRECTORY);
diff --git a/apps/talk.h b/apps/talk.h
index 8bc86c329a..58ab0ef37a 100644
--- a/apps/talk.h
+++ b/apps/talk.h
@@ -40,6 +40,7 @@ enum {
40 UNIT_PIXEL, /* pixels */ 40 UNIT_PIXEL, /* pixels */
41 UNIT_PER_SEC, /* per second */ 41 UNIT_PER_SEC, /* per second */
42 UNIT_HERTZ, /* hertz */ 42 UNIT_HERTZ, /* hertz */
43 UNIT_MB, /* Megabytes */
43 UNIT_LAST /* END MARKER */ 44 UNIT_LAST /* END MARKER */
44}; 45};
45 46