1
0
Fork 0
forked from len0rd/rockbox

Support the recording screen on the LCD remote. Also adds support for the peakmeter in the rremote WPS. Patch from Martin Scarratt (task 4818).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9246 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dan Everton 2006-03-25 13:35:31 +00:00
parent 2b71fa855d
commit b66477adcc
8 changed files with 256 additions and 137 deletions

View file

@ -1750,7 +1750,7 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
#endif #endif
update_line = true; update_line = true;
} }
if (flags & refresh_mode & WPS_REFRESH_PEAK_METER && display->height >= LCD_HEIGHT) { if (flags & refresh_mode & WPS_REFRESH_PEAK_METER) {
/* peak meter */ /* peak meter */
int peak_meter_y; int peak_meter_y;
@ -1761,12 +1761,12 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
line so that it is only displayed if no status bar is line so that it is only displayed if no status bar is
visible. If so we neither want do draw nor enable the visible. If so we neither want do draw nor enable the
peak meter. */ peak meter. */
if (peak_meter_y + h <= LCD_HEIGHT) { if (peak_meter_y + h <= display->height) {
/* found a line with a peak meter -> remember that we must /* found a line with a peak meter -> remember that we must
enable it later */ enable it later */
enable_pm = true; enable_pm = true;
peak_meter_draw(0, peak_meter_y, LCD_WIDTH, peak_meter_screen(gwps->display, 0, peak_meter_y,
MIN(h, LCD_HEIGHT - peak_meter_y)); MIN(h, display->height - peak_meter_y));
} }
} }
#else #else

View file

