Make the histogram code usable for playback as well. Move the recording histogram code to peakmeter, rename it to remove the recording reference, and rename anything referring to it as well. Change the drawing code so there are more options to position them. This may change your histogram settings, so check after upgrading.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29969 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Peter D'Hoye 2011-06-05 12:36:27 +00:00
parent 62e06cc2a4
commit 82f4c60db4
33 changed files with 266 additions and 243 deletions

View file

@ -129,8 +129,8 @@ recording_mic
#endif
#endif
#if defined(HAVE_RECORDING_HISTOGRAM)
recording_histogram
#if defined(HAVE_HISTOGRAM)
histogram
#endif
#if defined(HAVE_REMOTE_LCD)

View file

@ -12078,20 +12078,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Intèrval d'histograma"
histogram: "Intèrval d'histograma"
</dest>
<voice>
*: none
recording_histogram: "Intèrval d'histograma"
histogram: "Intèrval d'histograma"
</voice>
</phrase>
<phrase>

View file

@ -12086,20 +12086,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Rozsah histogramu"
histogram: "Rozsah histogramu"
</dest>
<voice>
*: none
recording_histogram: "Rozsah histogramu"
histogram: "Rozsah histogramu"
</voice>
</phrase>
<phrase>

View file

@ -12566,20 +12566,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</dest>
<voice>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</voice>
</phrase>
<phrase>

View file

@ -12440,20 +12440,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Histogrammintervall"
histogram: "Histogrammintervall"
</dest>
<voice>
*: none
recording_histogram: "Histogrammintervall"
histogram: "Histogrammintervall"
</voice>
</phrase>
<phrase>

View file

@ -12169,20 +12169,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</dest>
<voice>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</voice>
</phrase>
<phrase>

View file

@ -12372,20 +12372,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Intervalo del histograma"
histogram: "Intervalo del histograma"
</dest>
<voice>
*: none
recording_histogram: "Intervalo del histograma"
histogram: "Intervalo del histograma"
</voice>
</phrase>
<phrase>

View file

@ -12110,20 +12110,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Intervalle de l'histogramme"
histogram: "Intervalle de l'histogramme"
</dest>
<voice>
*: none
recording_histogram: "Intervalle de l'histogramme"
histogram: "Intervalle de l'histogramme"
</voice>
</phrase>
<phrase>

View file

@ -12548,20 +12548,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</dest>
<voice>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</voice>
</phrase>
<phrase>

View file

@ -12087,20 +12087,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Interval histograma"
histogram: "Interval histograma"
</dest>
<voice>
*: none
recording_histogram: "Interval histograma"
histogram: "Interval histograma"
</voice>
</phrase>
<phrase>

View file

@ -12089,20 +12089,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Intervallo Istogramma"
histogram: "Intervallo Istogramma"
</dest>
<voice>
*: none
recording_histogram: "Intervallo Istogramma"
histogram: "Intervallo Istogramma"
</voice>
</phrase>
<phrase>

View file

@ -12093,20 +12093,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "ヒストグラムの間隔"
histogram: "ヒストグラムの間隔"
</dest>
<voice>
*: none
recording_histogram: "ヒストグラムの間隔"
histogram: "ヒストグラムの間隔"
</voice>
</phrase>
<phrase>

View file

@ -12092,20 +12092,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</dest>
<voice>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</voice>
</phrase>
<phrase>

View file

@ -12382,20 +12382,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Przedziały histogramu"
histogram: "Przedziały histogramu"
</dest>
<voice>
*: none
recording_histogram: "Przedziały histogramu"
histogram: "Przedziały histogramu"
</voice>
</phrase>
<phrase>

View file

@ -12085,20 +12085,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Intervalo do Histograma"
histogram: "Intervalo do Histograma"
</dest>
<voice>
*: none
recording_histogram: "Intervalo do Histograma"
histogram: "Intervalo do Histograma"
</voice>
</phrase>
<phrase>

View file

