summaryrefslogtreecommitdiffstats
path: root/apps/recorder
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder')
-rw-r--r--apps/recorder/peakmeter.c104
-rw-r--r--apps/recorder/peakmeter.h8
-rw-r--r--apps/recorder/recording.c64
3 files changed, 133 insertions, 43 deletions
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c
index 44be43124a..1033ffee67 100644
--- a/apps/recorder/peakmeter.c
+++ b/apps/recorder/peakmeter.c
@@ -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);
}
}
diff --git a/apps/recorder/peakmeter.h b/apps/recorder/peakmeter.h
index 548b95b7da..a521f975fa 100644
--- a/apps/recorder/peakmeter.h
+++ b/apps/recorder/peakmeter.h
@@ -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;
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 6a053cd12e..d38856db23 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -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);
}
}
}