Recording trigger for software codec targets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11479 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
ad70a9b2e6
commit
d8103f3ba6
7 changed files with 308 additions and 108 deletions
|
@ -10144,3 +10144,55 @@
|
|||
*: "Bitrate"
|
||||
</voice>
|
||||
</phrase>
|
||||
<phrase>
|
||||
id: LANG_RECORD_TRIGGER_TYPE
|
||||
desc: in recording trigger menu
|
||||
<source>
|
||||
*: "Trigtype"
|
||||
</source>
|
||||
<dest>
|
||||
*: "Trigtype"
|
||||
</dest>
|
||||
<voice>
|
||||
*: "Trigtype"
|
||||
</voice>
|
||||
</phrase>
|
||||
<phrase>
|
||||
id: LANG_RECORD_TRIGGER_STOP
|
||||
desc: trigger types
|
||||
<source>
|
||||
*: "Stop"
|
||||
</source>
|
||||
<dest>
|
||||
*: "Stop"
|
||||
</dest>
|
||||
<voice>
|
||||
*: "Stop"
|
||||
</voice>
|
||||
</phrase>
|
||||
<phrase>
|
||||
id: LANG_RECORD_TRIGGER_PAUSE
|
||||
desc: trigger types
|
||||
<source>
|
||||
*: "Pause"
|
||||
</source>
|
||||
<dest>
|
||||
*: "Pause"
|
||||
</dest>
|
||||
<voice>
|
||||
*: "Pause"
|
||||
</voice>
|
||||
</phrase>
|
||||
<phrase>
|
||||
id: LANG_RECORD_TRIGGER_NEWFILESTP
|
||||
desc: trigger types
|
||||
<source>
|
||||
*: "New file"
|
||||
</source>
|
||||
<dest>
|
||||
*: "New file"
|
||||
</dest>
|
||||
<voice>
|
||||
*: "New file"
|
||||
</voice>
|
||||
</phrase>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "settings.h"
|
||||
#include "ata.h"
|
||||
#include "lcd.h"
|
||||
#include "widgets.h"
|
||||
#include "scrollbar.h"
|
||||
#include "gwps.h"
|
||||
#include "sprintf.h"
|
||||
#include "button.h"
|
||||
|
@ -593,25 +593,33 @@ void peak_meter_peek(void)
|
|||
pm_max_right = MAX(pm_max_right, right);
|
||||
|
||||
#ifdef HAVE_RECORDING
|
||||
#if CONFIG_CODEC == SWCODEC
|
||||
/* Ignore any unread peakmeter data */
|
||||
#define MAX_DROP_TIME HZ/7 /* this value may need tweaking. Increase if you are
|
||||
getting trig events when you shouldn't with
|
||||
trig_stp_hold = 0 */
|
||||
if (!trig_stp_hold)
|
||||
trig_stp_hold = MAX_DROP_TIME;
|
||||
#endif
|
||||
|
||||
switch (trig_status) {
|
||||
case TRIG_READY:
|
||||
/* no more changes, if trigger was activated as release trigger */
|
||||
/* threshold exceeded? */
|
||||
if ((left > trig_strt_threshold)
|
||||
|| (right > trig_strt_threshold)) {
|
||||
if (trig_strt_duration) {
|
||||
/* reset trigger duration */
|
||||
trig_hightime = current_tick;
|
||||
|
||||
/* reset dropout duration */
|
||||
trig_lowtime = current_tick;
|
||||
|
||||
if (trig_strt_duration)
|
||||
set_trig_status(TRIG_STEADY);
|
||||
else
|
||||
/* if trig_duration is set to 0 the user wants to start
|
||||
recording immediately */
|
||||
set_trig_status(TRIG_STEADY);
|
||||
} else {
|
||||
set_trig_status(TRIG_GO);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -652,7 +660,11 @@ void peak_meter_peek(void)
|
|||
|| (right > trig_stp_threshold)) {
|
||||
/* restart hold time countdown */
|
||||
trig_lowtime = current_tick;
|
||||
#if CONFIG_CODEC == SWCODEC
|
||||
} else if (current_tick - trig_lowtime > MAX_DROP_TIME){
|
||||
#else
|
||||
} else {
|
||||
#endif
|
||||
set_trig_status(TRIG_POSTREC);
|
||||
trig_hightime = current_tick;
|
||||
}
|
||||
|
@ -667,6 +679,7 @@ void peak_meter_peek(void)
|
|||
|
||||
set_trig_status(TRIG_RETRIG);
|
||||
trig_hightime = current_tick;
|
||||
trig_lowtime = current_tick;
|
||||
}
|
||||
else
|
||||
|
||||
|
@ -709,6 +722,11 @@ void peak_meter_peek(void)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#if CONFIG_CODEC == SWCODEC
|
||||
/* restore stop hold value */
|
||||
if (trig_stp_hold == MAX_DROP_TIME)
|
||||
trig_stp_hold = 0;
|
||||
#endif
|
||||
#endif
|
||||
/* check levels next time peakmeter drawn */
|
||||
level_check = true;
|
||||
|
@ -1153,55 +1171,81 @@ int peak_meter_trigger_status(void)
|
|||
return trig_status; /* & TRIG_PIT_MASK;*/
|
||||
}
|
||||
|
||||
void peak_meter_draw_trig(int xpos, int ypos)
|
||||
void peak_meter_draw_trig(int xpos[], int ypos[], int trig_width[], int nb_screens)
|
||||
{
|
||||
int barstart, barend;
|
||||
int icon, ixpos;
|
||||
int barstart[NB_SCREENS];
|
||||
int barend[NB_SCREENS];
|
||||
int icon;
|
||||
int ixpos[NB_SCREENS];
|
||||
int i;
|
||||
int trigbar_width[NB_SCREENS];
|
||||
|
||||
FOR_NB_SCREENS(i)
|
||||
trigbar_width[i] = (trig_width[i] - (2 * (ICON_PLAY_STATE_WIDTH + 1)));
|
||||
|
||||
switch (trig_status) {
|
||||
|
||||
case TRIG_READY:
|
||||
barstart = 0;
|
||||
barend = 0;
|
||||
FOR_NB_SCREENS(i){
|
||||
barstart[i] = 0;
|
||||
barend[i] = 0;
|
||||
}
|
||||
icon = Icon_Stop;
|
||||
ixpos = xpos;
|
||||
FOR_NB_SCREENS(i)
|
||||
ixpos[i] = xpos[i];
|
||||
break;
|
||||
|
||||
case TRIG_STEADY:
|
||||
case TRIG_RETRIG:
|
||||
barstart = 0;
|
||||
barend = TRIGBAR_WIDTH * (current_tick - trig_hightime)
|
||||
/ trig_strt_duration;
|
||||
case TRIG_RETRIG:
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
barstart[i] = 0;
|
||||
barend[i] = (trig_strt_duration == 0) ? trigbar_width[i] :
|
||||
trigbar_width[i] *
|
||||
(current_tick - trig_hightime) / trig_strt_duration;
|
||||
}
|
||||
icon = Icon_Stop;
|
||||
ixpos = xpos;
|
||||
FOR_NB_SCREENS(i)
|
||||
ixpos[i] = xpos[i];
|
||||
break;
|
||||
|
||||
case TRIG_GO:
|
||||
case TRIG_CONTINUE:
|
||||
barstart = TRIGBAR_WIDTH;
|
||||
barend = TRIGBAR_WIDTH;
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
barstart[i] = trigbar_width[i];
|
||||
barend[i] = trigbar_width[i];
|
||||
}
|
||||
icon = Icon_Record;
|
||||
ixpos = TRIG_WIDTH - ICON_PLAY_STATE_WIDTH;
|
||||
FOR_NB_SCREENS(i)
|
||||
ixpos[i] = xpos[i]+ trig_width[i] - ICON_PLAY_STATE_WIDTH;
|
||||
break;
|
||||
|
||||
case TRIG_POSTREC:
|
||||
barstart = TRIGBAR_WIDTH
|
||||
- TRIGBAR_WIDTH * (current_tick - trig_lowtime)
|
||||
/ trig_stp_hold;
|
||||
barend = TRIGBAR_WIDTH;
|
||||
case TRIG_POSTREC:
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
barstart[i] = (trig_stp_hold == 0) ? 0 :
|
||||
trigbar_width[i] - trigbar_width[i] *
|
||||
(current_tick - trig_lowtime) / trig_stp_hold;
|
||||
barend[i] = trigbar_width[i];
|
||||
}
|
||||
icon = Icon_Record;
|
||||
ixpos = TRIG_WIDTH - ICON_PLAY_STATE_WIDTH;
|
||||
FOR_NB_SCREENS(i)
|
||||
ixpos[i] = xpos[i] + trig_width[i] - ICON_PLAY_STATE_WIDTH;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
scrollbar(xpos + ICON_PLAY_STATE_WIDTH + 1, ypos + 1,
|
||||
TRIGBAR_WIDTH, TRIG_HEIGHT - 2,
|
||||
TRIGBAR_WIDTH, barstart, barend, HORIZONTAL);
|
||||
FOR_NB_SCREENS(i)
|
||||
|
||||
for(i = 0; i < nb_screens; i++)
|
||||
{
|
||||
screens[i].mono_bitmap(bitmap_icons_7x8[icon], ixpos, ypos,
|
||||
gui_scrollbar_draw(&screens[i], xpos[i] + ICON_PLAY_STATE_WIDTH + 1,
|
||||
ypos[i] + 1, trigbar_width[i], TRIG_HEIGHT - 2,
|
||||
trigbar_width[i], barstart[i], barend[i],
|
||||
HORIZONTAL);
|
||||
|
||||
screens[i].mono_bitmap(bitmap_icons_7x8[icon], ixpos[i], ypos[i],
|
||||
ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,14 +69,10 @@ extern void peak_meter_trigger(bool on);
|
|||
extern int peak_meter_trigger_status(void);
|
||||
extern void peak_meter_set_trigger_listener(void (*listener)(int status));
|
||||
|
||||
//#define TRIG_WIDTH 12
|
||||
//#define TRIG_HEIGHT 14
|
||||
|
||||
#define TRIG_WIDTH 112
|
||||
#define TRIG_HEIGHT 8
|
||||
#define TRIGBAR_WIDTH (TRIG_WIDTH - (2 * (ICON_PLAY_STATE_WIDTH + 1)))
|
||||
|
||||
extern void peak_meter_draw_trig(int x, int y);
|
||||
extern void peak_meter_draw_trig(int x[], int y[], int trig_width[],
|
||||
int nb_screens);
|
||||
|
||||
extern unsigned short peak_meter_range_min;
|
||||
extern unsigned short peak_meter_range_max;
|
||||
|
|
|
@ -801,9 +801,16 @@ static void trigger_listener(int trigger_status)
|
|||
/* if we're already recording this is a retrigger */
|
||||
else
|
||||
{
|
||||
rec_new_file();
|
||||
/* tell recording_screen to reset the time */
|
||||
last_seconds = 0;
|
||||
if((audio_status() & AUDIO_STATUS_PAUSE) &&
|
||||
(global_settings.rec_trigger_type == 1))
|
||||
audio_resume_recording();
|
||||
/* New file on trig start*/
|
||||
else if (global_settings.rec_trigger_type != 2)
|
||||
{
|
||||
rec_new_file();
|
||||
/* tell recording_screen to reset the time */
|
||||
last_seconds = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -811,7 +818,27 @@ static void trigger_listener(int trigger_status)
|
|||
case TRIG_READY:
|
||||
if(audio_status() & AUDIO_STATUS_RECORD)
|
||||
{
|
||||
audio_stop();
|
||||
switch(global_settings.rec_trigger_type)
|
||||
{
|
||||
case 0: /* Stop */
|
||||
#if CONFIG_CODEC == SWCODEC
|
||||
audio_stop_recording();
|
||||
#else
|
||||
audio_stop();
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 1: /* Pause */
|
||||
audio_pause_recording();
|
||||
break;
|
||||
|
||||
case 2: /* New file on trig stop*/
|
||||
rec_new_file();
|
||||
/* tell recording_screen to reset the time */
|
||||
last_seconds = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (global_settings.rec_trigger_mode != TRIG_MODE_REARM)
|
||||
{
|
||||
peak_meter_set_trigger_listener(NULL);
|
||||
|
@ -861,6 +888,9 @@ bool recording_screen(bool no_source)
|
|||
int i;
|
||||
int filename_offset[NB_SCREENS];
|
||||
int pm_y[NB_SCREENS];
|
||||
int trig_xpos[NB_SCREENS];
|
||||
int trig_ypos[NB_SCREENS];
|
||||
int trig_width[NB_SCREENS];
|
||||
|
||||
static const unsigned char *byte_units[] = {
|
||||
ID2P(LANG_BYTE),
|
||||
|
@ -1602,6 +1632,10 @@ bool recording_screen(bool no_source)
|
|||
line[i] = 3;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
line[i] = 5; /* to prevent uninitialisation
|
||||
warnings for line[0] */
|
||||
break;
|
||||
} /* end switch */
|
||||
#ifdef HAVE_AGC
|
||||
if (screens[i].height < h * (2 + filename_offset[i] + PM_HEIGHT + line[i]))
|
||||
|
@ -1747,12 +1781,28 @@ bool recording_screen(bool no_source)
|
|||
}
|
||||
|
||||
/* draw the trigger status */
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
trig_width[i] = ((screens[i].height < 64) ||
|
||||
((screens[i].height < 72) && (PM_HEIGHT > 1))) ?
|
||||
screens[i].width - 14 * w : screens[i].width;
|
||||
trig_xpos[i] = screens[i].width - trig_width[i];
|
||||
trig_ypos[i] = ((screens[i].height < 72) && (PM_HEIGHT > 1)) ?
|
||||
h*2 :
|
||||
h*(1 + filename_offset[i] + PM_HEIGHT + line[i]
|
||||
#ifdef HAVE_AGC
|
||||
+ 1
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
if (peak_meter_trigger_status() != TRIG_OFF)
|
||||
{
|
||||
peak_meter_draw_trig(LCD_WIDTH - TRIG_WIDTH, 4 * h);
|
||||
peak_meter_draw_trig(trig_xpos, trig_ypos, trig_width,
|
||||
screen_update);
|
||||
for(i = 0; i < screen_update; i++){
|
||||
screens[i].update_rect(LCD_WIDTH - (TRIG_WIDTH + 2), 4 * h,
|
||||
TRIG_WIDTH + 2, TRIG_HEIGHT);
|
||||
screens[i].update_rect(trig_xpos[i], trig_ypos[i],
|
||||
trig_width[i] + 2, TRIG_HEIGHT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -687,6 +687,9 @@ static const struct bit_entry hd_bits[] =
|
|||
|
||||
/* If values are just added to the end, no need to bump the version. */
|
||||
/* new stuff to be added at the end */
|
||||
#ifdef HAVE_RECORDING
|
||||
{2, S_O(rec_trigger_type), 0, "trigger type", "stop,pause,nf stp"},
|
||||
#endif
|
||||
|
||||
/* Sum of all bit sizes must not grow beyond 0xB8*8 = 1472 */
|
||||
};
|
||||
|
|
|
@ -193,6 +193,7 @@ struct user_settings
|
|||
int rec_stop_postrec; /* negative: db, positive: % range -87 .. 100 */
|
||||
int rec_stop_gap; /* index of trig_durations */
|
||||
int rec_trigger_mode; /* see TRIG_MODE_XXX constants */
|
||||
int rec_trigger_type; /* what to do when trigger released */
|
||||
|
||||
#ifdef HAVE_AGC
|
||||
int rec_agc_preset_mic; /* AGC mic preset modes:
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#ifdef HAVE_LCD_BITMAP
|
||||
#include "icons.h"
|
||||
#include "font.h"
|
||||
#include "widgets.h"
|
||||
#include "scrollbar.h"
|
||||
#endif
|
||||
#include "lang.h"
|
||||
#include "sprintf.h"
|
||||
|
@ -45,7 +45,7 @@
|
|||
#include "radio.h"
|
||||
#endif
|
||||
#endif
|
||||
#if CONFIG_CODEC == MAS3587F
|
||||
#ifdef HAVE_RECORDING
|
||||
#include "peakmeter.h"
|
||||
#include "mas.h"
|
||||
#endif
|
||||
|
@ -812,6 +812,7 @@ bool sound_menu(void)
|
|||
enum trigger_menu_option
|
||||
{
|
||||
TRIGGER_MODE,
|
||||
TRIGGER_TYPE,
|
||||
PRERECORD_TIME,
|
||||
START_THRESHOLD,
|
||||
START_DURATION,
|
||||
|
@ -821,7 +822,7 @@ enum trigger_menu_option
|
|||
TRIG_OPTION_COUNT,
|
||||
};
|
||||
|
||||
#if !defined(SIMULATOR) && CONFIG_CODEC == MAS3587F
|
||||
#ifdef HAVE_RECORDING
|
||||
static char* create_thres_str(int threshold)
|
||||
{
|
||||
static char retval[6];
|
||||
|
@ -864,17 +865,6 @@ static void change_threshold(int *threshold, int change)
|
|||
}
|
||||
}
|
||||
|
||||
/* Variable button definitions */
|
||||
#if CONFIG_KEYPAD == RECORDER_PAD
|
||||
#define TRIG_CANCEL BUTTON_OFF
|
||||
#define TRIG_ACCEPT BUTTON_PLAY
|
||||
#define TRIG_RESET_SIM BUTTON_F2
|
||||
|
||||
#elif CONFIG_KEYPAD == ONDIO_PAD
|
||||
#define TRIG_CANCEL BUTTON_OFF
|
||||
#define TRIG_ACCEPT BUTTON_MENU
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Displays a menu for editing the trigger settings.
|
||||
*/
|
||||
|
@ -883,7 +873,8 @@ bool rectrigger(void)
|
|||
int exit_request = false;
|
||||
enum trigger_menu_option selected = TRIGGER_MODE;
|
||||
bool retval = false;
|
||||
int old_x_margin, old_y_margin;
|
||||
int old_x_margin[NB_SCREENS];
|
||||
int old_y_margin[NB_SCREENS];
|
||||
|
||||
#define TRIGGER_MODE_COUNT 3
|
||||
static const unsigned char *trigger_modes[] = {
|
||||
|
@ -900,8 +891,16 @@ bool rectrigger(void)
|
|||
"30s"
|
||||
};
|
||||
|
||||
#define TRIGGER_TYPE_COUNT 3
|
||||
static const unsigned char *trigger_types[] = {
|
||||
ID2P(LANG_RECORD_TRIGGER_STOP),
|
||||
ID2P(LANG_RECORD_TRIGGER_PAUSE),
|
||||
ID2P(LANG_RECORD_TRIGGER_NEWFILESTP),
|
||||
};
|
||||
|
||||
static const unsigned char *option_name[] = {
|
||||
[TRIGGER_MODE] = ID2P(LANG_RECORD_TRIGGER_MODE),
|
||||
[TRIGGER_TYPE] = ID2P(LANG_RECORD_TRIGGER_TYPE),
|
||||
[PRERECORD_TIME] = ID2P(LANG_RECORD_PRERECORD_TIME),
|
||||
[START_THRESHOLD] = ID2P(LANG_RECORD_START_THRESHOLD),
|
||||
[START_DURATION] = ID2P(LANG_RECORD_MIN_DURATION),
|
||||
|
@ -917,37 +916,54 @@ bool rectrigger(void)
|
|||
int old_stop_postrec = global_settings.rec_stop_postrec;
|
||||
int old_stop_gap = global_settings.rec_stop_gap;
|
||||
int old_trigger_mode = global_settings.rec_trigger_mode;
|
||||
int old_trigger_type = global_settings.rec_trigger_type;
|
||||
|
||||
int offset = 0;
|
||||
int option_lines;
|
||||
int w, h;
|
||||
int offset[NB_SCREENS];
|
||||
int option_lines[NB_SCREENS];
|
||||
int w, h, i;
|
||||
int stat_height = global_settings.statusbar ? STATUSBAR_HEIGHT : 0;
|
||||
/* array for y ordinate of peak_meter_draw_get_button
|
||||
function in peakmeter.c*/
|
||||
int pm_y[NB_SCREENS];
|
||||
|
||||
int trig_xpos[NB_SCREENS];
|
||||
int trig_ypos[NB_SCREENS];
|
||||
int trig_width[NB_SCREENS];
|
||||
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
offset[i] = 0;
|
||||
trig_xpos[i] = 0;
|
||||
trig_ypos[i] = screens[i].height - stat_height - TRIG_HEIGHT;
|
||||
pm_y[i] = screens[i].height - stat_height;
|
||||
trig_width[i] = screens[i].width;
|
||||
}
|
||||
|
||||
/* restart trigger with new values */
|
||||
settings_apply_trigger();
|
||||
peak_meter_trigger (global_settings.rec_trigger_mode != TRIG_MODE_OFF);
|
||||
|
||||
lcd_clear_display();
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
screens[i].clear_display();
|
||||
|
||||
old_x_margin = lcd_getxmargin();
|
||||
old_y_margin = lcd_getymargin();
|
||||
if(global_settings.statusbar)
|
||||
lcd_setmargins(0, STATUSBAR_HEIGHT);
|
||||
else
|
||||
lcd_setmargins(0, 0);
|
||||
old_x_margin[i] = screens[i].getxmargin();
|
||||
old_y_margin[i] = screens[i].getymargin();
|
||||
if(global_settings.statusbar)
|
||||
screens[i].setmargins(0, STATUSBAR_HEIGHT);
|
||||
else
|
||||
screens[i].setmargins(0, 0);
|
||||
|
||||
lcd_getstringsize("M", &w, &h);
|
||||
screens[i].getstringsize("M", &w, &h);
|
||||
|
||||
/* 16 pixels are reserved for peak meter and trigger status */
|
||||
option_lines = (LCD_HEIGHT - 16 - stat_height) / h;
|
||||
// 16 pixels are reserved for peak meter and trigger status
|
||||
option_lines[i] = MIN(((screens[i].height) -
|
||||
stat_height - 16)/h,
|
||||
TRIG_OPTION_COUNT);
|
||||
}
|
||||
|
||||
while (!exit_request) {
|
||||
int button, i;
|
||||
int button, k;
|
||||
const char *str;
|
||||
char option_value[TRIG_OPTION_COUNT][7];
|
||||
char option_value[TRIG_OPTION_COUNT][9];
|
||||
|
||||
snprintf(
|
||||
option_value[TRIGGER_MODE],
|
||||
|
@ -955,6 +971,18 @@ bool rectrigger(void)
|
|||
"%s",
|
||||
P2STR(trigger_modes[global_settings.rec_trigger_mode]));
|
||||
|
||||
snprintf(
|
||||
option_value[TRIGGER_TYPE],
|
||||
sizeof option_value[TRIGGER_TYPE],
|
||||
"%s",
|
||||
P2STR(trigger_types[global_settings.rec_trigger_type]));
|
||||
|
||||
snprintf(
|
||||
option_value[TRIGGER_TYPE],
|
||||
sizeof option_value[TRIGGER_TYPE],
|
||||
"%s",
|
||||
P2STR(trigger_types[global_settings.rec_trigger_type]));
|
||||
|
||||
snprintf (
|
||||
option_value[PRERECORD_TIME],
|
||||
sizeof option_value[PRERECORD_TIME],
|
||||
|
@ -1003,41 +1031,51 @@ bool rectrigger(void)
|
|||
"%s",
|
||||
trig_durations[global_settings.rec_stop_gap]);
|
||||
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
screens[i].set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
||||
screens[i].fillrect(0, stat_height, screens[i].width,
|
||||
screens[i].height - stat_height);
|
||||
screens[i].set_drawmode(DRMODE_SOLID);
|
||||
}
|
||||
|
||||
gui_syncstatusbar_draw(&statusbars, true);
|
||||
|
||||
/* reselect FONT_SYSFONT as status_draw has changed the font */
|
||||
/*lcd_setfont(FONT_SYSFIXED);*/
|
||||
|
||||
for (i = 0; i < option_lines; i++) {
|
||||
int x, y;
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
for (k = 0; k < option_lines[i]; k++) {
|
||||
int x, y;
|
||||
|
||||
str = P2STR(option_name[i + offset]);
|
||||
lcd_putsxy(5, stat_height + i * h, str);
|
||||
str = P2STR(option_name[k + offset[i]]);
|
||||
screens[i].putsxy((option_lines[i] < TRIG_OPTION_COUNT) ? 5 : 0,
|
||||
stat_height + k * h, str);
|
||||
|
||||
str = option_value[i + offset];
|
||||
lcd_getstringsize(str, &w, NULL);
|
||||
y = stat_height + i * h;
|
||||
x = LCD_WIDTH - w;
|
||||
lcd_putsxy(x, y, str);
|
||||
if ((int)selected == (i + offset)) {
|
||||
lcd_set_drawmode(DRMODE_COMPLEMENT);
|
||||
lcd_fillrect(x, y, w, h);
|
||||
lcd_set_drawmode(DRMODE_SOLID);
|
||||
str = option_value[k + offset[i]];
|
||||
screens[i].getstringsize(str, &w, &h);
|
||||
y = stat_height + k * h;
|
||||
x = screens[i].width - w;
|
||||
screens[i].putsxy(x, y, str);
|
||||
if ((int)selected == (k + offset[i])) {
|
||||
screens[i].set_drawmode(DRMODE_COMPLEMENT);
|
||||
screens[i].fillrect(x, y, w, h);
|
||||
screens[i].set_drawmode(DRMODE_SOLID);
|
||||
}
|
||||
}
|
||||
if (option_lines[i] < TRIG_OPTION_COUNT)
|
||||
gui_scrollbar_draw(&screens[i], 0, stat_height,
|
||||
4, screens[i].height - 16 - stat_height,
|
||||
TRIG_OPTION_COUNT, offset[i], offset[i] + option_lines[i],
|
||||
VERTICAL);
|
||||
}
|
||||
|
||||
scrollbar(0, stat_height,
|
||||
4, option_lines * h,
|
||||
TRIG_OPTION_COUNT, offset, offset + option_lines,
|
||||
VERTICAL);
|
||||
|
||||
peak_meter_draw_trig(0, LCD_HEIGHT - 8 - TRIG_HEIGHT);
|
||||
|
||||
FOR_NB_SCREENS(i)
|
||||
pm_y[i] = screens[i].height - 8;
|
||||
peak_meter_draw_trig(trig_xpos, trig_ypos, trig_width, NB_SCREENS);
|
||||
button = peak_meter_draw_get_btn(0, pm_y, 8, NB_SCREENS);
|
||||
|
||||
lcd_update();
|
||||
FOR_NB_SCREENS(i)
|
||||
screens[i].update();
|
||||
|
||||
switch (button) {
|
||||
case ACTION_STD_CANCEL:
|
||||
|
@ -1049,6 +1087,7 @@ bool rectrigger(void)
|
|||
global_settings.rec_stop_postrec = old_stop_postrec;
|
||||
global_settings.rec_stop_gap = old_stop_gap;
|
||||
global_settings.rec_trigger_mode = old_trigger_mode;
|
||||
global_settings.rec_trigger_type = old_trigger_type;
|
||||
exit_request = true;
|
||||
break;
|
||||
|
||||
|
@ -1059,15 +1098,21 @@ bool rectrigger(void)
|
|||
case ACTION_STD_PREV:
|
||||
selected += TRIG_OPTION_COUNT - 1;
|
||||
selected %= TRIG_OPTION_COUNT;
|
||||
offset = MIN(offset, (int)selected);
|
||||
offset = MAX(offset, (int)selected - option_lines + 1);
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
offset[i] = MIN(offset[i], (int)selected);
|
||||
offset[i] = MAX(offset[i], (int)selected - option_lines[i] + 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case ACTION_STD_NEXT:
|
||||
selected ++;
|
||||
selected %= TRIG_OPTION_COUNT;
|
||||
offset = MIN(offset, (int)selected);
|
||||
offset = MAX(offset, (int)selected - option_lines + 1);
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
offset[i] = MIN(offset[i], (int)selected);
|
||||
offset[i] = MAX(offset[i], (int)selected - option_lines[i] + 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case ACTION_SETTINGS_INC:
|
||||
|
@ -1077,6 +1122,11 @@ bool rectrigger(void)
|
|||
global_settings.rec_trigger_mode %= TRIGGER_MODE_COUNT;
|
||||
break;
|
||||
|
||||
case TRIGGER_TYPE:
|
||||
global_settings.rec_trigger_type ++;
|
||||
global_settings.rec_trigger_type %= TRIGGER_TYPE_COUNT;
|
||||
break;
|
||||
|
||||
case PRERECORD_TIME:
|
||||
global_settings.rec_prerecord_time ++;
|
||||
global_settings.rec_prerecord_time %= PRERECORD_TIMES_COUNT;
|
||||
|
@ -1120,6 +1170,11 @@ bool rectrigger(void)
|
|||
global_settings.rec_trigger_mode %= TRIGGER_MODE_COUNT;
|
||||
break;
|
||||
|
||||
case TRIGGER_TYPE:
|
||||
global_settings.rec_trigger_type+=TRIGGER_TYPE_COUNT-1;
|
||||
global_settings.rec_trigger_type %= TRIGGER_TYPE_COUNT;
|
||||
break;
|
||||
|
||||
case PRERECORD_TIME:
|
||||
global_settings.rec_prerecord_time += PRERECORD_TIMES_COUNT - 1;
|
||||
global_settings.rec_prerecord_time %= PRERECORD_TIMES_COUNT;
|
||||
|
@ -1159,11 +1214,9 @@ bool rectrigger(void)
|
|||
settings_apply_trigger();
|
||||
break;
|
||||
|
||||
#ifdef TRIG_RESET_SIM
|
||||
case ACTION_REC_F2:
|
||||
peak_meter_trigger(true);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case SYS_USB_CONNECTED:
|
||||
if(default_event_handler(button) == SYS_USB_CONNECTED) {
|
||||
|
@ -1175,8 +1228,11 @@ bool rectrigger(void)
|
|||
}
|
||||
|
||||
peak_meter_trigger(false);
|
||||
lcd_setfont(FONT_UI);
|
||||
lcd_setmargins(old_x_margin, old_y_margin);
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
screens[i].setfont(FONT_UI);
|
||||
screens[i].setmargins(old_x_margin[i], old_y_margin[i]);
|
||||
}
|
||||
action_signalscreenchange();
|
||||
return retval;
|
||||
}
|
||||
|
@ -1205,9 +1261,7 @@ bool recording_menu(bool no_source)
|
|||
#ifdef CONFIG_BACKLIGHT
|
||||
{ ID2P(LANG_CLIP_LIGHT), cliplight },
|
||||
#endif
|
||||
#if !defined(SIMULATOR) && CONFIG_CODEC == MAS3587F
|
||||
{ ID2P(LANG_RECORD_TRIGGER), rectrigger },
|
||||
#endif
|
||||
#ifdef HAVE_AGC
|
||||
{ ID2P(LANG_RECORD_AGC_PRESET), agc_preset },
|
||||
{ ID2P(LANG_RECORD_AGC_CLIPTIME), agc_cliptime },
|
||||
|
|
Loading…
Reference in a new issue