@ -12537,20 +12537,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Intervalo do Histograma"
histogram: "Intervalo do Histograma"
</dest>
<voice>
*: none
recording_histogram: "Intervalo do Histograma"
histogram: "Intervalo do Histograma"
</voice>
</phrase>
<phrase>

View file

@ -12520,20 +12520,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Интервал гистограммы"
histogram: "Интервал гистограммы"
</dest>
<voice>
*: none
recording_histogram: "Интервал гистограммы"
histogram: "Интервал гистограммы"
</voice>
</phrase>
<phrase>

View file

@ -12085,20 +12085,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Interval Histogramu"
histogram: "Interval Histogramu"
</dest>
<voice>
*: none
recording_histogram: "Interval histogramu"
histogram: "Interval histogramu"
</voice>
</phrase>
<phrase>

View file

@ -12011,20 +12011,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</dest>
<voice>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</voice>
</phrase>
<phrase>

View file

@ -12499,20 +12499,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Интервал хистограма"
histogram: "Интервал хистограма"
</dest>
<voice>
*: none
recording_histogram: "Интервал хистограма"
histogram: "Интервал хистограма"
</voice>
</phrase>
<phrase>

View file

@ -12091,20 +12091,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Histogramintervall"
histogram: "Histogramintervall"
</dest>
<voice>
*: none
recording_histogram: "Histogramintervall"
histogram: "Histogramintervall"
</voice>
</phrase>
<phrase>

View file

@ -12559,20 +12559,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</dest>
<voice>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</voice>
</phrase>
<phrase>

View file

@ -12511,20 +12511,20 @@
</voice>
</phrase>
<phrase>
id: LANG_RECORDING_HISTOGRAM_INTERVAL
id: LANG_HISTOGRAM_INTERVAL
desc: in record settings menu
user: core
<source>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</source>
<dest>
*: none
recording_histogram: "ช่วงเวลาฮิสโตแกรม"
histogram: "ช่วงเวลาฮิสโตแกรม"
</dest>
<voice>
*: none
recording_histogram: "Histogram interval"
histogram: "Histogram interval"
</voice>
</phrase>
<phrase>

View file