@ -26,12 +26,14 @@
void screen_put_iconxy(struct screen * display, int x, int y, ICON icon) void screen_put_iconxy(struct screen * display, int x, int y, ICON icon)
{ {
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
int width, height;
int xpos, ypos; int xpos, ypos;
display->getstringsize((unsigned char *)"M", &width, &height);
xpos = x*CURSOR_WIDTH; xpos = x*CURSOR_WIDTH;
ypos = y*display->char_height + display->getymargin(); ypos = y*height + display->getymargin();
if ( display->char_height > CURSOR_HEIGHT )/* center the cursor */ if ( height > CURSOR_HEIGHT )/* center the cursor */
ypos += (display->char_height - CURSOR_HEIGHT) / 2; ypos += (height - CURSOR_HEIGHT) / 2;
if(icon==0)/* Don't display invalid icons */ if(icon==0)/* Don't display invalid icons */
screen_clear_area(display, xpos, ypos, CURSOR_WIDTH, CURSOR_HEIGHT); screen_clear_area(display, xpos, ypos, CURSOR_WIDTH, CURSOR_HEIGHT);
else else

View file

@ -939,13 +939,13 @@ new:
id: LANG_RECORDING_LEFT id: LANG_RECORDING_LEFT
desc: in the recording screen desc: in the recording screen
eng: "Gain Left" eng: "Gain L"
voice: "" voice: ""
new: new:
id: LANG_RECORDING_RIGHT id: LANG_RECORDING_RIGHT
desc: in the recording screen desc: in the recording screen
eng: "Gain Right" eng: "Gain R"
voice: "" voice: ""
new: new:

View file

@ -33,6 +33,7 @@
#include "lang.h" #include "lang.h"
#include "peakmeter.h" #include "peakmeter.h"
#include "audio.h" #include "audio.h"
#include "screen_access.h"
#ifdef CONFIG_BACKLIGHT #ifdef CONFIG_BACKLIGHT
#include "backlight.h" #include "backlight.h"
#endif #endif
@ -48,6 +49,8 @@ static bool pm_playback = true; /* selects between playback and recording peaks
#endif #endif
struct meter_scales scales[NB_SCREENS];
#if !defined(SIMULATOR) && CONFIG_CODEC != SWCODEC #if !defined(SIMULATOR) && CONFIG_CODEC != SWCODEC
/* Data source */ /* Data source */
static int pm_src_left = MAS_REG_DQPEAK_L; static int pm_src_left = MAS_REG_DQPEAK_L;
@ -60,12 +63,6 @@ static int pm_cur_right;
static int pm_max_left; /* maximum values between peak meter draws */ static int pm_max_left; /* maximum values between peak meter draws */
static int pm_max_right; static int pm_max_right;
/* Peak hold */
static int pm_peak_left; /* buffered peak values */
static int pm_peak_right;
static long pm_peak_timeout_l; /* peak hold timeouts */
static long pm_peak_timeout_r;
/* Clip hold */ /* Clip hold */
static bool pm_clip_left = false; /* when true a clip has occurred */ static bool pm_clip_left = false; /* when true a clip has occurred */
static bool pm_clip_right = false; static bool pm_clip_right = false;
@ -82,6 +79,7 @@ unsigned short peak_meter_range_min; /* minimum of range in samples */
unsigned short peak_meter_range_max; /* maximum of range in samples */ unsigned short peak_meter_range_max; /* maximum of range in samples */
static unsigned short pm_range; /* range width in samples */ static unsigned short pm_range; /* range width in samples */
static bool pm_use_dbfs = true; /* true if peakmeter displays dBfs */ static bool pm_use_dbfs = true; /* true if peakmeter displays dBfs */
bool level_check; /* true if peeked at peakmeter before drawing */
static unsigned short pm_db_min = 0; /* minimum of range in 1/100 dB */ static unsigned short pm_db_min = 0; /* minimum of range in 1/100 dB */
static unsigned short pm_db_max = 9000; /* maximum of range in 1/100 dB */ static unsigned short pm_db_max = 9000; /* maximum of range in 1/100 dB */
static unsigned short pm_db_range = 9000; /* range width in 1/100 dB */ static unsigned short pm_db_range = 9000; /* range width in 1/100 dB */
@ -140,7 +138,6 @@ static const long clip_time_out[] = {
/* precalculated peak values that represent magical /* precalculated peak values that represent magical
dBfs values. Used to draw the scale */ dBfs values. Used to draw the scale */
#define DB_SCALE_SRC_VALUES_SIZE 12
static const int db_scale_src_values[DB_SCALE_SRC_VALUES_SIZE] = { static const int db_scale_src_values[DB_SCALE_SRC_VALUES_SIZE] = {
32752, /* 0 db */ 32752, /* 0 db */
22784, /* - 3 db */ 22784, /* - 3 db */
@ -158,15 +155,6 @@ static const int db_scale_src_values[DB_SCALE_SRC_VALUES_SIZE] = {
static int db_scale_count = DB_SCALE_SRC_VALUES_SIZE; static int db_scale_count = DB_SCALE_SRC_VALUES_SIZE;
/* if db_scale_valid is false the content of
db_scale_lcd_coord needs recalculation */
static bool db_scale_valid = false;
/* contains the lcd x coordinates of the magical
scale values in db_scale_src_values */
static int db_scale_lcd_coord[sizeof db_scale_src_values / sizeof (int)];
/** /**
* Calculates dB Value for the peak meter, uses peak value as input * Calculates dB Value for the peak meter, uses peak value as input
* @param int sample - The input value * @param int sample - The input value
@ -368,7 +356,9 @@ void peak_meter_set_min(int newmin)
pm_db_min = calc_db(peak_meter_range_min); pm_db_min = calc_db(peak_meter_range_min);
pm_db_range = pm_db_max - pm_db_min; pm_db_range = pm_db_max - pm_db_min;
db_scale_valid = false; int i;
FOR_NB_SCREENS(i)
scales[i].db_scale_valid = false;
} }
/** /**
@ -410,7 +400,9 @@ void peak_meter_set_max(int newmax)
pm_db_max = calc_db(peak_meter_range_max); pm_db_max = calc_db(peak_meter_range_max);
pm_db_range = pm_db_max - pm_db_min; pm_db_range = pm_db_max - pm_db_min;
db_scale_valid = false; int i;
FOR_NB_SCREENS(i)
scales[i].db_scale_valid = false;
} }
/** /**
@ -449,8 +441,10 @@ bool peak_meter_get_use_dbfs(void)
*/ */
void peak_meter_set_use_dbfs(bool use) void peak_meter_set_use_dbfs(bool use)
{ {
int i;
pm_use_dbfs = use; pm_use_dbfs = use;
db_scale_valid = false; FOR_NB_SCREENS(i)
scales[i].db_scale_valid = false;
} }
/** /**
@ -713,7 +707,8 @@ void peak_meter_peek(void)
break; break;
} }
#endif #endif
/* check levels next time peakmeter drawn */
level_check = true;
#ifdef PM_DEBUG #ifdef PM_DEBUG
peek_calls++; peek_calls++;
#endif #endif
@ -816,23 +811,27 @@ unsigned short peak_meter_scale_value(unsigned short val, int meterwidth)
} }
return retval; return retval;
} }
void peak_meter_screen(struct screen *display, int x, int y, int height)
{
peak_meter_draw(display, &scales[display->screen_type], x, y,
display->width, height);
}
/** /**
* Draws a peak meter in the specified size at the specified position. * Draws a peak meter in the specified size at the specified position.
* @param int x - The x coordinate. * @param int x - The x coordinate.
* Make sure that 0 <= x and x + width < LCD_WIDTH * Make sure that 0 <= x and x + width < display->width
* @param int y - The y coordinate. * @param int y - The y coordinate.
* Make sure that 0 <= y and y + height < LCD_HEIGHT * Make sure that 0 <= y and y + height < display->height
* @param int width - The width of the peak meter. Note that for display * @param int width - The width of the peak meter. Note that for display
* of clips a 3 pixel wide area is used -> * of clips a 3 pixel wide area is used ->
* width > 3 * width > 3
* @param int height - The height of the peak meter. height > 3 * @param int height - The height of the peak meter. height > 3
*/ */
void peak_meter_draw(int x, int y, int width, int height) void peak_meter_draw(struct screen *display, struct meter_scales *scales,
int x, int y, int width, int height)
{ {
static int left_level = 0, right_level = 0;
int left = 0, right = 0; int left = 0, right = 0;
static int last_left = 0, last_right = 0;
int meterwidth = width - 3; int meterwidth = width - 3;
int i; int i;
@ -844,17 +843,21 @@ void peak_meter_draw(int x, int y, int width, int height)
/* if disabled only draw the peak meter */ /* if disabled only draw the peak meter */
if (peak_meter_enabled) { if (peak_meter_enabled) {
/* read the volume info from MAS */
left = peak_meter_read_l(); if (level_check){
right = peak_meter_read_r(); /* only read the volume info from MAS if peek since last read*/
left_level = peak_meter_read_l();
right_level = peak_meter_read_r();
level_check = false;
}
/* scale the samples dBfs */ /* scale the samples dBfs */
left = peak_meter_scale_value(left, meterwidth); left = peak_meter_scale_value(left_level, meterwidth);
right = peak_meter_scale_value(right, meterwidth); right = peak_meter_scale_value(right_level, meterwidth);
/* if the scale has changed -> recalculate the scale /*if the scale has changed -> recalculate the scale
(The scale becomes invalid when the range changed.) */ (The scale becomes invalid when the range changed.) */
if (!db_scale_valid){ if (!scales->db_scale_valid){
if (pm_use_dbfs) { if (pm_use_dbfs) {
db_scale_count = DB_SCALE_SRC_VALUES_SIZE; db_scale_count = DB_SCALE_SRC_VALUES_SIZE;
@ -862,7 +865,7 @@ void peak_meter_draw(int x, int y, int width, int height)
/* find the real x-coords for predefined interesting /* find the real x-coords for predefined interesting
dBfs values. These only are recalculated when the dBfs values. These only are recalculated when the
scaling of the meter changed. */ scaling of the meter changed. */
db_scale_lcd_coord[i] = scales->db_scale_lcd_coord[i] =
peak_meter_scale_value( peak_meter_scale_value(
db_scale_src_values[i], db_scale_src_values[i],
meterwidth - 1); meterwidth - 1);
@ -873,7 +876,7 @@ void peak_meter_draw(int x, int y, int width, int height)
else { else {
db_scale_count = 10; db_scale_count = 10;
for (i = 0; i < db_scale_count; i++) { for (i = 0; i < db_scale_count; i++) {
db_scale_lcd_coord[i] = scales->db_scale_lcd_coord[i] =
(i * (MAX_PEAK / 10) - peak_meter_range_min) * (i * (MAX_PEAK / 10) - peak_meter_range_min) *
meterwidth / pm_range; meterwidth / pm_range;
} }
@ -881,20 +884,20 @@ void peak_meter_draw(int x, int y, int width, int height)
/* mark scale valid to avoid recalculating dBfs values /* mark scale valid to avoid recalculating dBfs values
of the scale. */ of the scale. */
db_scale_valid = true; scales->db_scale_valid = true;
} }
/* apply release */ /* apply release */
left = MAX(left , last_left - pm_peak_release); left = MAX(left , scales->last_left - pm_peak_release);
right = MAX(right, last_right - pm_peak_release); right = MAX(right, scales->last_right - pm_peak_release);
/* reset max values after timeout */ /* reset max values after timeout */
if (TIME_AFTER(current_tick, pm_peak_timeout_l)){ if (TIME_AFTER(current_tick, scales->pm_peak_timeout_l)){
pm_peak_left = 0; scales->pm_peak_left = 0;
} }
if (TIME_AFTER(current_tick, pm_peak_timeout_r)){ if (TIME_AFTER(current_tick, scales->pm_peak_timeout_r)){
pm_peak_right = 0; scales->pm_peak_right = 0;
} }
if (!pm_clip_eternal) { if (!pm_clip_eternal) {
@ -910,51 +913,51 @@ void peak_meter_draw(int x, int y, int width, int height)
} }
/* check for new max values */ /* check for new max values */
if (left > pm_peak_left) { if (left > scales->pm_peak_left) {
pm_peak_left = left - 1; scales->pm_peak_left = left - 1;
pm_peak_timeout_l = scales->pm_peak_timeout_l =
current_tick + peak_time_out[pm_peak_hold]; current_tick + peak_time_out[pm_peak_hold];
} }
if (right > pm_peak_right) { if (right > scales->pm_peak_right) {
pm_peak_right = right - 1; scales->pm_peak_right = right - 1;
pm_peak_timeout_r = scales->pm_peak_timeout_r =
current_tick + peak_time_out[pm_peak_hold]; current_tick + peak_time_out[pm_peak_hold];
} }
} }
/* draw the peak meter */ /* draw the peak meter */
lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
lcd_fillrect(x, y, width, height); display->fillrect(x, y, width, height);
lcd_set_drawmode(DRMODE_SOLID); display->set_drawmode(DRMODE_SOLID);
/* draw left */ /* draw left */
lcd_fillrect (x, y, left, height / 2 - 2 ); display->fillrect (x, y, left, height / 2 - 2 );
if (pm_peak_left > 0) { if (scales->pm_peak_left > 0) {
lcd_vline(x + pm_peak_left, y, y + height / 2 - 2 ); display->vline(x + scales->pm_peak_left, y, y + height / 2 - 2 );
} }
if (pm_clip_left) { if (pm_clip_left) {
lcd_fillrect(x + meterwidth, y, 3, height / 2 - 1); display->fillrect(x + meterwidth, y, 3, height / 2 - 1);
} }
/* draw right */ /* draw right */
lcd_fillrect(x, y + height / 2 + 1, right, height / 2 - 2); display->fillrect(x, y + height / 2 + 1, right, height / 2 - 2);
if (pm_peak_right > 0) { if (scales->pm_peak_right > 0) {
lcd_vline( x + pm_peak_right, y + height / 2, y + height - 2); display->vline( x + scales->pm_peak_right, y + height / 2, y + height - 2);
} }
if (pm_clip_right) { if (pm_clip_right) {
lcd_fillrect(x + meterwidth, y + height / 2, 3, height / 2 - 1); display->fillrect(x + meterwidth, y + height / 2, 3, height / 2 - 1);
} }
/* draw scale end */ /* draw scale end */
lcd_vline(x + meterwidth, y, y + height - 2); display->vline(x + meterwidth, y, y + height - 2);
lcd_set_drawmode(DRMODE_COMPLEMENT); display->set_drawmode(DRMODE_COMPLEMENT);
/* draw dots for scale marks */ /* draw dots for scale marks */
for (i = 0; i < db_scale_count; i++) { for (i = 0; i < db_scale_count; i++) {
/* The x-coordinates of interesting scale mark points /* The x-coordinates of interesting scale mark points
have been calculated before */ have been calculated before */
lcd_drawpixel(db_scale_lcd_coord[i], y + height / 2 - 1); display->drawpixel(scales->db_scale_lcd_coord[i], y + height / 2 - 1);
} }
#ifdef HAVE_RECORDING #ifdef HAVE_RECORDING
@ -988,25 +991,25 @@ void peak_meter_draw(int x, int y, int width, int height)
if (trig_status != TRIG_OFF) { if (trig_status != TRIG_OFF) {
int start_trigx, stop_trigx, ycenter; int start_trigx, stop_trigx, ycenter;
lcd_set_drawmode(DRMODE_SOLID); display->set_drawmode(DRMODE_SOLID);
ycenter = y + height / 2; ycenter = y + height / 2;
/* display threshold value */ /* display threshold value */
start_trigx = x+peak_meter_scale_value(trig_strt_threshold,meterwidth); start_trigx = x+peak_meter_scale_value(trig_strt_threshold,meterwidth);
lcd_vline(start_trigx, ycenter - 2, ycenter); display->vline(start_trigx, ycenter - 2, ycenter);
start_trigx ++; start_trigx ++;
if (start_trigx < LCD_WIDTH) lcd_drawpixel(start_trigx, ycenter - 1); if (start_trigx < display->width ) display->drawpixel(start_trigx, ycenter - 1);
stop_trigx = x + peak_meter_scale_value(trig_stp_threshold,meterwidth); stop_trigx = x + peak_meter_scale_value(trig_stp_threshold,meterwidth);
lcd_vline(stop_trigx, ycenter - 2, ycenter); display->vline(stop_trigx, ycenter - 2, ycenter);
if (stop_trigx > 0) lcd_drawpixel(stop_trigx - 1, ycenter - 1); if (stop_trigx > 0) display->drawpixel(stop_trigx - 1, ycenter - 1);
} }
#endif /*HAVE_RECORDING*/ #endif /*HAVE_RECORDING*/
#ifdef PM_DEBUG #ifdef PM_DEBUG
/* display a bar to show how many calls to peak_meter_peek /* display a bar to show how many calls to peak_meter_peek
have ocurred since the last display */ have ocurred since the last display */
lcd_set_drawmode(DRMODE_COMPLEMENT); display->set_drawmode(DRMODE_COMPLEMENT);
lcd_fillrect(x, y, tmp, 3); display->fillrect(x, y, tmp, 3);
if (tmp < PEEKS_PER_DRAW_SIZE) { if (tmp < PEEKS_PER_DRAW_SIZE) {
peeks_per_redraw[tmp]++; peeks_per_redraw[tmp]++;
@ -1019,14 +1022,14 @@ void peak_meter_draw(int x, int y, int width, int height)
/* display a bar to show how many ticks have passed since /* display a bar to show how many ticks have passed since
the last redraw */ the last redraw */
lcd_fillrect(x, y + height / 2, current_tick - pm_tick, 2); display->fillrect(x, y + height / 2, current_tick - pm_tick, 2);
pm_tick = current_tick; pm_tick = current_tick;
#endif #endif
last_left = left; scales->last_left = left;
last_right = right; scales->last_right = right;
lcd_set_drawmode(DRMODE_SOLID); display->set_drawmode(DRMODE_SOLID);
} }
#ifdef HAVE_RECORDING #ifdef HAVE_RECORDING
@ -1171,11 +1174,12 @@ void peak_meter_draw_trig(int xpos, int ypos)
} }
#endif #endif
int peak_meter_draw_get_btn(int x, int y, int width, int height) int peak_meter_draw_get_btn(int x, int y, int height)
{ {
int button = BUTTON_NONE; int button = BUTTON_NONE;
long next_refresh = current_tick; long next_refresh = current_tick;
long next_big_refresh = current_tick + HZ / 10; long next_big_refresh = current_tick + HZ / 10;
int i;
#ifndef SIMULATOR #ifndef SIMULATOR
bool highperf = !ata_disk_is_active(); bool highperf = !ata_disk_is_active();
#else #else
@ -1196,8 +1200,11 @@ int peak_meter_draw_get_btn(int x, int y, int width, int height)
sleep(0); /* Sleep until end of current tick. */ sleep(0); /* Sleep until end of current tick. */
} }
if (TIME_AFTER(current_tick, next_refresh)) { if (TIME_AFTER(current_tick, next_refresh)) {
peak_meter_draw(x, y, width, height); FOR_NB_SCREENS(i)
lcd_update_rect(x, y, width, height); {
peak_meter_screen(&screens[i], x, y, height);
screens[i].update_rect(x, y, screens[i].width, height);
}
next_refresh += HZ / PEAK_METER_FPS; next_refresh += HZ / PEAK_METER_FPS;
dopeek = true; dopeek = true;
} }

View file

@ -29,8 +29,7 @@ extern bool peak_meter_histogram(void);
extern bool peak_meter_enabled; extern bool peak_meter_enabled;
extern void peak_meter_playback(bool playback); extern void peak_meter_playback(bool playback);
extern void peak_meter_draw(int x, int y, int width, int height); extern int peak_meter_draw_get_btn(int x, int y, int height);
extern int peak_meter_draw_get_btn(int x, int y, int width, int height);
extern void peak_meter_set_clip_hold(int time); extern void peak_meter_set_clip_hold(int time);
extern void peak_meter_peek(void); extern void peak_meter_peek(void);
extern void peak_meter_init_range( bool dbfs, int range_min, int range_max); extern void peak_meter_init_range( bool dbfs, int range_min, int range_max);
@ -80,4 +79,24 @@ extern void peak_meter_draw_trig(int x, int y);
extern unsigned short peak_meter_range_min; extern unsigned short peak_meter_range_min;
extern unsigned short peak_meter_range_max; extern unsigned short peak_meter_range_max;
#define DB_SCALE_SRC_VALUES_SIZE 12
struct meter_scales{
/* buffered peak values */
int pm_peak_left;
int pm_peak_right;
/* if db_scale_valid is false the content of
db_scale_lcd_coord needs recalculation */
bool db_scale_valid;
/* contains the lcd x coordinates of the magical
scale values in db_scale_src_values */
int db_scale_lcd_coord[DB_SCALE_SRC_VALUES_SIZE];
int last_left;
int last_right;
/* peak hold timeouts */
long pm_peak_timeout_l;
long pm_peak_timeout_r;
};
extern void peak_meter_draw(struct screen *display, struct meter_scales *meter_scales,
int x, int y, int width, int height);
extern void peak_meter_screen(struct screen *display, int x, int y, int height);
#endif /* __PEAKMETER_H__ */ #endif /* __PEAKMETER_H__ */

View file

@ -768,11 +768,17 @@ bool radio_screen(void)
/* Only display the peak meter when not recording */ /* Only display the peak meter when not recording */
if(!audio_status()) if(!audio_status())
{ {
/* just main screen for the time being */
#if CONFIG_CODEC != SWCODEC #if CONFIG_CODEC != SWCODEC
peak_meter_draw(0, STATUSBAR_HEIGHT + fh*(top_of_screen + 4), LCD_WIDTH, fh); FOR_NB_SCREENS(i)
{
peak_meter_screen(&screens[i],0,
STATUSBAR_HEIGHT + fh*(top_of_screen + 4), fh);
screens[i].update_rect(0, STATUSBAR_HEIGHT + fh*(top_of_screen + 4),
screens[i].width, fh);
}
#endif #endif
screens[SCREEN_MAIN].update_rect(0, STATUSBAR_HEIGHT + fh*(top_of_screen + 4), screens[SCREEN_MAIN].width, fh);
} }
if(TIME_AFTER(current_tick, timeout)) if(TIME_AFTER(current_tick, timeout))

View file

@ -43,6 +43,7 @@
#include "lang.h" #include "lang.h"
#include "font.h" #include "font.h"
#include "icons.h" #include "icons.h"
#include "icon.h"
#include "screens.h" #include "screens.h"
#include "peakmeter.h" #include "peakmeter.h"
#include "statusbar.h" #include "statusbar.h"
@ -60,6 +61,7 @@
#include "sound.h" #include "sound.h"
#include "ata.h" #include "ata.h"
#include "splash.h" #include "splash.h"
#include "screen_access.h"
#ifdef HAVE_RECORDING #ifdef HAVE_RECORDING
@ -104,6 +106,17 @@
#define REC_DEC BUTTON_LEFT #define REC_DEC BUTTON_LEFT
#endif #endif
#if (CONFIG_REMOTE_KEYPAD == H100_REMOTE) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
#define REC_RC_SHUTDOWN (BUTTON_RC_STOP | BUTTON_REPEAT)
#define REC_RC_STOPEXIT BUTTON_RC_STOP
#define REC_RC_RECPAUSE BUTTON_RC_ON
#define REC_RC_INC BUTTON_RC_BITRATE
#define REC_RC_DEC BUTTON_RC_SOURCE
#define REC_RC_NEXT BUTTON_RC_FF
#define REC_RC_PREV BUTTON_RC_REW
#define REC_RC_SETTINGS BUTTON_RC_MODE
#endif
bool f2_rec_screen(void); bool f2_rec_screen(void);
bool f3_rec_screen(void); bool f3_rec_screen(void);
@ -508,6 +521,7 @@ bool recording_screen(void)
bool led_state = false; bool led_state = false;
int led_countdown = 2; int led_countdown = 2;
#endif #endif
int i;
#ifdef HAVE_UDA1380 #ifdef HAVE_UDA1380
/*calculate no. of digital steps to each analogue step. Assuming /*calculate no. of digital steps to each analogue step. Assuming
@ -565,9 +579,12 @@ bool recording_screen(void)
settings_apply_trigger(); settings_apply_trigger();
lcd_setfont(FONT_SYSFIXED); FOR_NB_SCREENS(i)
lcd_getstringsize("M", &w, &h); {
lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8); screens[i].setfont(FONT_SYSFIXED);
screens[i].getstringsize("M", &w, &h);
screens[i].setmargins(global_settings.invert_cursor ? 0 : w, 8);
}
if(rec_create_directory() > 0) if(rec_create_directory() > 0)
have_recorded = true; have_recorded = true;
@ -628,7 +645,7 @@ bool recording_screen(void)
#endif /* CONFIG_LED */ #endif /* CONFIG_LED */
/* Wait for a button a while (HZ/10) drawing the peak meter */ /* Wait for a button a while (HZ/10) drawing the peak meter */
button = peak_meter_draw_get_btn(0, 8 + h*2, LCD_WIDTH, h); button = peak_meter_draw_get_btn(0, 8 + h*2, h*2);
if (last_audio_stat != audio_stat) if (last_audio_stat != audio_stat)
{ {
@ -643,6 +660,12 @@ bool recording_screen(void)
{ {
case REC_STOPEXIT: case REC_STOPEXIT:
case REC_SHUTDOWN: case REC_SHUTDOWN:
#ifdef REC_RC_STOPEXIT
case REC_RC_STOPEXIT:
#endif
#ifdef REC_RC_SHUTDOWN
case REC_RC_SHUTDOWN:
#endif
/* turn off the trigger */ /* turn off the trigger */
peak_meter_trigger(false); peak_meter_trigger(false);
peak_meter_set_trigger_listener(NULL); peak_meter_set_trigger_listener(NULL);
@ -663,6 +686,9 @@ bool recording_screen(void)
break; break;
case REC_RECPAUSE: case REC_RECPAUSE:
#ifdef REC_RC_RECPAUSE
case REC_RC_RECPAUSE:
#endif
#ifdef REC_RECPAUSE_PRE #ifdef REC_RECPAUSE_PRE
if (lastbutton != REC_RECPAUSE_PRE) if (lastbutton != REC_RECPAUSE_PRE)
break; break;
@ -715,6 +741,9 @@ bool recording_screen(void)
#ifdef REC_PREV #ifdef REC_PREV
case REC_PREV: case REC_PREV:
#ifdef REC_RC_PREV
case REC_RC_PREV:
#endif
cursor--; cursor--;
adjust_cursor(); adjust_cursor();
update_countdown = 1; /* Update immediately */ update_countdown = 1; /* Update immediately */
@ -723,6 +752,9 @@ bool recording_screen(void)
#ifdef REC_NEXT #ifdef REC_NEXT
case REC_NEXT: case REC_NEXT:
#ifdef REC_RC_NEXT
case REC_RC_NEXT:
#endif
cursor++; cursor++;
adjust_cursor(); adjust_cursor();
update_countdown = 1; /* Update immediately */ update_countdown = 1; /* Update immediately */
@ -731,6 +763,10 @@ bool recording_screen(void)
case REC_INC: case REC_INC:
case REC_INC | BUTTON_REPEAT: case REC_INC | BUTTON_REPEAT:
#ifdef REC_RC_INC
case REC_RC_INC:
case REC_RC_INC | BUTTON_REPEAT:
#endif
switch(cursor) switch(cursor)
{ {
case 0: case 0:
@ -788,6 +824,10 @@ bool recording_screen(void)
case REC_DEC: case REC_DEC:
case REC_DEC | BUTTON_REPEAT: case REC_DEC | BUTTON_REPEAT:
#ifdef REC_RC_INC
case REC_RC_DEC:
case REC_RC_DEC | BUTTON_REPEAT:
#endif
switch(cursor) switch(cursor)
{ {
case 0: case 0:
@ -848,6 +888,9 @@ bool recording_screen(void)
#ifdef REC_SETTINGS #ifdef REC_SETTINGS
case REC_SETTINGS: case REC_SETTINGS:
#ifdef REC_RC_SETTINGS
case REC_RC_SETTINGS:
#endif
if(audio_stat != AUDIO_STATUS_RECORD) if(audio_stat != AUDIO_STATUS_RECORD)
{ {
#if CONFIG_LED == LED_REAL #if CONFIG_LED == LED_REAL
@ -874,8 +917,11 @@ bool recording_screen(void)
set_gain(); set_gain();
update_countdown = 1; /* Update immediately */ update_countdown = 1; /* Update immediately */
lcd_setfont(FONT_SYSFIXED); FOR_NB_SCREENS(i)
lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8); {
screens[i].setfont(FONT_SYSFIXED);
screens[i].setmargins(global_settings.invert_cursor ? 0 : w, 8);
}
} }
break; break;
#endif #endif
@ -943,7 +989,8 @@ bool recording_screen(void)
if (button != BUTTON_NONE) if (button != BUTTON_NONE)
lastbutton = button; lastbutton = button;
lcd_setfont(FONT_SYSFIXED); FOR_NB_SCREENS(i)
screens[i].setfont(FONT_SYSFIXED);
seconds = audio_recorded_time() / HZ; seconds = audio_recorded_time() / HZ;
@ -957,14 +1004,16 @@ bool recording_screen(void)
update_countdown = 5; update_countdown = 5;
last_seconds = seconds; last_seconds = seconds;
lcd_clear_display(); FOR_NB_SCREENS(i)
screens[i].clear_display();
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);
lcd_puts(0, 0, buf); FOR_NB_SCREENS(i)
screens[i].puts(0, 0, buf);
dseconds = rec_timesplit_seconds(); dseconds = rec_timesplit_seconds();
num_recorded_bytes = audio_num_recorded_bytes(); num_recorded_bytes = audio_num_recorded_bytes();
@ -997,7 +1046,8 @@ bool recording_screen(void)
str(LANG_RECORDING_SIZE), buf2); str(LANG_RECORDING_SIZE), buf2);
} }
} }
lcd_puts(0, 1, buf); FOR_NB_SCREENS(i)
screens[i].puts(0, 1, buf);
/* 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
@ -1017,10 +1067,15 @@ bool recording_screen(void)
buf2, sizeof(buf2))); buf2, sizeof(buf2)));
if (global_settings.invert_cursor && (pos++ == cursor)) if (global_settings.invert_cursor && (pos++ == cursor))
lcd_puts_style(0, 3, buf, STYLE_INVERT); {
FOR_NB_SCREENS(i)
screens[i].puts_style_offset(0, 4, buf, STYLE_INVERT,0);
}
else else
lcd_puts(0, 3, buf); {
FOR_NB_SCREENS(i)
screens[i].puts(0, 4, buf);
}
if(global_settings.rec_source == SOURCE_MIC) if(global_settings.rec_source == SOURCE_MIC)
{ {
@ -1059,9 +1114,15 @@ bool recording_screen(void)
buf2, sizeof(buf2))); buf2, sizeof(buf2)));
#endif #endif
if(global_settings.invert_cursor && ((1==cursor)||(2==cursor))) if(global_settings.invert_cursor && ((1==cursor)||(2==cursor)))
lcd_puts_style(0, 4, buf, STYLE_INVERT); {
FOR_NB_SCREENS(i)
screens[i].puts_style_offset(0, 5, buf, STYLE_INVERT,0);
}
else else
lcd_puts(0, 4, buf); {
FOR_NB_SCREENS(i)
screens[i].puts(0, 5, buf);
}
} }
else if(global_settings.rec_source == SOURCE_LINE) else if(global_settings.rec_source == SOURCE_LINE)
{ {
@ -1104,9 +1165,16 @@ bool recording_screen(void)
buf2, sizeof(buf2))); buf2, sizeof(buf2)));
#endif /* HAVE_UDA1380 */ #endif /* HAVE_UDA1380 */
if(global_settings.invert_cursor && ((1==cursor)||(2==cursor))) if(global_settings.invert_cursor && ((1==cursor)||(2==cursor)))
lcd_puts_style(0, 4, buf, STYLE_INVERT); {
FOR_NB_SCREENS(i)
screens[i].puts_style_offset(0, 5, buf, STYLE_INVERT,0);
}
else else
lcd_puts(0, 4, buf); {
FOR_NB_SCREENS(i)
screens[i].puts(0, 5, buf);
}
#ifdef HAVE_UDA1380 #ifdef HAVE_UDA1380
snprintf(buf, 32, "%s:%s (%s)", snprintf(buf, 32, "%s:%s (%s)",
str(LANG_RECORDING_RIGHT), str(LANG_RECORDING_RIGHT),
@ -1134,39 +1202,59 @@ bool recording_screen(void)
buf2, sizeof(buf2))); buf2, sizeof(buf2)));
#endif /* HAVE_UDA1380 */ #endif /* HAVE_UDA1380 */
if(global_settings.invert_cursor && ((1==cursor)||(3==cursor))) if(global_settings.invert_cursor && ((1==cursor)||(3==cursor)))
lcd_puts_style(0, 5, buf, STYLE_INVERT); {
FOR_NB_SCREENS(i)
screens[i].puts_style_offset(0, 6, buf, STYLE_INVERT,0);
}
else else
lcd_puts(0, 5, buf); {
FOR_NB_SCREENS(i)
screens[i].puts(0, 6, buf);
}
} }
switch(cursor)
{
case 1:
put_cursorxy(0, 4, true);
if(global_settings.rec_source != SOURCE_MIC) if(!global_settings.invert_cursor){
put_cursorxy(0, 5, true); switch(cursor)
{
case 1:
FOR_NB_SCREENS(i)
screen_put_cursorxy(&screens[i], 0, 5, true);
break; if(global_settings.rec_source != SOURCE_MIC)
case 2: {
put_cursorxy(0, 4, true); FOR_NB_SCREENS(i)
break; screen_put_cursorxy(&screens[i], 0, 6, true);
case 3: }
put_cursorxy(0, 5, true); break;
break; case 2:
default: FOR_NB_SCREENS(i)
put_cursorxy(0, 0, true); screen_put_cursorxy(&screens[i], 0, 5, true);
break;
case 3:
FOR_NB_SCREENS(i)
screen_put_cursorxy(&screens[i], 0, 6, true);
break;
default:
FOR_NB_SCREENS(i)
screen_put_cursorxy(&screens[i], 0, 4, true);
}
} }
snprintf(buf, 32, "%s %s", snprintf(buf, 32, "%s %s",
freq_str[global_settings.rec_frequency], freq_str[global_settings.rec_frequency],
global_settings.rec_channels? global_settings.rec_channels?
str(LANG_CHANNEL_MONO):str(LANG_CHANNEL_STEREO)); str(LANG_CHANNEL_MONO):str(LANG_CHANNEL_STEREO));
lcd_puts(0, 7, buf);
/* Main screen only for this info */
lcd_puts(0, 8, buf);
gui_syncstatusbar_draw(&statusbars, true); gui_syncstatusbar_draw(&statusbars, true);
peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h);
lcd_update(); FOR_NB_SCREENS(i)
{
peak_meter_screen(&screens[i], 0, 8 + h*2, h*2);
screens[i].update();
}
/* draw the trigger status */ /* draw the trigger status */
if (peak_meter_trigger_status() != TRIG_OFF) if (peak_meter_trigger_status() != TRIG_OFF)
@ -1227,9 +1315,6 @@ bool recording_screen(void)
ata_set_led_enabled(true); ata_set_led_enabled(true);
#endif #endif
return been_in_usb_mode; return been_in_usb_mode;
/*
#endif
*/
} }
#ifdef REC_F2 #ifdef REC_F2

View file

@ -666,7 +666,7 @@ bool rectrigger(void)
peak_meter_draw_trig(0, LCD_HEIGHT - 8 - TRIG_HEIGHT); peak_meter_draw_trig(0, LCD_HEIGHT - 8 - TRIG_HEIGHT);
button = peak_meter_draw_get_btn(0, LCD_HEIGHT - 8, LCD_WIDTH, 8); button = peak_meter_draw_get_btn(0, LCD_HEIGHT - 8, 8);
lcd_update(); lcd_update();