From 3467ba60b116579a855076b7e993603bf817af93 Mon Sep 17 00:00:00 2001 From: Peter D'Hoye Date: Fri, 17 Feb 2006 22:47:56 +0000 Subject: Patch #1423609 by Martin Scarratt and myself: enables using the backlight as record clipping indicator. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8722 a1c6a512-1295-4272-9138-f99709370657 --- apps/lang/english.lang | 24 ++++++++++++++++++++++++ apps/recorder/peakmeter.c | 34 ++++++++++++++++++++++++++++++++-- apps/settings.c | 5 +++++ apps/settings.h | 4 ++++ apps/sound_menu.c | 28 +++++++++++++++++++++++++++- 5 files changed, 92 insertions(+), 3 deletions(-) (limited to 'apps') diff --git a/apps/lang/english.lang b/apps/lang/english.lang index a5b3f916c1..dcb7c07cc6 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -3724,3 +3724,27 @@ desc: jump to new page when scrolling eng: "Paged Scrolling" voice: "" new: + +id: LANG_CLIP_LIGHT +desc: in record settings menu. +eng: "Clipping light" +voice: "Clipping light" +new: + +id: LANG_MAIN_UNIT +desc: in record settings menu. +eng: "Main unit only" +voice: "Main unit only" +new: + +id: LANG_REMOTE_UNIT +desc: in record settings menu. +eng: "Remote unit only" +voice: "Remote unit only" +new: + +id: LANG_REMOTE_MAIN +desc: in record settings menu. +eng: "Main and remote unit" +voice: "Main and remote unit" +new: diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c index fbd206bdf8..0142a9d093 100644 --- a/apps/recorder/peakmeter.c +++ b/apps/recorder/peakmeter.c @@ -32,6 +32,10 @@ #include "icons.h" #include "lang.h" #include "peakmeter.h" +#include "audio.h" +#ifdef CONFIG_BACKLIGHT +#include "backlight.h" +#endif #if CONFIG_CODEC == SWCODEC #include "pcm_playback.h" @@ -943,9 +947,35 @@ void peak_meter_draw(int x, int y, int width, int height) have been calculated before */ lcd_drawpixel(db_scale_lcd_coord[i], y + height / 2 - 1); } + +#ifdef HAVE_RECORDING +#ifdef CONFIG_BACKLIGHT + /* cliplight */ + if ((pm_clip_left || pm_clip_right) && + global_settings.cliplight && +#if CONFIG_CODEC == SWCODEC + (pcm_rec_status() & (AUDIO_STATUS_RECORD | AUDIO_STATUS_PRERECORD))) +#else + (audio_status() & (AUDIO_STATUS_RECORD | AUDIO_STATUS_PRERECORD))) +#endif + { + /* if clipping, cliplight setting on and in recording screen */ + if (global_settings.cliplight <= 2) + { + /* turn on main unit light if setting set to main or both*/ + backlight_on(); + } +#ifdef HAVE_REMOTE_LCD + if (global_settings.cliplight >= 2) + { + /* turn remote light unit on if setting set to remote or both */ + remote_backlight_on(); + } +#endif /* HAVE_REMOTE_LCD */ + } +#endif /*CONFIG_BACKLIGHT */ -#ifdef HAVE_RECORDING if (trig_status != TRIG_OFF) { int start_trigx, stop_trigx, ycenter; @@ -961,7 +991,7 @@ void peak_meter_draw(int x, int y, int width, int height) lcd_vline(stop_trigx, ycenter - 2, ycenter); if (stop_trigx > 0) lcd_drawpixel(stop_trigx - 1, ycenter - 1); } -#endif +#endif /*HAVE_RECORDING*/ #ifdef PM_DEBUG /* display a bar to show how many calls to peak_meter_peek diff --git a/apps/settings.c b/apps/settings.c index d776f3f2d3..1f29e4d04d 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -540,6 +540,11 @@ static const struct bit_entry hd_bits[] = "mic decimator right gain", NULL }, /* -128...48 */ #endif {1, S_O(scroll_paginated), false, "scroll paginated", off_on }, +#ifdef HAVE_RECORDING +#ifdef CONFIG_BACKLIGHT + {2, S_O(cliplight), 0, "cliplight", "off,main,both,remote" }, +#endif /* CONFIG_BACKLIGHT */ +#endif /*HAVE_RECORDING*/ /* If values are just added to the end, no need to bump the version. */ /* new stuff to be added at the end */ diff --git a/apps/settings.h b/apps/settings.h index 9548936349..9220f79595 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -236,6 +236,10 @@ struct user_settings int rec_prerecord_time; /* In seconds, 0-30, 0 means OFF */ int rec_directory; /* 0=base dir, 1=current dir */ bool rec_startup; /* true means start Rockbox in recording screen */ + int cliplight; /* 0 = off + 1 = main lcd + 2 = main and remote lcd + 3 = remote lcd */ int rec_start_thres; /* negative: db, positive: % range -87 .. 100 */ int rec_start_duration; /* index of trig_durations */ diff --git a/apps/sound_menu.c b/apps/sound_menu.c index e4820b3379..b248ca99a5 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c @@ -341,7 +341,29 @@ static bool reconstartup(void) &global_settings.rec_startup); } -#endif /* MAS3587F */ +#ifdef CONFIG_BACKLIGHT +static bool cliplight(void) +{ + static const struct opt_items names[] = { + { STR(LANG_OFF) }, + { STR(LANG_MAIN_UNIT) } +#ifdef HAVE_REMOTE_LCD + , { STR(LANG_REMOTE_MAIN) }, + { STR(LANG_REMOTE_UNIT) } +#endif + }; + + return set_option( str(LANG_CLIP_LIGHT), + &global_settings.cliplight, INT, names, +#ifdef HAVE_REMOTE_LCD + 4, NULL ); +#else + 2, NULL ); +#endif +} +#endif /*CONFIG_BACKLIGHT */ + +#endif /* HAVE_RECORDING */ static bool chanconf(void) { @@ -808,6 +830,10 @@ bool recording_menu(bool no_source) items[i++].function = recdirectory; items[i].desc = ID2P(LANG_RECORD_STARTUP); items[i++].function = reconstartup; +#ifdef CONFIG_BACKLIGHT + items[i].desc = ID2P(LANG_CLIP_LIGHT); + items[i++].function = cliplight; +#endif #if !defined(SIMULATOR) && CONFIG_CODEC == MAS3587F items[i].desc = ID2P(LANG_RECORD_TRIGGER); items[i++].function = rectrigger; -- cgit v1.2.3