@ -443,6 +443,30 @@ static int peak_meter_max(void) {
settings_apply_pm_range();
return retval;
}
#if defined(HAVE_HISTOGRAM)
static bool history_interval(void)
{
static const struct opt_items names[] = {
{ "0s", TALK_ID(0, UNIT_SEC) },
{ "1s", TALK_ID(1, UNIT_SEC) },
{ "2s", TALK_ID(2, UNIT_SEC) },
{ "4s", TALK_ID(4, UNIT_SEC) }
};
/* reconfigure histogram settings here */
return set_option(str(LANG_HISTOGRAM_INTERVAL),
&global_settings.histogram_interval,
INT, names, 4, NULL );
}
MENUITEM_FUNCTION(histogram, 0,
ID2P(LANG_HISTOGRAM_INTERVAL),
history_interval, NULL, NULL, Icon_Menu_setting);
#endif
MENUITEM_FUNCTION(peak_meter_scale_item, 0, ID2P(LANG_PM_SCALE),
peak_meter_scale, NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(peak_meter_min_item, 0, ID2P(LANG_PM_MIN),
@ -454,6 +478,9 @@ MAKE_MENU(peak_meter_menu, ID2P(LANG_PM_MENU), NULL, Icon_NOICON,
&peak_meter_clip_hold,
#ifdef HAVE_RECORDING
&peak_meter_clipcounter,
#endif
#ifdef HAVE_HISTOGRAM
&histogram,
#endif
&peak_meter_scale_item, &peak_meter_min_item, &peak_meter_max_item);
#endif /* HAVE_LCD_BITMAP */

View file

@ -392,26 +392,6 @@ MENUITEM_FUNCTION(agc_cliptime, 0, ID2P(LANG_RECORDING_AGC_CLIPTIME),
agc_cliptime_func, NULL, NULL, Icon_Menu_setting);
#endif /* HAVE_AGC */
#if defined(HAVE_RECORDING_HISTOGRAM)
static bool history_interval(void)
{
static const struct opt_items names[] = {
{ "0s", TALK_ID(0, UNIT_SEC) },
{ "1s", TALK_ID(1, UNIT_SEC) },
{ "2s", TALK_ID(2, UNIT_SEC) },
{ "4s", TALK_ID(4, UNIT_SEC) }
};
return set_option(str(LANG_RECORDING_HISTOGRAM_INTERVAL),
&global_settings.rec_histogram_interval,
INT, names, 4, NULL );
}
MENUITEM_FUNCTION(recording_histogram, 0,
ID2P(LANG_RECORDING_HISTOGRAM_INTERVAL),
history_interval, NULL, NULL, Icon_Menu_setting);
#endif
/** Rec trigger **/
enum trigger_menu_option
{
@ -666,9 +646,6 @@ MAKE_MENU(recording_settings_menu, ID2P(LANG_RECORDING_SETTINGS),
#ifdef HAVE_AGC
&agc_preset, &agc_cliptime,
#endif
#if defined(HAVE_RECORDING_HISTOGRAM)
&recording_histogram,
#endif
#ifdef HAVE_LCD_BITMAP
&peak_meter_menu,
#endif

View file

@ -28,6 +28,7 @@
#include "storage.h"
#include "lcd.h"
#include "scrollbar.h"
#include "string.h"
#include "button.h"
#include "system.h"
#include "font.h"
@ -64,9 +65,10 @@ static int pm_cur_left; /* current values (last peak_meter_peek) */
static int pm_cur_right;
static int pm_max_left; /* maximum values between peak meter draws */
static int pm_max_right;
#if defined(HAVE_AGC) || defined(HAVE_RECORDING_HISTOGRAM)
#if defined(HAVE_AGC) || defined(HAVE_HISTOGRAM)
static int pm_peakhold_left; /* max. peak values between peakhold calls */
static int pm_peakhold_right; /* used for AGC and histogram display */
static long next_histogram_update;
#endif
/* Clip hold */
@ -134,6 +136,38 @@ static unsigned int peeks_per_redraw[PEEKS_PER_DRAW_SIZE];
static unsigned int ticks_per_redraw[TICKS_PER_DRAW_SIZE];
#endif
#if defined(HAVE_HISTOGRAM)
#define HIST_BUF_SIZE (LCD_WIDTH / 2)
static int hist_l = 0;
static int hist_r = 0;
static unsigned char history_l[HIST_BUF_SIZE];
static unsigned char history_r[HIST_BUF_SIZE];
static const char hist_level_marks[6] = { 29, 26, 23, 17, 9, 2};
static int history_pos = 0;
#define HIST_W (LCD_WIDTH / 2)
#if LCD_DEPTH > 1
#ifdef HAVE_LCD_COLOR
#define LCD_BAL_L LCD_RGBPACK(0, 0, 255)
#define LCD_BAL_R LCD_RGBPACK(204, 0, 0)
#define LCD_HIST_OVER LCD_RGBPACK(204, 0, 0)
#define LCD_HIST_HI LCD_RGBPACK(255, 204, 0)
#define LCD_HIST_OK LCD_RGBPACK(51, 153, 0)
#else /* HAVE_LCD_COLOR */
#define LCD_BATT_OK LCD_BLACK
#define LCD_BATT_LO LCD_DARKGRAY
#define LCD_DISK_OK LCD_BLACK
#define LCD_DISK_LO LCD_DARKGRAY
#define LCD_HIST_OVER LCD_BLACK
#define LCD_HIST_OK LCD_DARKGRAY
#define LCD_BAL LCD_DARKGRAY
#endif /* HAVE_LCD_COLOR */
#else /* LCD_DEPTH > 1 */
#define LCD_HIST_OVER LCD_DEFAULT_FG
#define LCD_HIST_OK LCD_DEFAULT_FG
#define LCD_BAL LCD_DEFAULT_FG
#endif /* LCD_DEPTH > 1 */
#endif /* HAVE_HISTOGRAM */
static void peak_meter_draw(struct screen *display, struct meter_scales *meter_scales,
int x, int y, int width, int height);
@ -810,7 +844,7 @@ static int peak_meter_read_l(void)
retval = pm_max_left;
#if defined(HAVE_RECORDING_HISTOGRAM) || defined(HAVE_AGC)
#if defined(HAVE_HISTOGRAM) || defined(HAVE_AGC)
/* store max peak value for peak_meter_get_peakhold_x readout */
pm_peakhold_left = MAX(pm_max_left, pm_peakhold_left);
#endif
@ -843,7 +877,7 @@ static int peak_meter_read_r(void)
retval = pm_max_right;
#if defined(HAVE_RECORDING_HISTOGRAM) || defined(HAVE_AGC)
#if defined(HAVE_HISTOGRAM) || defined(HAVE_AGC)
/* store max peak value for peak_meter_get_peakhold_x readout */
pm_peakhold_right = MAX(pm_max_right, pm_peakhold_right);
#endif
@ -857,7 +891,7 @@ static int peak_meter_read_r(void)
return retval;
}
#if defined(HAVE_AGC) || defined(HAVE_RECORDING_HISTOGRAM)
#if defined(HAVE_AGC) || defined(HAVE_HISTOGRAM)
/**
* Reads out the current peak-hold values since the last call.
* This is used by the histogram feature in the recording screen.
@ -869,6 +903,14 @@ void peak_meter_get_peakhold(int *peak_left, int *peak_right)
*peak_left = pm_peakhold_left;
if (peak_right)
*peak_right = pm_peakhold_right;
#ifdef HAVE_HISTOGRAM
if (*peak_left > hist_l)
hist_l = *peak_left;
if (*peak_right > hist_r)
hist_r = *peak_right;
#endif
pm_peakhold_left = 0;
pm_peakhold_right = 0;
}
@ -1447,4 +1489,75 @@ bool peak_meter_histogram(void)
}
#endif
#ifdef HAVE_HISTOGRAM
void histogram_init()
{
/* get update interval, clear buffer, reset drawing position */
memset(history_l, 0, sizeof(unsigned char)*HIST_BUF_SIZE);
memset(history_r, 0, sizeof(unsigned char)*HIST_BUF_SIZE);
next_histogram_update = current_tick +
(global_settings.histogram_interval * HZ);
}
void histogram_draw(int x1, int x2, int y1, int y2, int width, int height)
{
int i, j;
if (current_tick >= next_histogram_update)
{
/* fill history buffer */
history_l[history_pos] = hist_l * height / 32767;
history_r[history_pos] = hist_r * height / 32767;
history_pos = (history_pos + 1) % HIST_BUF_SIZE;
history_l[history_pos] = history_r[history_pos] = 0;
history_l[(history_pos + 1) % HIST_BUF_SIZE] = 0;
history_r[(history_pos + 1) % HIST_BUF_SIZE] = 0;
hist_l = 0;
hist_r = 0;
next_histogram_update = current_tick +
(global_settings.histogram_interval * HZ);
}
lcd_set_drawmode(DRMODE_SOLID);
lcd_drawrect(x1, y1, width, height);
lcd_drawrect(x2, y2, width, height);
lcd_set_drawmode(DRMODE_FG);
j = history_pos;
for (i = width-2; i >= 0; i--)
{
j--;
if(j<0)
j = HIST_BUF_SIZE-1;
if (history_l[j])
{
if (history_l[j] == height)
lcd_set_foreground(LCD_HIST_OVER);
#ifdef HAVE_LCD_COLOR
else if (history_l[j] > hist_level_marks[1])
lcd_set_foreground(LCD_HIST_HI);
#endif
else
lcd_set_foreground(LCD_HIST_OK);
lcd_vline(x1 + i, y1 + height - 2, y1 + height - history_l[j]);
}
if (history_r[j])
{
if (history_r[j] == height)
lcd_set_foreground(LCD_HIST_OVER);
#ifdef HAVE_LCD_COLOR
else if (history_r[j] > hist_level_marks[1])
lcd_set_foreground(LCD_HIST_HI);
#endif
else
lcd_set_foreground(LCD_HIST_OK);
lcd_vline(x2 + i, y2 + height - 2, y2 + height - history_r[j]);
}
}
lcd_set_foreground(
#ifdef HAVE_LCD_COLOR
global_settings.fg_color);
#else
LCD_DEFAULT_FG);
#endif
}
#endif /* HAVE_HISTOGRAM */

View file

@ -56,6 +56,11 @@ extern int calc_db (int isample);
extern int peak_meter_db2sample(int db);
extern unsigned short peak_meter_scale_value(unsigned short val, int meterwidth);
#ifdef HAVE_HISTOGRAM
extern void histogram_init(void);
extern void histogram_draw(int x1, int x2, int y1, int y2, int width, int height);
#endif
/* valid values for trigger_status */
#define TRIG_OFF 0x00
#define TRIG_READY 0x01
@ -103,3 +108,4 @@ struct meter_scales{
extern void peak_meter_screen(struct screen *display, int x, int y, int height);
#endif /* __PEAKMETER_H__ */

View file

@ -269,39 +269,9 @@ static short agc_baltime = 0;
/* AGC maximum gain */
static short agc_maxgain;
#endif /* HAVE_AGC */
#if defined(HAVE_AGC) || defined(HAVE_RECORDING_HISTOGRAM)
#if defined(HAVE_AGC)
static long hist_time = 0;
#endif /* HAVE_AGC or HAVE_RECORDING_HISTOGRAM */
/* Histogram data */
/* TO DO: move some of this stuff inside the recording function? */
#ifdef HAVE_RECORDING_HISTOGRAM
static int hist_l = 0;
static int hist_r = 0;
#define HIST_BUF_SIZE (LCD_WIDTH)
#define HIST_Y (hist_pos_y+hist_size_h-1)
#define HIST_W (LCD_WIDTH / 2 - 4)
#if LCD_DEPTH > 1
#ifdef HAVE_LCD_COLOR
#define LCD_BAL_L LCD_RGBPACK(0, 0, 255)
#define LCD_BAL_R LCD_RGBPACK(204, 0, 0)
#define LCD_HIST_OVER LCD_RGBPACK(204, 0, 0)
#define LCD_HIST_HI LCD_RGBPACK(255, 204, 0)
#define LCD_HIST_OK LCD_RGBPACK(51, 153, 0)
#else /* HAVE_LCD_COLOR */
#define LCD_BATT_OK LCD_BLACK
#define LCD_BATT_LO LCD_DARKGRAY
#define LCD_DISK_OK LCD_BLACK
#define LCD_DISK_LO LCD_DARKGRAY
#define LCD_HIST_OVER LCD_BLACK
#define LCD_HIST_OK LCD_DARKGRAY
#define LCD_BAL LCD_DARKGRAY
#endif /* HAVE_LCD_COLOR */
#else /* LCD_DEPTH > 1 */
#define LCD_HIST_OVER LCD_DEFAULT_FG
#define LCD_HIST_OK LCD_DEFAULT_FG
#define LCD_BAL LCD_DEFAULT_FG
#endif /* LCD_DEPTH > 1 */
#endif /* HAVE_RECORDING_HISTOGRAM */
#endif /* HAVE_AGC */
static void set_gain(void)
{
@ -368,13 +338,6 @@ static bool read_peak_levels(int *peak_l, int *peak_r, int *balance)
*balance += balance_mem[i];
*balance = *balance / BAL_MEM_SIZE;
#ifdef HAVE_RECORDING_HISTOGRAM
if (*peak_l > hist_l)
hist_l = *peak_l;
if (*peak_r > hist_r)
hist_r = *peak_r;
#endif
return true;
}
@ -1089,18 +1052,12 @@ bool recording_screen(bool no_source)
/* tweak layout tiny screens / big fonts */
bool compact_view[NB_SCREENS] = { false };
struct gui_synclist lists; /* the list in the bottom vp */
#if defined(HAVE_AGC) || defined(HAVE_RECORDING_HISTOGRAM)
#if defined(HAVE_AGC)
bool peak_valid = false;
#endif
#if defined(HAVE_RECORDING_HISTOGRAM)
int j;
#if defined(HAVE_HISTOGRAM)
unsigned short hist_pos_y = 0;
unsigned short hist_size_h = 0;
int history_pos = 0;
short hist_time_interval = 1; /* 1, 2, 4, 8 */
unsigned char history_l[HIST_BUF_SIZE];
unsigned char history_r[HIST_BUF_SIZE];
const char hist_level_marks[6] = { 29, 26, 23, 17, 9, 2};
#endif
#ifdef HAVE_FMRADIO_REC
int prev_rec_source = global_settings.rec_source; /* detect source change */
@ -1186,10 +1143,9 @@ bool recording_screen(bool no_source)
/* top vp, 4 lines, force sys font if total screen < 6 lines
NOTE: one could limit the list to 1 line and get away with 5 lines */
top_height_req[i] = 4;
#if defined(HAVE_RECORDING_HISTOGRAM)
if((global_settings.rec_histogram_interval) && (!i))
#if defined(HAVE_HISTOGRAM)
if((global_settings.histogram_interval) && (!i))
top_height_req[i] += 1; /* use one line for histogram */
hist_time_interval = 1 << global_settings.rec_histogram_interval;
#endif
v = &vp_top[i];
viewport_set_defaults(v, i);
@ -1229,13 +1185,11 @@ bool recording_screen(bool no_source)
send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */
#if defined(HAVE_RECORDING_HISTOGRAM)
history_pos = 0;
#if defined(HAVE_HISTOGRAM)
hist_pos_y = (compact_view[0] ? 3 : 4) * (font_get(vp_top[0].font)->height)
+ 1;
hist_size_h = font_get(vp_top[0].font)->height - 2;
memset(history_l, 0, sizeof(unsigned char)*HIST_BUF_SIZE);
memset(history_r, 0, sizeof(unsigned char)*HIST_BUF_SIZE);
histogram_init();
#endif
FOR_NB_SCREENS(i)
@ -1887,75 +1841,21 @@ bool recording_screen(bool no_source)
}
}
#ifdef HAVE_RECORDING_HISTOGRAM
if(global_settings.rec_histogram_interval)
{
if (peak_valid && !(hist_time % hist_time_interval) && hist_l)
#ifdef HAVE_HISTOGRAM
if(global_settings.histogram_interval)
{
/* fill history buffer */
history_l[history_pos] = hist_l * hist_size_h / 32767;
history_r[history_pos] = hist_r * hist_size_h / 32767;
history_pos = (history_pos + 1) % HIST_BUF_SIZE;
history_l[history_pos] = history_r[history_pos] = 0;
history_l[(history_pos + 1) % HIST_BUF_SIZE] = 0;
history_r[(history_pos + 1) % HIST_BUF_SIZE] = 0;
hist_l = 0;
hist_r = 0;
histogram_draw(0,
screens[0].getwidth()/2,
hist_pos_y,
hist_pos_y,
screens[0].getwidth()/2,
hist_size_h);
}
lcd_set_drawmode(DRMODE_SOLID);
lcd_drawrect(0, hist_pos_y - 1,
HIST_W + 2, hist_size_h + 1);
lcd_drawrect(HIST_W + 6, hist_pos_y - 1,
HIST_W + 2, hist_size_h + 1);
lcd_set_drawmode(DRMODE_FG);
j = history_pos;
for (i = HIST_W-1; i >= 0; i--)
{
j--;
if(j<0)
j = HIST_BUF_SIZE-1;
if (history_l[j])
{
if (history_l[j] == hist_size_h)
lcd_set_foreground(LCD_HIST_OVER);
#ifdef HAVE_LCD_COLOR
else if (history_l[j] > hist_level_marks[1])
lcd_set_foreground(LCD_HIST_HI);
#endif
else
lcd_set_foreground(LCD_HIST_OK);
lcd_vline(1 + i, HIST_Y-1, HIST_Y - history_l[j]);
}
if (history_r[j])
{
if (history_r[j] == hist_size_h)
lcd_set_foreground(LCD_HIST_OVER);
#ifdef HAVE_LCD_COLOR
else if (history_r[j] > hist_level_marks[1])
lcd_set_foreground(LCD_HIST_HI);
#endif
else
lcd_set_foreground(LCD_HIST_OK);
lcd_vline(HIST_W+7 + i, HIST_Y-1, HIST_Y - history_r[j]);
}
}
lcd_set_foreground(
#ifdef HAVE_LCD_COLOR
global_settings.fg_color);
#else
LCD_DEFAULT_FG);
#endif
for (i = 0; i < 6; i++)
lcd_hline(HIST_W + 3, HIST_W + 4,
HIST_Y - hist_level_marks[i]);
}
#endif /* HAVE_RECORDING_HISTOGRAM */
#ifdef HAVE_AGC
hist_time++;
#endif
/* draw the trigger status */
if (peak_meter_trigger_status() != TRIG_OFF)
{

View file

@ -438,8 +438,8 @@ struct user_settings
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_RECORDING_HISTOGRAM
int rec_histogram_interval; /* recording peakmeter histogram */
#ifdef HAVE_HISTOGRAM
int histogram_interval; /* recording peakmeter histogram */
#endif
#ifdef HAVE_AGC

View file

@ -1238,14 +1238,14 @@ const struct settings_list settings[] = {
CHOICE_SETTING(F_RECSETTING, rec_trigger_type, LANG_RECORD_TRIGGER_TYPE, TRIG_TYPE_STOP,
"trigger type","stop,pause,nf stp", NULL ,3,
ID2P(LANG_RECORD_TRIGGER_STOP), ID2P(LANG_PAUSE), ID2P(LANG_RECORD_TRIGGER_NEWFILESTP)),
#ifdef HAVE_RECORDING_HISTOGRAM
#endif /* HAVE_RECORDING */
#ifdef HAVE_HISTOGRAM
/* TO DO: additional restictions of following REP items? */
TABLE_SETTING(F_RECSETTING, rec_histogram_interval, LANG_RECORDING_HISTOGRAM_INTERVAL, 0,
TABLE_SETTING(F_RECSETTING, histogram_interval, LANG_HISTOGRAM_INTERVAL, 0,
"histogram interval","0s,1s,2s,4s",
UNIT_SEC, NULL, NULL, NULL, 4, 0,1,2,4),
#endif /* HAVE_RECORDING_HISTOGRAM */
#endif /* HAVE_RECORDING */
#endif /* HAVE_HISTOGRAM */
#ifdef HAVE_SPDIF_POWER
OFFON_SETTING(F_SOUNDSETTING, spdif_enable, LANG_SPDIF_ENABLE, false,

View file

@ -123,7 +123,7 @@
#define HAVE_AGC
#define HAVE_RECORDING_HISTOGRAM
#define HAVE_HISTOGRAM
#define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */
#define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */

View file

@ -114,7 +114,7 @@
/* define this if you have recording possibility */
#define HAVE_RECORDING
#define HAVE_RECORDING_HISTOGRAM
#define HAVE_HISTOGRAM
/* Define bitmask of input sources - recordable bitmask can be defined
explicitly if different */

View file

@ -110,7 +110,7 @@
/* define this if you have recording possibility */
#define HAVE_RECORDING
#define HAVE_RECORDING_HISTOGRAM
#define HAVE_HISTOGRAM
/* Define bitmask of input sources - recordable bitmask can be defined
explicitly if different */