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
This commit is contained in:
parent
57327044cd
commit
9130a2a4a7
6 changed files with 258 additions and 23 deletions
|
@ -2698,16 +2698,16 @@
|
||||||
</phrase>
|
</phrase>
|
||||||
<phrase>
|
<phrase>
|
||||||
id: LANG_RECORD_TIMESPLIT
|
id: LANG_RECORD_TIMESPLIT
|
||||||
desc: Prompt for record timer interval setting, in the record settings menu
|
desc: Record split menu
|
||||||
user:
|
user:
|
||||||
<source>
|
<source>
|
||||||
*: "Time Split"
|
*: "File Split Options"
|
||||||
</source>
|
</source>
|
||||||
<dest>
|
<dest>
|
||||||
*: "Time Split"
|
*: "File Split Options"
|
||||||
</dest>
|
</dest>
|
||||||
<voice>
|
<voice>
|
||||||
*: "Time Split"
|
*: "File Split Options"
|
||||||
</voice>
|
</voice>
|
||||||
</phrase>
|
</phrase>
|
||||||
<phrase>
|
<phrase>
|
||||||
|
@ -8669,4 +8669,111 @@
|
||||||
*: "Import modifications"
|
*: "Import modifications"
|
||||||
</voice>
|
</voice>
|
||||||
</phrase>
|
</phrase>
|
||||||
|
<phrase>
|
||||||
|
id: LANG_SPLIT_MEASURE
|
||||||
|
desc: in record timesplit options
|
||||||
|
<source>
|
||||||
|
*: "Split Measure"
|
||||||
|
</source>
|
||||||
|
<dest>
|
||||||
|
*: "Split Measure"
|
||||||
|
</dest>
|
||||||
|
<voice>
|
||||||
|
*: "Split Measure"
|
||||||
|
</voice>
|
||||||
|
</phrase>
|
||||||
|
<phrase>
|
||||||
|
id: LANG_SPLIT_TYPE
|
||||||
|
desc: in record timesplit options
|
||||||
|
<source>
|
||||||
|
*: "What to do when Splitting"
|
||||||
|
</source>
|
||||||
|
<dest>
|
||||||
|
*: "What to do when Splitting"
|
||||||
|
</dest>
|
||||||
|
<voice>
|
||||||
|
*: "What to do when Splitting"
|
||||||
|
</voice>
|
||||||
|
</phrase>
|
||||||
|
<phrase>
|
||||||
|
id: LANG_SPLIT_TIME
|
||||||
|
desc: in record timesplit options
|
||||||
|
<source>
|
||||||
|
*: "Split Time"
|
||||||
|
</source>
|
||||||
|
<dest>
|
||||||
|
*: "Split Time"
|
||||||
|
</dest>
|
||||||
|
<voice>
|
||||||
|
*: "Split Time"
|
||||||
|
</voice>
|
||||||
|
</phrase>
|
||||||
|
<phrase>
|
||||||
|
id: LANG_SPLIT_SIZE
|
||||||
|
desc: in record timesplit options
|
||||||
|
<source>
|
||||||
|
*: "Split Filesize"
|
||||||
|
</source>
|
||||||
|
<dest>
|
||||||
|
*: "Split Filesize"
|
||||||
|
</dest>
|
||||||
|
<voice>
|
||||||
|
*: "Split Filesize"
|
||||||
|
</voice>
|
||||||
|
</phrase>
|
||||||
|
<phrase>
|
||||||
|
id: LANG_REC_TIME
|
||||||
|
desc: in record timesplit options
|
||||||
|
user:
|
||||||
|
<source>
|
||||||
|
*: "Time"
|
||||||
|
</source>
|
||||||
|
<dest>
|
||||||
|
*: "Time"
|
||||||
|
</dest>
|
||||||
|
<voice>
|
||||||
|
*: "Time"
|
||||||
|
</voice>
|
||||||
|
</phrase>
|
||||||
|
<phrase>
|
||||||
|
id: LANG_REC_SIZE
|
||||||
|
desc: in record timesplit options
|
||||||
|
user:
|
||||||
|
<source>
|
||||||
|
*: "Filesize"
|
||||||
|
</source>
|
||||||
|
<dest>
|
||||||
|
*: "Filesize"
|
||||||
|
</dest>
|
||||||
|
<voice>
|
||||||
|
*: "Filesize"
|
||||||
|
</voice>
|
||||||
|
</phrase>
|
||||||
|
<phrase>
|
||||||
|
id: LANG_START_NEW_FILE
|
||||||
|
desc: in record timesplit options
|
||||||
|
user:
|
||||||
|
<source>
|
||||||
|
*: "Start new file"
|
||||||
|
</source>
|
||||||
|
<dest>
|
||||||
|
*: "Start new file"
|
||||||
|
</dest>
|
||||||
|
<voice>
|
||||||
|
*: "Start new file"
|
||||||
|
</voice>
|
||||||
|
</phrase>
|
||||||
|
<phrase>
|
||||||
|
id: LANG_STOP_RECORDING
|
||||||
|
desc: in record timesplit options
|
||||||
|
user:
|
||||||
|
<source>
|
||||||
|
*: "Stop recording"
|
||||||
|
</source>
|
||||||
|
<dest>
|
||||||
|
*: "Stop recording"
|
||||||
|
</dest>
|
||||||
|
<voice>
|
||||||
|
*: "Stop recording"
|
||||||
|
</voice>
|
||||||
|
</phrase>
|
||||||
|
|
|
@ -830,27 +830,38 @@ bool recording_screen(void)
|
||||||
if(update_countdown == 0 || seconds > last_seconds)
|
if(update_countdown == 0 || seconds > last_seconds)
|
||||||
{
|
{
|
||||||
unsigned int dseconds, dhours, dminutes;
|
unsigned int dseconds, dhours, dminutes;
|
||||||
unsigned long num_recorded_bytes;
|
unsigned long num_recorded_bytes, dsize, dmb;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
char spdif_sfreq[8];
|
char spdif_sfreq[8];
|
||||||
|
|
||||||
update_countdown = 5;
|
update_countdown = 5;
|
||||||
last_seconds = seconds;
|
last_seconds = seconds;
|
||||||
|
|
||||||
|
dseconds = rec_timesplit_seconds();
|
||||||
|
dsize = rec_sizesplit_bytes();
|
||||||
|
num_recorded_bytes = audio_num_recorded_bytes();
|
||||||
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
screens[i].clear_display();
|
screens[i].clear_display();
|
||||||
|
|
||||||
|
if ((global_settings.rec_sizesplit) && (global_settings.rec_split_method))
|
||||||
|
{
|
||||||
|
dmb = dsize/1024/1024;
|
||||||
|
snprintf(buf, 32, "%s %dMB",
|
||||||
|
str(LANG_SPLIT_SIZE), dmb);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
hours = seconds / 3600;
|
hours = seconds / 3600;
|
||||||
minutes = (seconds - (hours * 3600)) / 60;
|
minutes = (seconds - (hours * 3600)) / 60;
|
||||||
snprintf(buf, 32, "%s %02d:%02d:%02d",
|
snprintf(buf, 32, "%s %02d:%02d:%02d",
|
||||||
str(LANG_RECORDING_TIME),
|
str(LANG_RECORDING_TIME),
|
||||||
hours, minutes, seconds%60);
|
hours, minutes, seconds%60);
|
||||||
|
}
|
||||||
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
screens[i].puts(0, 0, buf);
|
screens[i].puts(0, 0, buf);
|
||||||
|
|
||||||
dseconds = rec_timesplit_seconds();
|
|
||||||
num_recorded_bytes = audio_num_recorded_bytes();
|
|
||||||
|
|
||||||
if(audio_stat & AUDIO_STATUS_PRERECORD)
|
if(audio_stat & AUDIO_STATUS_PRERECORD)
|
||||||
{
|
{
|
||||||
snprintf(buf, 32, "%s...", str(LANG_RECORD_PRERECORD));
|
snprintf(buf, 32, "%s...", str(LANG_RECORD_PRERECORD));
|
||||||
|
@ -859,7 +870,7 @@ bool recording_screen(void)
|
||||||
{
|
{
|
||||||
/* Display the split interval if the record timesplit
|
/* Display the split interval if the record timesplit
|
||||||
is active */
|
is active */
|
||||||
if (global_settings.rec_timesplit)
|
if ((global_settings.rec_timesplit) && !(global_settings.rec_split_method))
|
||||||
{
|
{
|
||||||
/* Display the record timesplit interval rather
|
/* Display the record timesplit interval rather
|
||||||
than the file size if the record timer is
|
than the file size if the record timer is
|
||||||
|
@ -903,14 +914,26 @@ bool recording_screen(void)
|
||||||
/* We will do file splitting regardless, either at the end of
|
/* We will do file splitting regardless, either at the end of
|
||||||
a split interval, or when the filesize approaches the 2GB
|
a split interval, or when the filesize approaches the 2GB
|
||||||
FAT file size (compatibility) limit. */
|
FAT file size (compatibility) limit. */
|
||||||
if (audio_stat &&
|
if ((audio_stat && !(global_settings.rec_split_method)
|
||||||
((global_settings.rec_timesplit && (seconds >= dseconds))
|
&& global_settings.rec_timesplit && (seconds >= dseconds))
|
||||||
|| (num_recorded_bytes >= MAX_FILE_SIZE)))
|
|| (audio_stat && global_settings.rec_split_method
|
||||||
|
&& global_settings.rec_sizesplit && (num_recorded_bytes >= dsize))
|
||||||
|
|| (num_recorded_bytes >= MAX_FILE_SIZE))
|
||||||
|
{
|
||||||
|
if (!(global_settings.rec_split_type)
|
||||||
|
|| (num_recorded_bytes >= MAX_FILE_SIZE))
|
||||||
{
|
{
|
||||||
audio_new_file(rec_create_filename(path_buffer));
|
audio_new_file(rec_create_filename(path_buffer));
|
||||||
update_countdown = 1;
|
|
||||||
last_seconds = 0;
|
last_seconds = 0;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
peak_meter_trigger(false);
|
||||||
|
peak_meter_set_trigger_listener(NULL);
|
||||||
|
audio_stop_recording();
|
||||||
|
}
|
||||||
|
update_countdown = 1;
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(buf, 32, "%s: %s", str(LANG_VOLUME),
|
snprintf(buf, 32, "%s: %s", str(LANG_VOLUME),
|
||||||
fmt_gain(SOUND_VOLUME,
|
fmt_gain(SOUND_VOLUME,
|
||||||
|
|
|
@ -94,7 +94,7 @@ const char rec_base_directory[] = REC_BASE_DIR;
|
||||||
#include "dsp.h"
|
#include "dsp.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CONFIG_BLOCK_VERSION 46
|
#define CONFIG_BLOCK_VERSION 47
|
||||||
#define CONFIG_BLOCK_SIZE 512
|
#define CONFIG_BLOCK_SIZE 512
|
||||||
#define RTC_BLOCK_SIZE 44
|
#define RTC_BLOCK_SIZE 44
|
||||||
|
|
||||||
|
@ -466,7 +466,12 @@ static const struct bit_entry hd_bits[] =
|
||||||
{1, S_O(rec_startup), false, "rec screen on startup", off_on },
|
{1, S_O(rec_startup), false, "rec screen on startup", off_on },
|
||||||
{4, S_O(rec_timesplit), 0, "rec timesplit", /* 0...15 */
|
{4, S_O(rec_timesplit), 0, "rec timesplit", /* 0...15 */
|
||||||
"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" },
|
"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" },
|
||||||
|
{4, S_O(rec_sizesplit), 0, "rec sizesplit", /* 0...15 */
|
||||||
|
"off,5MB,10MB,15MB,32MB,64MB,75MB,100MB,128MB,256MB,512MB,650MB,700MB,1GB,1.5GB,1.75GB" },
|
||||||
{1, S_O(rec_channels), 0, "rec channels", "stereo,mono" },
|
{1, S_O(rec_channels), 0, "rec channels", "stereo,mono" },
|
||||||
|
{1, S_O(rec_split_type), 0, "rec split type", "Split, Stop" },
|
||||||
|
{1, S_O(rec_split_method), 0, "rec split method", "Time,Filesize" },
|
||||||
|
|
||||||
#ifdef HAVE_SPDIF_IN
|
#ifdef HAVE_SPDIF_IN
|
||||||
{2, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line,spdif" },
|
{2, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line,spdif" },
|
||||||
#else
|
#else
|
||||||
|
@ -1929,6 +1934,31 @@ unsigned int rec_timesplit_seconds(void)
|
||||||
return rec_timer_seconds[global_settings.rec_timesplit];
|
return rec_timer_seconds[global_settings.rec_timesplit];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This array holds the record size interval lengths, in bytes */
|
||||||
|
static const unsigned long rec_size_bytes[] =
|
||||||
|
{
|
||||||
|
0, /* 0 means OFF */
|
||||||
|
5*1024*1024, /* 5MB */
|
||||||
|
10*1024*1024, /* 10MB */
|
||||||
|
15*1024*1024, /* 15MB */
|
||||||
|
32*1024*1024, /* 32MB */
|
||||||
|
64*1024*1024, /* 64MB */
|
||||||
|
75*1024*1024, /* 75MB */
|
||||||
|
100*1024*1024, /* 100MB */
|
||||||
|
128*1024*1024, /* 128MB */
|
||||||
|
256*1024*1024, /* 256MB */
|
||||||
|
512*1024*1024, /* 512MB */
|
||||||
|
650*1024*1024, /* 650MB */
|
||||||
|
700*1024*1024, /* 700MB */
|
||||||
|
1024*1024*1024, /* 1GB */
|
||||||
|
1536*1024*1024, /* 1.5GB */
|
||||||
|
1792*1024*1024, /* 1.75GB */
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned long rec_sizesplit_bytes(void)
|
||||||
|
{
|
||||||
|
return rec_size_bytes[global_settings.rec_sizesplit];
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Time strings used for the trigger durations.
|
* Time strings used for the trigger durations.
|
||||||
* Keep synchronous to trigger_times in settings_apply_trigger
|
* Keep synchronous to trigger_times in settings_apply_trigger
|
||||||
|
|
|
@ -249,6 +249,13 @@ struct user_settings
|
||||||
5 = 01:00, 6 = 02:00, 7 = 04:00, 8 = 06:00
|
5 = 01:00, 6 = 02:00, 7 = 04:00, 8 = 06:00
|
||||||
9 = 08:00, 10= 10:00, 11= 12:00, 12= 18:00,
|
9 = 08:00, 10= 10:00, 11= 12:00, 12= 18:00,
|
||||||
13= 24:00 */
|
13= 24:00 */
|
||||||
|
int rec_sizesplit; /* 0 = off,
|
||||||
|
1 = 5MB, 2 = 10MB, 3 = 15MB, 4 = 32MB
|
||||||
|
5 = 64MB, 6 = 75MB, 7 = 100MB, 8 = 128MB
|
||||||
|
9 = 256MB, 10= 512MB, 11= 650MB, 12= 700MB,
|
||||||
|
13= 1GB, 14 = 1.5GB 15 = 1.75MB*/
|
||||||
|
int rec_split_type; /* split/stop */
|
||||||
|
int rec_split_method; /* time/filesize */
|
||||||
|
|
||||||
int rec_prerecord_time; /* In seconds, 0-30, 0 means OFF */
|
int rec_prerecord_time; /* In seconds, 0-30, 0 means OFF */
|
||||||
int rec_directory; /* 0=base dir, 1=current dir */
|
int rec_directory; /* 0=base dir, 1=current dir */
|
||||||
|
@ -549,6 +556,7 @@ int read_line(int fd, char* buffer, int buffer_size);
|
||||||
void set_file(char* filename, char* setting, int maxlen);
|
void set_file(char* filename, char* setting, int maxlen);
|
||||||
|
|
||||||
unsigned int rec_timesplit_seconds(void);
|
unsigned int rec_timesplit_seconds(void);
|
||||||
|
unsigned long rec_sizesplit_bytes(void);
|
||||||
void settings_apply_trigger(void);
|
void settings_apply_trigger(void);
|
||||||
|
|
||||||
/* global settings */
|
/* global settings */
|
||||||
|
|
|
@ -366,11 +366,77 @@ static bool rectimesplit(void)
|
||||||
{ "18:00" , TALK_ID(18, UNIT_HOUR) },
|
{ "18:00" , TALK_ID(18, UNIT_HOUR) },
|
||||||
{ "24:00" , TALK_ID(24, UNIT_HOUR) }
|
{ "24:00" , TALK_ID(24, UNIT_HOUR) }
|
||||||
};
|
};
|
||||||
return set_option(str(LANG_RECORD_TIMESPLIT),
|
return set_option(str(LANG_SPLIT_TIME),
|
||||||
&global_settings.rec_timesplit, INT,
|
&global_settings.rec_timesplit, INT,
|
||||||
names, 16, NULL );
|
names, 16, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool recsizesplit(void)
|
||||||
|
{
|
||||||
|
static const struct opt_items names[] = {
|
||||||
|
{ STR(LANG_OFF) },
|
||||||
|
{ "5MB" , TALK_ID(5, UNIT_MB) },
|
||||||
|
{ "10MB" , TALK_ID(10, UNIT_MB) },
|
||||||
|
{ "15MB" , TALK_ID(15, UNIT_MB) },
|
||||||
|
{ "32MB" , TALK_ID(32, UNIT_MB) },
|
||||||
|
{ "64MB" , TALK_ID(64, UNIT_MB) },
|
||||||
|
{ "75MB" , TALK_ID(75, UNIT_MB) },
|
||||||
|
{ "100MB" , TALK_ID(100, UNIT_MB) },
|
||||||
|
{ "128MB" , TALK_ID(128, UNIT_MB) },
|
||||||
|
{ "256MB" , TALK_ID(256, UNIT_MB) },
|
||||||
|
{ "512MB" , TALK_ID(512, UNIT_MB) },
|
||||||
|
{ "650MB" , TALK_ID(650, UNIT_MB) },
|
||||||
|
{ "700MB" , TALK_ID(700, UNIT_MB) },
|
||||||
|
{ "1GB" , TALK_ID(1024, UNIT_MB) },
|
||||||
|
{ "1.5GB" , TALK_ID(1536, UNIT_MB) },
|
||||||
|
{ "1.75GB" , TALK_ID(1792, UNIT_MB) }
|
||||||
|
};
|
||||||
|
return set_option(str(LANG_SPLIT_SIZE),
|
||||||
|
&global_settings.rec_sizesplit, INT,
|
||||||
|
names, 16, NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool splitmethod(void)
|
||||||
|
{
|
||||||
|
static const struct opt_items names[] = {
|
||||||
|
{ STR(LANG_REC_TIME) },
|
||||||
|
{ STR(LANG_REC_SIZE) },
|
||||||
|
};
|
||||||
|
bool ret;
|
||||||
|
ret=set_option( str(LANG_SPLIT_MEASURE),
|
||||||
|
&global_settings.rec_split_method, INT, names, 2, NULL);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool splittype(void)
|
||||||
|
{
|
||||||
|
static const struct opt_items names[] = {
|
||||||
|
{ STR(LANG_START_NEW_FILE) },
|
||||||
|
{ STR(LANG_STOP_RECORDING) },
|
||||||
|
};
|
||||||
|
bool ret;
|
||||||
|
ret=set_option( str(LANG_SPLIT_TYPE),
|
||||||
|
&global_settings.rec_split_type, INT, names, 2, NULL);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool filesplitoptionsmenu(void)
|
||||||
|
{
|
||||||
|
int m;
|
||||||
|
bool result;
|
||||||
|
|
||||||
|
static const struct menu_item items[] = {
|
||||||
|
{ ID2P(LANG_SPLIT_MEASURE), splitmethod },
|
||||||
|
{ ID2P(LANG_SPLIT_TYPE), splittype },
|
||||||
|
{ ID2P(LANG_SPLIT_TIME), rectimesplit },
|
||||||
|
{ ID2P(LANG_SPLIT_SIZE), recsizesplit }
|
||||||
|
};
|
||||||
|
m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
result = menu_run(m);
|
||||||
|
menu_exit(m);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
static bool recprerecord(void)
|
static bool recprerecord(void)
|
||||||
{
|
{
|
||||||
static const struct opt_items names[] = {
|
static const struct opt_items names[] = {
|
||||||
|
@ -931,7 +997,7 @@ bool recording_menu(bool no_source)
|
||||||
items[i++].function = receditable;
|
items[i++].function = receditable;
|
||||||
#endif
|
#endif
|
||||||
items[i].desc = ID2P(LANG_RECORD_TIMESPLIT);
|
items[i].desc = ID2P(LANG_RECORD_TIMESPLIT);
|
||||||
items[i++].function = rectimesplit;
|
items[i++].function = filesplitoptionsmenu;
|
||||||
items[i].desc = ID2P(LANG_RECORD_PRERECORD_TIME);
|
items[i].desc = ID2P(LANG_RECORD_PRERECORD_TIME);
|
||||||
items[i++].function = recprerecord;
|
items[i++].function = recprerecord;
|
||||||
items[i].desc = ID2P(LANG_RECORD_DIRECTORY);
|
items[i].desc = ID2P(LANG_RECORD_DIRECTORY);
|
||||||
|
|
|
@ -40,6 +40,7 @@ enum {
|
||||||
UNIT_PIXEL, /* pixels */
|
UNIT_PIXEL, /* pixels */
|
||||||
UNIT_PER_SEC, /* per second */
|
UNIT_PER_SEC, /* per second */
|
||||||
UNIT_HERTZ, /* hertz */
|
UNIT_HERTZ, /* hertz */
|
||||||
|
UNIT_MB, /* Megabytes */
|
||||||
UNIT_LAST /* END MARKER */
|
UNIT_LAST /* END MARKER */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue