2002-05-26 17:03:52 +00:00
|
|
|
|
/***************************************************************************
|
|
|
|
|
* __________ __ ___.
|
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2002 Bj<EFBFBD>rn Stenberg
|
|
|
|
|
*
|
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
|
*
|
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
|
* KIND, either express or implied.
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
2002-05-27 07:00:48 +00:00
|
|
|
|
#include "config.h"
|
2002-05-26 17:03:52 +00:00
|
|
|
|
#include <stdio.h>
|
2006-02-08 13:08:55 +00:00
|
|
|
|
#include <stdlib.h>
|
2002-05-26 17:03:52 +00:00
|
|
|
|
#include <stdbool.h>
|
2005-04-04 09:12:12 +00:00
|
|
|
|
#include "system.h"
|
2002-08-20 19:37:00 +00:00
|
|
|
|
#include "kernel.h"
|
2002-06-28 11:48:53 +00:00
|
|
|
|
#include "lcd.h"
|
2002-05-26 17:03:52 +00:00
|
|
|
|
#include "menu.h"
|
2002-06-28 11:48:53 +00:00
|
|
|
|
#include "button.h"
|
2004-01-05 20:42:51 +00:00
|
|
|
|
#include "mp3_playback.h"
|
2002-06-19 14:58:57 +00:00
|
|
|
|
#include "settings.h"
|
2005-11-20 01:02:14 +00:00
|
|
|
|
#include "statusbar.h"
|
2002-09-24 17:22:12 +00:00
|
|
|
|
#include "screens.h"
|
2002-08-20 19:37:00 +00:00
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
|
#include "icons.h"
|
2005-04-04 09:12:12 +00:00
|
|
|
|
#include "font.h"
|
|
|
|
|
#include "widgets.h"
|
2002-08-20 19:37:00 +00:00
|
|
|
|
#endif
|
2002-09-18 14:08:05 +00:00
|
|
|
|
#include "lang.h"
|
2003-02-15 00:03:23 +00:00
|
|
|
|
#include "sprintf.h"
|
2004-03-19 22:15:53 +00:00
|
|
|
|
#include "talk.h"
|
2004-07-26 16:06:59 +00:00
|
|
|
|
#include "misc.h"
|
2005-04-01 13:41:03 +00:00
|
|
|
|
#include "sound.h"
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if CONFIG_CODEC == MAS3587F
|
2005-04-04 09:12:12 +00:00
|
|
|
|
#include "peakmeter.h"
|
|
|
|
|
#include "mas.h"
|
|
|
|
|
#endif
|
2005-11-16 15:12:15 +00:00
|
|
|
|
#include "splash.h"
|
2005-12-05 22:35:18 +00:00
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
|
#include "dsp.h"
|
2006-02-07 14:07:46 +00:00
|
|
|
|
#include "eq_menu.h"
|
2006-02-07 19:17:51 +00:00
|
|
|
|
#include "pcmbuf.h"
|
2005-12-05 22:35:18 +00:00
|
|
|
|
#endif
|
2002-05-26 17:03:52 +00:00
|
|
|
|
|
2005-11-06 03:18:34 +00:00
|
|
|
|
int selected_setting; /* Used by the callback */
|
|
|
|
|
void dec_sound_formatter(char *buffer, int buffer_size, int val, const char * unit)
|
|
|
|
|
{
|
|
|
|
|
val = sound_val2phys(selected_setting, val);
|
2006-02-08 13:08:55 +00:00
|
|
|
|
char sign = ' ';
|
|
|
|
|
if(val < 0)
|
|
|
|
|
{
|
|
|
|
|
sign = '-';
|
|
|
|
|
val = abs(val);
|
|
|
|
|
}
|
2005-11-06 03:18:34 +00:00
|
|
|
|
int integer = val / 10;
|
|
|
|
|
int dec = val % 10;
|
2006-02-08 13:08:55 +00:00
|
|
|
|
snprintf(buffer, buffer_size, "%c%d.%d %s", sign, integer, dec, unit);
|
2005-11-06 03:18:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-12-05 22:44:42 +00:00
|
|
|
|
bool set_sound(const unsigned char * string,
|
2002-06-28 11:48:53 +00:00
|
|
|
|
int* variable,
|
|
|
|
|
int setting)
|
|
|
|
|
{
|
2004-03-19 22:15:53 +00:00
|
|
|
|
int talkunit = UNIT_INT;
|
2005-11-06 03:18:34 +00:00
|
|
|
|
const char* unit = sound_unit(setting);
|
|
|
|
|
int numdec = sound_numdecimals(setting);
|
|
|
|
|
int steps = sound_steps(setting);
|
|
|
|
|
int min = sound_min(setting);
|
|
|
|
|
int max = sound_max(setting);
|
2005-11-06 23:12:11 +00:00
|
|
|
|
sound_set_type* sound_callback = sound_get_fn(setting);
|
2004-03-19 22:15:53 +00:00
|
|
|
|
if (*unit == 'd') /* crude reconstruction */
|
|
|
|
|
talkunit = UNIT_DB;
|
|
|
|
|
else if (*unit == '%')
|
|
|
|
|
talkunit = UNIT_PERCENT;
|
2004-07-06 19:11:01 +00:00
|
|
|
|
else if (*unit == 'H')
|
2005-11-06 23:12:11 +00:00
|
|
|
|
talkunit = UNIT_HERTZ;
|
2005-11-06 03:18:34 +00:00
|
|
|
|
if(!numdec)
|
2006-03-21 23:20:17 +00:00
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
|
/* We need to hijack this one and send it off to apps/dsp.c instead of
|
|
|
|
|
firmware/sound.c */
|
|
|
|
|
if (setting == SOUND_STEREO_WIDTH)
|
|
|
|
|
return set_int(string, unit, talkunit, variable, &stereo_width_set,
|
|
|
|
|
steps, min, max, NULL );
|
|
|
|
|
else
|
|
|
|
|
#endif
|
2005-11-06 03:18:34 +00:00
|
|
|
|
return set_int(string, unit, talkunit, variable, sound_callback,
|
|
|
|
|
steps, min, max, NULL );
|
2002-08-20 19:37:00 +00:00
|
|
|
|
else
|
2005-11-06 03:18:34 +00:00
|
|
|
|
{/* Decimal number */
|
|
|
|
|
selected_setting=setting;
|
|
|
|
|
return set_int(string, unit, talkunit, variable, sound_callback,
|
|
|
|
|
steps, min, max, &dec_sound_formatter );
|
2002-06-28 11:48:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-24 17:22:12 +00:00
|
|
|
|
static bool volume(void)
|
2002-05-26 17:03:52 +00:00
|
|
|
|
{
|
2002-09-24 17:22:12 +00:00
|
|
|
|
return set_sound(str(LANG_VOLUME), &global_settings.volume, SOUND_VOLUME);
|
2002-05-26 17:03:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-09-24 17:22:12 +00:00
|
|
|
|
static bool balance(void)
|
2002-08-14 21:30:06 +00:00
|
|
|
|
{
|
2002-09-24 17:22:12 +00:00
|
|
|
|
return set_sound(str(LANG_BALANCE), &global_settings.balance,
|
|
|
|
|
SOUND_BALANCE);
|
2002-08-14 21:30:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-03-29 08:47:04 +00:00
|
|
|
|
#ifndef HAVE_TLV320
|
2002-09-24 17:22:12 +00:00
|
|
|
|
static bool bass(void)
|
2002-05-26 17:03:52 +00:00
|
|
|
|
{
|
2002-09-24 17:22:12 +00:00
|
|
|
|
return set_sound(str(LANG_BASS), &global_settings.bass, SOUND_BASS);
|
2004-06-16 11:30:51 +00:00
|
|
|
|
}
|
2002-05-26 17:03:52 +00:00
|
|
|
|
|
2002-09-24 17:22:12 +00:00
|
|
|
|
static bool treble(void)
|
2002-05-26 17:03:52 +00:00
|
|
|
|
{
|
2002-09-24 17:22:12 +00:00
|
|
|
|
return set_sound(str(LANG_TREBLE), &global_settings.treble, SOUND_TREBLE);
|
2002-05-26 17:03:52 +00:00
|
|
|
|
}
|
2006-03-29 08:47:04 +00:00
|
|
|
|
#endif
|
2002-05-26 17:03:52 +00:00
|
|
|
|
|
2005-12-05 22:35:18 +00:00
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2006-04-11 13:49:05 +00:00
|
|
|
|
static void crossfeed_format(char* buffer, int buffer_size, int value,
|
|
|
|
|
const char* unit)
|
|
|
|
|
{
|
|
|
|
|
snprintf(buffer, buffer_size, "%s%d.%d %s", value == 0 ? " " : "-",
|
|
|
|
|
value / 10, value % 10, unit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool crossfeed_enabled(void)
|
2005-12-05 22:35:18 +00:00
|
|
|
|
{
|
|
|
|
|
bool result = set_bool_options(str(LANG_CROSSFEED),
|
|
|
|
|
&global_settings.crossfeed,
|
|
|
|
|
STR(LANG_ON),
|
|
|
|
|
STR(LANG_OFF),
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
dsp_set_crossfeed(global_settings.crossfeed);
|
2006-04-11 13:49:05 +00:00
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool crossfeed_direct_gain(void)
|
|
|
|
|
{
|
|
|
|
|
return set_int(str(LANG_CROSSFEED_DIRECT_GAIN), str(LANG_UNIT_DB),
|
|
|
|
|
UNIT_DB, &global_settings.crossfeed_direct_gain,
|
|
|
|
|
&dsp_set_crossfeed_direct_gain, 5, 0, 60, crossfeed_format);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void crossfeed_cross_gain_helper(int val)
|
|
|
|
|
{
|
|
|
|
|
dsp_set_crossfeed_cross_params(val,
|
|
|
|
|
val + global_settings.crossfeed_hf_attenuation,
|
|
|
|
|
global_settings.crossfeed_hf_cutoff);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool crossfeed_cross_gain(void)
|
|
|
|
|
{
|
|
|
|
|
return set_int(str(LANG_CROSSFEED_CROSS_GAIN), str(LANG_UNIT_DB),
|
|
|
|
|
UNIT_DB, &global_settings.crossfeed_cross_gain,
|
|
|
|
|
&crossfeed_cross_gain_helper, 5, 30, 120, crossfeed_format);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void crossfeed_hf_att_helper(int val)
|
|
|
|
|
{
|
|
|
|
|
dsp_set_crossfeed_cross_params(global_settings.crossfeed_cross_gain,
|
|
|
|
|
global_settings.crossfeed_cross_gain + val,
|
|
|
|
|
global_settings.crossfeed_hf_cutoff);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool crossfeed_hf_attenuation(void)
|
|
|
|
|
{
|
|
|
|
|
return set_int(str(LANG_CROSSFEED_HF_ATTENUATION), str(LANG_UNIT_DB),
|
|
|
|
|
UNIT_DB, &global_settings.crossfeed_hf_attenuation,
|
|
|
|
|
&crossfeed_hf_att_helper, 5, 60, 240, crossfeed_format);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void crossfeed_hf_cutoff_helper(int val)
|
|
|
|
|
{
|
|
|
|
|
dsp_set_crossfeed_cross_params(global_settings.crossfeed_cross_gain,
|
|
|
|
|
global_settings.crossfeed_cross_gain + global_settings.crossfeed_hf_attenuation, val);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool crossfeed_hf_cutoff(void)
|
|
|
|
|
{
|
|
|
|
|
return set_int(str(LANG_CROSSFEED_HF_CUTOFF), str(LANG_UNIT_HERTZ),
|
|
|
|
|
UNIT_HERTZ, &global_settings.crossfeed_hf_cutoff, &crossfeed_hf_cutoff_helper, 100, 500, 2000,
|
|
|
|
|
NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool crossfeed_menu(void)
|
|
|
|
|
{
|
|
|
|
|
int m;
|
|
|
|
|
bool result;
|
|
|
|
|
static const struct menu_item items[] = {
|
|
|
|
|
{ ID2P(LANG_CROSSFEED), crossfeed_enabled },
|
|
|
|
|
{ ID2P(LANG_CROSSFEED_DIRECT_GAIN), crossfeed_direct_gain },
|
|
|
|
|
{ ID2P(LANG_CROSSFEED_CROSS_GAIN), crossfeed_cross_gain },
|
|
|
|
|
{ ID2P(LANG_CROSSFEED_HF_ATTENUATION), crossfeed_hf_attenuation },
|
|
|
|
|
{ ID2P(LANG_CROSSFEED_HF_CUTOFF), crossfeed_hf_cutoff },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
m=menu_init(items, sizeof(items) / sizeof(*items), NULL,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
result = menu_run(m);
|
|
|
|
|
menu_exit(m);
|
|
|
|
|
|
2005-12-05 22:35:18 +00:00
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
2002-09-24 17:22:12 +00:00
|
|
|
|
static bool loudness(void)
|
2002-07-22 16:39:17 +00:00
|
|
|
|
{
|
2002-09-24 17:22:12 +00:00
|
|
|
|
return set_sound(str(LANG_LOUDNESS), &global_settings.loudness,
|
|
|
|
|
SOUND_LOUDNESS);
|
2004-06-16 11:30:51 +00:00
|
|
|
|
}
|
2002-07-22 16:39:17 +00:00
|
|
|
|
|
2004-07-06 12:17:14 +00:00
|
|
|
|
static bool mdb_strength(void)
|
2002-07-22 16:39:17 +00:00
|
|
|
|
{
|
2004-07-06 12:17:14 +00:00
|
|
|
|
return set_sound(str(LANG_MDB_STRENGTH), &global_settings.mdb_strength,
|
|
|
|
|
SOUND_MDB_STRENGTH);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool mdb_harmonics(void)
|
|
|
|
|
{
|
|
|
|
|
return set_sound(str(LANG_MDB_HARMONICS), &global_settings.mdb_harmonics,
|
|
|
|
|
SOUND_MDB_HARMONICS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool mdb_center(void)
|
|
|
|
|
{
|
|
|
|
|
return set_sound(str(LANG_MDB_CENTER), &global_settings.mdb_center,
|
|
|
|
|
SOUND_MDB_CENTER);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool mdb_shape(void)
|
|
|
|
|
{
|
2004-07-06 19:11:01 +00:00
|
|
|
|
return set_sound(str(LANG_MDB_SHAPE), &global_settings.mdb_shape,
|
2004-07-06 12:17:14 +00:00
|
|
|
|
SOUND_MDB_SHAPE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void set_mdb_enable(bool value)
|
|
|
|
|
{
|
2005-11-06 23:12:11 +00:00
|
|
|
|
sound_set_mdb_enable((int)value);
|
2004-07-06 12:17:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool mdb_enable(void)
|
|
|
|
|
{
|
|
|
|
|
return set_bool_options(str(LANG_MDB_ENABLE),
|
|
|
|
|
&global_settings.mdb_enable,
|
|
|
|
|
STR(LANG_SET_BOOL_YES),
|
|
|
|
|
STR(LANG_SET_BOOL_NO),
|
|
|
|
|
set_mdb_enable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void set_superbass(bool value)
|
|
|
|
|
{
|
2005-11-06 23:12:11 +00:00
|
|
|
|
sound_set_superbass((int)value);
|
2004-07-06 12:17:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool superbass(void)
|
|
|
|
|
{
|
|
|
|
|
return set_bool_options(str(LANG_SUPERBASS),
|
|
|
|
|
&global_settings.superbass,
|
|
|
|
|
STR(LANG_SET_BOOL_YES),
|
|
|
|
|
STR(LANG_SET_BOOL_NO),
|
|
|
|
|
set_superbass);
|
2004-06-16 11:30:51 +00:00
|
|
|
|
}
|
2002-07-25 15:55:22 +00:00
|
|
|
|
|
2002-09-24 17:22:12 +00:00
|
|
|
|
static bool avc(void)
|
2002-07-25 15:55:22 +00:00
|
|
|
|
{
|
2004-07-23 23:01:20 +00:00
|
|
|
|
static const struct opt_items names[] = {
|
2004-03-15 08:27:51 +00:00
|
|
|
|
{ STR(LANG_OFF) },
|
2004-06-22 12:37:42 +00:00
|
|
|
|
{ "20ms", TALK_ID(20, UNIT_MS) },
|
2004-03-19 22:15:53 +00:00
|
|
|
|
{ "2s", TALK_ID(2, UNIT_SEC) },
|
|
|
|
|
{ "4s", TALK_ID(4, UNIT_SEC) },
|
|
|
|
|
{ "8s", TALK_ID(8, UNIT_SEC) }
|
2004-03-15 08:27:51 +00:00
|
|
|
|
};
|
2003-06-05 11:11:10 +00:00
|
|
|
|
return set_option(str(LANG_DECAY), &global_settings.avc, INT,
|
2005-11-06 23:12:11 +00:00
|
|
|
|
names, 5, sound_set_avc);
|
2002-07-25 15:55:22 +00:00
|
|
|
|
}
|
2004-10-01 21:53:10 +00:00
|
|
|
|
#endif
|
2002-11-10 23:18:33 +00:00
|
|
|
|
|
2005-02-04 10:57:51 +00:00
|
|
|
|
#ifdef HAVE_RECORDING
|
2002-11-10 23:18:33 +00:00
|
|
|
|
static bool recsource(void)
|
|
|
|
|
{
|
2004-07-23 23:01:20 +00:00
|
|
|
|
static const struct opt_items names[] = {
|
2004-03-15 08:27:51 +00:00
|
|
|
|
{ STR(LANG_RECORDING_SRC_MIC) },
|
|
|
|
|
{ STR(LANG_RECORDING_SRC_LINE) },
|
2005-09-06 20:48:28 +00:00
|
|
|
|
#ifdef HAVE_SPDIF_IN
|
|
|
|
|
{ STR(LANG_RECORDING_SRC_DIGITAL) },
|
|
|
|
|
#endif
|
2004-03-15 08:27:51 +00:00
|
|
|
|
};
|
2002-11-10 23:18:33 +00:00
|
|
|
|
return set_option(str(LANG_RECORDING_SOURCE),
|
2005-09-06 20:48:28 +00:00
|
|
|
|
&global_settings.rec_source, INT, names,
|
|
|
|
|
sizeof(names)/sizeof(struct opt_items), NULL );
|
2002-11-10 23:18:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool recfrequency(void)
|
|
|
|
|
{
|
2004-07-23 23:01:20 +00:00
|
|
|
|
static const struct opt_items names[] = {
|
2004-03-19 22:15:53 +00:00
|
|
|
|
{ "44.1kHz", TALK_ID(44, UNIT_KHZ) },
|
|
|
|
|
{ "48kHz", TALK_ID(48, UNIT_KHZ) },
|
|
|
|
|
{ "32kHz", TALK_ID(32, UNIT_KHZ) },
|
|
|
|
|
{ "22.05kHz", TALK_ID(22, UNIT_KHZ) },
|
|
|
|
|
{ "24kHz", TALK_ID(24, UNIT_KHZ) },
|
|
|
|
|
{ "16kHz", TALK_ID(16, UNIT_KHZ) }
|
2004-03-15 08:27:51 +00:00
|
|
|
|
};
|
2002-11-10 23:18:33 +00:00
|
|
|
|
return set_option(str(LANG_RECORDING_FREQUENCY),
|
2003-06-05 11:11:10 +00:00
|
|
|
|
&global_settings.rec_frequency, INT,
|
2002-11-10 23:18:33 +00:00
|
|
|
|
names, 6, NULL );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool recchannels(void)
|
|
|
|
|
{
|
2004-07-23 23:01:20 +00:00
|
|
|
|
static const struct opt_items names[] = {
|
2004-03-15 08:27:51 +00:00
|
|
|
|
{ STR(LANG_CHANNEL_STEREO) },
|
|
|
|
|
{ STR(LANG_CHANNEL_MONO) }
|
|
|
|
|
};
|
2002-11-10 23:18:33 +00:00
|
|
|
|
return set_option(str(LANG_RECORDING_CHANNELS),
|
2003-06-05 11:11:10 +00:00
|
|
|
|
&global_settings.rec_channels, INT,
|
2002-11-10 23:18:33 +00:00
|
|
|
|
names, 2, NULL );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool recquality(void)
|
|
|
|
|
{
|
2006-02-08 13:08:55 +00:00
|
|
|
|
#ifdef HAVE_UDA1380
|
|
|
|
|
(void)recquality();
|
|
|
|
|
#endif
|
2004-03-20 16:49:58 +00:00
|
|
|
|
return set_int(str(LANG_RECORDING_QUALITY), "", UNIT_INT,
|
2002-11-10 23:18:33 +00:00
|
|
|
|
&global_settings.rec_quality,
|
2005-08-11 18:56:20 +00:00
|
|
|
|
NULL, 1, 0, 7, NULL );
|
2002-11-10 23:18:33 +00:00
|
|
|
|
}
|
2003-04-20 22:00:30 +00:00
|
|
|
|
|
|
|
|
|
static bool receditable(void)
|
|
|
|
|
{
|
|
|
|
|
return set_bool(str(LANG_RECORDING_EDITABLE),
|
|
|
|
|
&global_settings.rec_editable);
|
|
|
|
|
}
|
2003-06-04 13:48:50 +00:00
|
|
|
|
|
2005-11-12 04:00:56 +00:00
|
|
|
|
|
2003-06-04 13:48:50 +00:00
|
|
|
|
static bool rectimesplit(void)
|
|
|
|
|
{
|
2004-07-23 23:01:20 +00:00
|
|
|
|
static const struct opt_items names[] = {
|
2004-03-15 08:27:51 +00:00
|
|
|
|
{ STR(LANG_OFF) },
|
2004-03-19 22:15:53 +00:00
|
|
|
|
{ "00:05" , TALK_ID(5, UNIT_MIN) },
|
|
|
|
|
{ "00:10" , TALK_ID(10, UNIT_MIN) },
|
|
|
|
|
{ "00:15" , TALK_ID(15, UNIT_MIN) },
|
|
|
|
|
{ "00:30" , TALK_ID(30, UNIT_MIN) },
|
|
|
|
|
{ "01:00" , TALK_ID(1, UNIT_HOUR) },
|
2004-10-27 09:24:02 +00:00
|
|
|
|
{ "01:14" , TALK_ID(74, UNIT_MIN) },
|
|
|
|
|
{ "01:20" , TALK_ID(80, UNIT_MIN) },
|
2004-03-19 22:15:53 +00:00
|
|
|
|
{ "02:00" , TALK_ID(2, UNIT_HOUR) },
|
|
|
|
|
{ "04:00" , TALK_ID(4, UNIT_HOUR) },
|
|
|
|
|
{ "06:00" , TALK_ID(6, UNIT_HOUR) },
|
|
|
|
|
{ "08:00" , TALK_ID(8, UNIT_HOUR) },
|
|
|
|
|
{ "10:00" , TALK_ID(10, UNIT_HOUR) },
|
|
|
|
|
{ "12:00" , TALK_ID(12, UNIT_HOUR) },
|
|
|
|
|
{ "18:00" , TALK_ID(18, UNIT_HOUR) },
|
|
|
|
|
{ "24:00" , TALK_ID(24, UNIT_HOUR) }
|
2003-06-10 19:24:51 +00:00
|
|
|
|
};
|
2003-06-04 13:48:50 +00:00
|
|
|
|
return set_option(str(LANG_RECORD_TIMESPLIT),
|
2003-06-05 11:11:10 +00:00
|
|
|
|
&global_settings.rec_timesplit, INT,
|
2004-10-27 09:24:02 +00:00
|
|
|
|
names, 16, NULL );
|
2003-06-04 13:48:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-12-31 03:13:29 +00:00
|
|
|
|
static bool recprerecord(void)
|
|
|
|
|
{
|
2004-07-23 23:01:20 +00:00
|
|
|
|
static const struct opt_items names[] = {
|
2004-03-15 08:27:51 +00:00
|
|
|
|
{ STR(LANG_OFF) },
|
2004-03-19 22:15:53 +00:00
|
|
|
|
{ "1s", TALK_ID(1, UNIT_SEC) },
|
|
|
|
|
{ "2s", TALK_ID(2, UNIT_SEC) },
|
|
|
|
|
{ "3s", TALK_ID(3, UNIT_SEC) },
|
|
|
|
|
{ "4s", TALK_ID(4, UNIT_SEC) },
|
|
|
|
|
{ "5s", TALK_ID(5, UNIT_SEC) },
|
|
|
|
|
{ "6s", TALK_ID(6, UNIT_SEC) },
|
|
|
|
|
{ "7s", TALK_ID(7, UNIT_SEC) },
|
|
|
|
|
{ "8s", TALK_ID(8, UNIT_SEC) },
|
|
|
|
|
{ "9s", TALK_ID(9, UNIT_SEC) },
|
|
|
|
|
{ "10s", TALK_ID(10, UNIT_SEC) },
|
|
|
|
|
{ "11s", TALK_ID(11, UNIT_SEC) },
|
|
|
|
|
{ "12s", TALK_ID(12, UNIT_SEC) },
|
|
|
|
|
{ "13s", TALK_ID(13, UNIT_SEC) },
|
|
|
|
|
{ "14s", TALK_ID(14, UNIT_SEC) },
|
|
|
|
|
{ "15s", TALK_ID(15, UNIT_SEC) },
|
|
|
|
|
{ "16s", TALK_ID(16, UNIT_SEC) },
|
|
|
|
|
{ "17s", TALK_ID(17, UNIT_SEC) },
|
|
|
|
|
{ "18s", TALK_ID(18, UNIT_SEC) },
|
|
|
|
|
{ "19s", TALK_ID(19, UNIT_SEC) },
|
|
|
|
|
{ "20s", TALK_ID(20, UNIT_SEC) },
|
|
|
|
|
{ "21s", TALK_ID(21, UNIT_SEC) },
|
|
|
|
|
{ "22s", TALK_ID(22, UNIT_SEC) },
|
|
|
|
|
{ "23s", TALK_ID(23, UNIT_SEC) },
|
|
|
|
|
{ "24s", TALK_ID(24, UNIT_SEC) },
|
|
|
|
|
{ "25s", TALK_ID(25, UNIT_SEC) },
|
|
|
|
|
{ "26s", TALK_ID(26, UNIT_SEC) },
|
|
|
|
|
{ "27s", TALK_ID(27, UNIT_SEC) },
|
|
|
|
|
{ "28s", TALK_ID(28, UNIT_SEC) },
|
|
|
|
|
{ "29s", TALK_ID(29, UNIT_SEC) },
|
|
|
|
|
{ "30s", TALK_ID(30, UNIT_SEC) }
|
2003-12-31 03:13:29 +00:00
|
|
|
|
};
|
|
|
|
|
return set_option(str(LANG_RECORD_PRERECORD_TIME),
|
|
|
|
|
&global_settings.rec_prerecord_time, INT,
|
|
|
|
|
names, 31, NULL );
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-21 14:58:40 +00:00
|
|
|
|
static bool recdirectory(void)
|
|
|
|
|
{
|
2004-07-23 23:01:20 +00:00
|
|
|
|
static const struct opt_items names[] = {
|
2004-03-15 08:27:51 +00:00
|
|
|
|
{ rec_base_directory, -1 },
|
|
|
|
|
{ STR(LANG_RECORD_CURRENT_DIR) }
|
2004-01-21 14:58:40 +00:00
|
|
|
|
};
|
|
|
|
|
return set_option(str(LANG_RECORD_DIRECTORY),
|
|
|
|
|
&global_settings.rec_directory, INT,
|
|
|
|
|
names, 2, NULL );
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-04 10:37:21 +00:00
|
|
|
|
static bool reconstartup(void)
|
|
|
|
|
{
|
|
|
|
|
return set_bool(str(LANG_RECORD_STARTUP),
|
2005-07-05 22:27:54 +00:00
|
|
|
|
&global_settings.rec_startup);
|
2005-02-04 10:37:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-17 22:47:56 +00:00
|
|
|
|
#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 */
|
2002-07-22 16:39:17 +00:00
|
|
|
|
|
2002-09-24 17:22:12 +00:00
|
|
|
|
static bool chanconf(void)
|
2002-09-09 15:13:33 +00:00
|
|
|
|
{
|
2004-07-23 23:01:20 +00:00
|
|
|
|
static const struct opt_items names[] = {
|
2004-03-15 08:27:51 +00:00
|
|
|
|
{ STR(LANG_CHANNEL_STEREO) },
|
|
|
|
|
{ STR(LANG_CHANNEL_MONO) },
|
2005-01-12 00:24:15 +00:00
|
|
|
|
{ STR(LANG_CHANNEL_CUSTOM) },
|
2004-03-15 08:27:51 +00:00
|
|
|
|
{ STR(LANG_CHANNEL_LEFT) },
|
|
|
|
|
{ STR(LANG_CHANNEL_RIGHT) },
|
2005-01-12 00:24:15 +00:00
|
|
|
|
{ STR(LANG_CHANNEL_KARAOKE) }
|
2003-06-05 11:11:10 +00:00
|
|
|
|
};
|
2006-03-21 23:20:17 +00:00
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
|
return set_option(str(LANG_CHANNEL), &global_settings.channel_config, INT,
|
|
|
|
|
names, 6, channels_set);
|
|
|
|
|
#else
|
2003-06-05 11:11:10 +00:00
|
|
|
|
return set_option(str(LANG_CHANNEL), &global_settings.channel_config, INT,
|
2005-11-06 23:12:11 +00:00
|
|
|
|
names, 6, sound_set_channels);
|
2006-03-21 23:20:17 +00:00
|
|
|
|
#endif
|
2005-01-12 00:24:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool stereo_width(void)
|
|
|
|
|
{
|
|
|
|
|
return set_sound(str(LANG_STEREO_WIDTH), &global_settings.stereo_width,
|
|
|
|
|
SOUND_STEREO_WIDTH);
|
2002-09-09 15:13:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-09-24 17:22:12 +00:00
|
|
|
|
bool sound_menu(void)
|
2002-05-26 17:03:52 +00:00
|
|
|
|
{
|
|
|
|
|
int m;
|
2002-09-24 17:22:12 +00:00
|
|
|
|
bool result;
|
2004-07-23 23:01:20 +00:00
|
|
|
|
static const struct menu_item items[] = {
|
|
|
|
|
{ ID2P(LANG_VOLUME), volume },
|
2006-03-29 08:47:04 +00:00
|
|
|
|
#ifndef HAVE_TLV320
|
2004-07-23 23:01:20 +00:00
|
|
|
|
{ ID2P(LANG_BASS), bass },
|
|
|
|
|
{ ID2P(LANG_TREBLE), treble },
|
2006-03-29 08:47:04 +00:00
|
|
|
|
#endif
|
2004-07-23 23:01:20 +00:00
|
|
|
|
{ ID2P(LANG_BALANCE), balance },
|
|
|
|
|
{ ID2P(LANG_CHANNEL_MENU), chanconf },
|
2005-01-12 00:24:15 +00:00
|
|
|
|
{ ID2P(LANG_STEREO_WIDTH), stereo_width },
|
2005-12-05 22:35:18 +00:00
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2006-04-11 13:49:05 +00:00
|
|
|
|
{ ID2P(LANG_CROSSFEED), crossfeed_menu },
|
2006-02-07 14:07:46 +00:00
|
|
|
|
{ ID2P(LANG_EQUALIZER), eq_menu },
|
2005-12-05 22:35:18 +00:00
|
|
|
|
#endif
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
2004-07-23 23:01:20 +00:00
|
|
|
|
{ ID2P(LANG_LOUDNESS), loudness },
|
|
|
|
|
{ ID2P(LANG_AUTOVOL), avc },
|
|
|
|
|
{ ID2P(LANG_SUPERBASS), superbass },
|
|
|
|
|
{ ID2P(LANG_MDB_ENABLE), mdb_enable },
|
|
|
|
|
{ ID2P(LANG_MDB_STRENGTH), mdb_strength },
|
|
|
|
|
{ ID2P(LANG_MDB_HARMONICS), mdb_harmonics },
|
|
|
|
|
{ ID2P(LANG_MDB_CENTER), mdb_center },
|
|
|
|
|
{ ID2P(LANG_MDB_SHAPE), mdb_shape },
|
2002-07-22 16:39:17 +00:00
|
|
|
|
#endif
|
2002-05-26 17:03:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2006-02-07 19:17:51 +00:00
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
|
pcmbuf_set_low_latency(true);
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-03-16 13:44:56 +00:00
|
|
|
|
m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
|
|
|
|
|
NULL, NULL, NULL);
|
2002-08-23 12:32:52 +00:00
|
|
|
|
result = menu_run(m);
|
2002-05-26 17:03:52 +00:00
|
|
|
|
menu_exit(m);
|
2002-08-23 12:32:52 +00:00
|
|
|
|
|
2006-02-07 19:17:51 +00:00
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
|
pcmbuf_set_low_latency(false);
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-08-23 12:32:52 +00:00
|
|
|
|
return result;
|
2002-05-26 17:03:52 +00:00
|
|
|
|
}
|
2002-11-10 23:18:33 +00:00
|
|
|
|
|
2005-02-04 10:57:51 +00:00
|
|
|
|
#ifdef HAVE_RECORDING
|
2005-04-04 09:12:12 +00:00
|
|
|
|
enum trigger_menu_option
|
|
|
|
|
{
|
|
|
|
|
TRIGGER_MODE,
|
|
|
|
|
PRERECORD_TIME,
|
|
|
|
|
START_THRESHOLD,
|
|
|
|
|
START_DURATION,
|
|
|
|
|
STOP_THRESHOLD,
|
|
|
|
|
STOP_POSTREC,
|
|
|
|
|
STOP_GAP,
|
|
|
|
|
TRIG_OPTION_COUNT,
|
|
|
|
|
};
|
|
|
|
|
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if !defined(SIMULATOR) && CONFIG_CODEC == MAS3587F
|
2005-04-04 09:12:12 +00:00
|
|
|
|
static char* create_thres_str(int threshold)
|
|
|
|
|
{
|
|
|
|
|
static char retval[6];
|
|
|
|
|
if (threshold < 0) {
|
|
|
|
|
if (threshold < -88) {
|
|
|
|
|
snprintf (retval, sizeof retval, "%s", str(LANG_DB_INF));
|
|
|
|
|
} else {
|
|
|
|
|
snprintf (retval, sizeof retval, "%ddb", threshold + 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
snprintf (retval, sizeof retval, "%d%%", threshold);
|
|
|
|
|
}
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define INF_DB (-89)
|
|
|
|
|
static void change_threshold(int *threshold, int change)
|
|
|
|
|
{
|
|
|
|
|
if (global_settings.peak_meter_dbfs) {
|
|
|
|
|
if (*threshold >= 0) {
|
|
|
|
|
int db = (calc_db(*threshold * MAX_PEAK / 100) - 9000) / 100;
|
|
|
|
|
*threshold = db;
|
|
|
|
|
}
|
|
|
|
|
*threshold += change;
|
|
|
|
|
if (*threshold > -1) {
|
|
|
|
|
*threshold = INF_DB;
|
|
|
|
|
} else if (*threshold < INF_DB) {
|
|
|
|
|
*threshold = -1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (*threshold < 0) {
|
|
|
|
|
*threshold = peak_meter_db2sample(*threshold * 100) * 100 / MAX_PEAK;
|
|
|
|
|
}
|
|
|
|
|
*threshold += change;
|
|
|
|
|
if (*threshold > 100) {
|
|
|
|
|
*threshold = 0;
|
|
|
|
|
} else if (*threshold < 0) {
|
|
|
|
|
*threshold = 100;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-04 20:16:01 +00:00
|
|
|
|
/* 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
|
|
|
|
|
|
2005-04-04 09:12:12 +00:00
|
|
|
|
/**
|
|
|
|
|
* Displays a menu for editing the trigger settings.
|
|
|
|
|
*/
|
|
|
|
|
bool rectrigger(void)
|
|
|
|
|
{
|
|
|
|
|
int exit_request = false;
|
|
|
|
|
enum trigger_menu_option selected = TRIGGER_MODE;
|
|
|
|
|
bool retval = false;
|
|
|
|
|
int old_x_margin, old_y_margin;
|
|
|
|
|
|
|
|
|
|
#define TRIGGER_MODE_COUNT 3
|
2005-04-04 20:16:01 +00:00
|
|
|
|
static const unsigned char *trigger_modes[] = {
|
|
|
|
|
ID2P(LANG_OFF),
|
|
|
|
|
ID2P(LANG_RECORD_TRIG_NOREARM),
|
|
|
|
|
ID2P(LANG_RECORD_TRIG_REARM)
|
2005-04-04 09:12:12 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define PRERECORD_TIMES_COUNT 31
|
2005-04-04 20:16:01 +00:00
|
|
|
|
static const unsigned char *prerecord_times[] = {
|
|
|
|
|
ID2P(LANG_OFF),"1s","2s", "3s", "4s", "5s", "6s", "7s", "8s", "9s",
|
2005-04-04 09:12:12 +00:00
|
|
|
|
"10s", "11s", "12s", "13s", "14s", "15s", "16s", "17s", "18s", "19s",
|
|
|
|
|
"20s", "21s", "22s", "23s", "24s", "25s", "26s", "27s", "28s", "29s",
|
|
|
|
|
"30s"
|
|
|
|
|
};
|
|
|
|
|
|
2005-04-04 20:16:01 +00:00
|
|
|
|
static const unsigned char *option_name[] = {
|
|
|
|
|
[TRIGGER_MODE] = ID2P(LANG_RECORD_TRIGGER_MODE),
|
|
|
|
|
[PRERECORD_TIME] = ID2P(LANG_RECORD_PRERECORD_TIME),
|
|
|
|
|
[START_THRESHOLD] = ID2P(LANG_RECORD_START_THRESHOLD),
|
|
|
|
|
[START_DURATION] = ID2P(LANG_RECORD_MIN_DURATION),
|
|
|
|
|
[STOP_THRESHOLD] = ID2P(LANG_RECORD_STOP_THRESHOLD),
|
|
|
|
|
[STOP_POSTREC] = ID2P(LANG_RECORD_STOP_POSTREC),
|
|
|
|
|
[STOP_GAP] = ID2P(LANG_RECORD_STOP_GAP)
|
|
|
|
|
};
|
2005-04-04 09:12:12 +00:00
|
|
|
|
|
|
|
|
|
int old_start_thres = global_settings.rec_start_thres;
|
|
|
|
|
int old_start_duration = global_settings.rec_start_duration;
|
|
|
|
|
int old_prerecord_time = global_settings.rec_prerecord_time;
|
|
|
|
|
int old_stop_thres = global_settings.rec_stop_thres;
|
|
|
|
|
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 offset = 0;
|
|
|
|
|
int option_lines;
|
|
|
|
|
int w, h;
|
|
|
|
|
|
|
|
|
|
/* restart trigger with new values */
|
|
|
|
|
settings_apply_trigger();
|
|
|
|
|
peak_meter_trigger (global_settings.rec_trigger_mode != TRIG_MODE_OFF);
|
|
|
|
|
|
|
|
|
|
lcd_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);
|
|
|
|
|
|
|
|
|
|
lcd_getstringsize("M", &w, &h);
|
|
|
|
|
|
|
|
|
|
// two lines are reserved for peak meter and trigger status
|
|
|
|
|
option_lines = (LCD_HEIGHT/h) - (global_settings.statusbar ? 1:0) - 2;
|
|
|
|
|
|
|
|
|
|
while (!exit_request) {
|
|
|
|
|
int stat_height = global_settings.statusbar ? STATUSBAR_HEIGHT : 0;
|
|
|
|
|
int button, i;
|
2005-04-04 20:16:01 +00:00
|
|
|
|
const char *str;
|
2005-04-04 09:12:12 +00:00
|
|
|
|
char option_value[TRIG_OPTION_COUNT][7];
|
|
|
|
|
|
|
|
|
|
snprintf(
|
|
|
|
|
option_value[TRIGGER_MODE],
|
|
|
|
|
sizeof option_value[TRIGGER_MODE],
|
|
|
|
|
"%s",
|
2005-04-04 20:16:01 +00:00
|
|
|
|
P2STR(trigger_modes[global_settings.rec_trigger_mode]));
|
2005-04-04 09:12:12 +00:00
|
|
|
|
|
|
|
|
|
snprintf (
|
|
|
|
|
option_value[PRERECORD_TIME],
|
|
|
|
|
sizeof option_value[PRERECORD_TIME],
|
|
|
|
|
"%s",
|
2005-04-04 20:16:01 +00:00
|
|
|
|
P2STR(prerecord_times[global_settings.rec_prerecord_time]));
|
2005-04-04 09:12:12 +00:00
|
|
|
|
|
|
|
|
|
/* due to value range shift (peak_meter_define_trigger) -1 is 0db */
|
|
|
|
|
if (global_settings.rec_start_thres == -1) {
|
|
|
|
|
str = str(LANG_OFF);
|
|
|
|
|
} else {
|
|
|
|
|
str = create_thres_str(global_settings.rec_start_thres);
|
|
|
|
|
}
|
|
|
|
|
snprintf(
|
|
|
|
|
option_value[START_THRESHOLD],
|
|
|
|
|
sizeof option_value[START_THRESHOLD],
|
|
|
|
|
"%s",
|
|
|
|
|
str);
|
|
|
|
|
|
|
|
|
|
snprintf(
|
|
|
|
|
option_value[START_DURATION],
|
|
|
|
|
sizeof option_value[START_DURATION],
|
|
|
|
|
"%s",
|
|
|
|
|
trig_durations[global_settings.rec_start_duration]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (global_settings.rec_stop_thres <= INF_DB) {
|
|
|
|
|
str = str(LANG_OFF);
|
|
|
|
|
} else {
|
|
|
|
|
str = create_thres_str(global_settings.rec_stop_thres);
|
|
|
|
|
}
|
|
|
|
|
snprintf(
|
|
|
|
|
option_value[STOP_THRESHOLD],
|
|
|
|
|
sizeof option_value[STOP_THRESHOLD],
|
|
|
|
|
"%s",
|
|
|
|
|
str);
|
|
|
|
|
|
|
|
|
|
snprintf(
|
|
|
|
|
option_value[STOP_POSTREC],
|
|
|
|
|
sizeof option_value[STOP_POSTREC],
|
|
|
|
|
"%s",
|
|
|
|
|
trig_durations[global_settings.rec_stop_postrec]);
|
|
|
|
|
|
|
|
|
|
snprintf(
|
|
|
|
|
option_value[STOP_GAP],
|
|
|
|
|
sizeof option_value[STOP_GAP],
|
|
|
|
|
"%s",
|
|
|
|
|
trig_durations[global_settings.rec_stop_gap]);
|
|
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
|
lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
|
lcd_fillrect(0, stat_height, LCD_WIDTH, LCD_HEIGHT - stat_height);
|
|
|
|
|
lcd_set_drawmode(DRMODE_SOLID);
|
2005-11-20 01:02:14 +00:00
|
|
|
|
gui_syncstatusbar_draw(&statusbars, true);
|
2005-04-04 09:12:12 +00:00
|
|
|
|
|
|
|
|
|
/* reselect FONT_SYSFONT as status_draw has changed the font */
|
|
|
|
|
/*lcd_setfont(FONT_SYSFIXED);*/
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < option_lines; i++) {
|
|
|
|
|
int x, y;
|
|
|
|
|
|
2005-04-04 20:16:01 +00:00
|
|
|
|
str = P2STR(option_name[i + offset]);
|
2005-04-04 09:12:12 +00:00
|
|
|
|
lcd_putsxy(5, stat_height + i * h, str);
|
|
|
|
|
|
|
|
|
|
str = option_value[i + offset];
|
|
|
|
|
lcd_getstringsize(str, &w, &h);
|
|
|
|
|
y = stat_height + i * h;
|
|
|
|
|
x = LCD_WIDTH - w;
|
|
|
|
|
lcd_putsxy(x, y, str);
|
2005-06-24 22:33:21 +00:00
|
|
|
|
if ((int)selected == (i + offset)) {
|
|
|
|
|
lcd_set_drawmode(DRMODE_COMPLEMENT);
|
|
|
|
|
lcd_fillrect(x, y, w, h);
|
|
|
|
|
lcd_set_drawmode(DRMODE_SOLID);
|
|
|
|
|
}
|
2005-04-04 09:12:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
scrollbar(0, stat_height,
|
|
|
|
|
4, LCD_HEIGHT - 16 - stat_height,
|
|
|
|
|
TRIG_OPTION_COUNT, offset, offset + option_lines,
|
|
|
|
|
VERTICAL);
|
|
|
|
|
|
|
|
|
|
peak_meter_draw_trig(0, LCD_HEIGHT - 8 - TRIG_HEIGHT);
|
|
|
|
|
|
2006-03-25 13:35:31 +00:00
|
|
|
|
button = peak_meter_draw_get_btn(0, LCD_HEIGHT - 8, 8);
|
2005-04-04 09:12:12 +00:00
|
|
|
|
|
|
|
|
|
lcd_update();
|
|
|
|
|
|
|
|
|
|
switch (button) {
|
2005-04-04 20:16:01 +00:00
|
|
|
|
case TRIG_CANCEL:
|
2006-02-19 12:45:32 +00:00
|
|
|
|
gui_syncsplash(50, true, str(LANG_MENU_SETTING_CANCEL));
|
2005-04-04 09:12:12 +00:00
|
|
|
|
global_settings.rec_start_thres = old_start_thres;
|
|
|
|
|
global_settings.rec_start_duration = old_start_duration;
|
|
|
|
|
global_settings.rec_prerecord_time = old_prerecord_time;
|
|
|
|
|
global_settings.rec_stop_thres = old_stop_thres;
|
|
|
|
|
global_settings.rec_stop_postrec = old_stop_postrec;
|
|
|
|
|
global_settings.rec_stop_gap = old_stop_gap;
|
|
|
|
|
global_settings.rec_trigger_mode = old_trigger_mode;
|
|
|
|
|
exit_request = true;
|
|
|
|
|
break;
|
|
|
|
|
|
2005-04-04 20:16:01 +00:00
|
|
|
|
case TRIG_ACCEPT:
|
2005-04-04 09:12:12 +00:00
|
|
|
|
exit_request = true;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BUTTON_UP:
|
|
|
|
|
selected += TRIG_OPTION_COUNT - 1;
|
|
|
|
|
selected %= TRIG_OPTION_COUNT;
|
|
|
|
|
offset = MIN(offset, (int)selected);
|
|
|
|
|
offset = MAX(offset, (int)selected - option_lines + 1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BUTTON_DOWN:
|
|
|
|
|
selected ++;
|
|
|
|
|
selected %= TRIG_OPTION_COUNT;
|
|
|
|
|
offset = MIN(offset, (int)selected);
|
|
|
|
|
offset = MAX(offset, (int)selected - option_lines + 1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BUTTON_RIGHT:
|
|
|
|
|
case BUTTON_RIGHT | BUTTON_REPEAT:
|
|
|
|
|
switch (selected) {
|
|
|
|
|
case TRIGGER_MODE:
|
|
|
|
|
global_settings.rec_trigger_mode ++;
|
|
|
|
|
global_settings.rec_trigger_mode %= TRIGGER_MODE_COUNT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PRERECORD_TIME:
|
|
|
|
|
global_settings.rec_prerecord_time ++;
|
|
|
|
|
global_settings.rec_prerecord_time %= PRERECORD_TIMES_COUNT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case START_THRESHOLD:
|
|
|
|
|
change_threshold(&global_settings.rec_start_thres, 1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case START_DURATION:
|
|
|
|
|
global_settings.rec_start_duration ++;
|
|
|
|
|
global_settings.rec_start_duration %= TRIG_DURATION_COUNT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STOP_THRESHOLD:
|
|
|
|
|
change_threshold(&global_settings.rec_stop_thres, 1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STOP_POSTREC:
|
|
|
|
|
global_settings.rec_stop_postrec ++;
|
|
|
|
|
global_settings.rec_stop_postrec %= TRIG_DURATION_COUNT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STOP_GAP:
|
|
|
|
|
global_settings.rec_stop_gap ++;
|
|
|
|
|
global_settings.rec_stop_gap %= TRIG_DURATION_COUNT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TRIG_OPTION_COUNT:
|
|
|
|
|
// avoid compiler warnings
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
peak_meter_trigger(global_settings.rec_trigger_mode!=TRIG_OFF);
|
|
|
|
|
settings_apply_trigger();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BUTTON_LEFT:
|
|
|
|
|
case BUTTON_LEFT | BUTTON_REPEAT:
|
|
|
|
|
switch (selected) {
|
|
|
|
|
case TRIGGER_MODE:
|
|
|
|
|
global_settings.rec_trigger_mode+=TRIGGER_MODE_COUNT-1;
|
|
|
|
|
global_settings.rec_trigger_mode %= TRIGGER_MODE_COUNT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PRERECORD_TIME:
|
|
|
|
|
global_settings.rec_prerecord_time += PRERECORD_TIMES_COUNT - 1;
|
|
|
|
|
global_settings.rec_prerecord_time %= PRERECORD_TIMES_COUNT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case START_THRESHOLD:
|
|
|
|
|
change_threshold(&global_settings.rec_start_thres, -1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case START_DURATION:
|
|
|
|
|
global_settings.rec_start_duration += TRIG_DURATION_COUNT-1;
|
|
|
|
|
global_settings.rec_start_duration %= TRIG_DURATION_COUNT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STOP_THRESHOLD:
|
|
|
|
|
change_threshold(&global_settings.rec_stop_thres, -1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STOP_POSTREC:
|
|
|
|
|
global_settings.rec_stop_postrec +=
|
|
|
|
|
TRIG_DURATION_COUNT - 1;
|
|
|
|
|
global_settings.rec_stop_postrec %=
|
|
|
|
|
TRIG_DURATION_COUNT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case STOP_GAP:
|
|
|
|
|
global_settings.rec_stop_gap +=
|
|
|
|
|
TRIG_DURATION_COUNT - 1;
|
|
|
|
|
global_settings.rec_stop_gap %= TRIG_DURATION_COUNT;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TRIG_OPTION_COUNT:
|
|
|
|
|
// avoid compiler warnings
|
|
|
|
|
break;
|
|
|
|
|
}
|
2005-09-26 00:15:55 +00:00
|
|
|
|
peak_meter_trigger(global_settings.rec_trigger_mode!=TRIG_OFF);
|
|
|
|
|
settings_apply_trigger();
|
2005-04-04 09:12:12 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2005-04-04 20:16:01 +00:00
|
|
|
|
#ifdef TRIG_RESET_SIM
|
|
|
|
|
case TRIG_RESET_SIM:
|
2005-04-04 09:12:12 +00:00
|
|
|
|
peak_meter_trigger(true);
|
|
|
|
|
break;
|
2005-04-04 20:16:01 +00:00
|
|
|
|
#endif
|
2005-04-04 09:12:12 +00:00
|
|
|
|
|
|
|
|
|
case SYS_USB_CONNECTED:
|
2005-04-04 11:07:14 +00:00
|
|
|
|
if(default_event_handler(button) == SYS_USB_CONNECTED) {
|
|
|
|
|
retval = true;
|
|
|
|
|
exit_request = true;
|
|
|
|
|
}
|
2005-04-04 09:12:12 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
peak_meter_trigger(false);
|
|
|
|
|
lcd_setfont(FONT_UI);
|
|
|
|
|
lcd_setmargins(old_x_margin, old_y_margin);
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2003-11-20 00:33:43 +00:00
|
|
|
|
bool recording_menu(bool no_source)
|
2002-11-10 23:18:33 +00:00
|
|
|
|
{
|
|
|
|
|
int m;
|
2003-11-20 00:33:43 +00:00
|
|
|
|
int i = 0;
|
2005-11-12 04:00:56 +00:00
|
|
|
|
struct menu_item items[13];
|
2002-11-10 23:18:33 +00:00
|
|
|
|
bool result;
|
2003-11-20 00:33:43 +00:00
|
|
|
|
|
2006-02-08 13:08:55 +00:00
|
|
|
|
#ifndef HAVE_UDA1380
|
2004-07-23 23:01:20 +00:00
|
|
|
|
items[i].desc = ID2P(LANG_RECORDING_QUALITY);
|
2004-03-16 13:44:56 +00:00
|
|
|
|
items[i++].function = recquality;
|
2006-02-08 13:08:55 +00:00
|
|
|
|
#endif
|
2004-07-23 23:01:20 +00:00
|
|
|
|
items[i].desc = ID2P(LANG_RECORDING_FREQUENCY);
|
2004-03-16 13:44:56 +00:00
|
|
|
|
items[i++].function = recfrequency;
|
2003-11-20 00:33:43 +00:00
|
|
|
|
if(!no_source) {
|
2004-07-23 23:01:20 +00:00
|
|
|
|
items[i].desc = ID2P(LANG_RECORDING_SOURCE);
|
2004-03-16 13:44:56 +00:00
|
|
|
|
items[i++].function = recsource;
|
2003-11-20 00:33:43 +00:00
|
|
|
|
}
|
2004-07-23 23:01:20 +00:00
|
|
|
|
items[i].desc = ID2P(LANG_RECORDING_CHANNELS);
|
2004-03-16 13:44:56 +00:00
|
|
|
|
items[i++].function = recchannels;
|
2004-07-23 23:01:20 +00:00
|
|
|
|
items[i].desc = ID2P(LANG_RECORDING_EDITABLE);
|
2004-03-16 13:44:56 +00:00
|
|
|
|
items[i++].function = receditable;
|
2004-07-23 23:01:20 +00:00
|
|
|
|
items[i].desc = ID2P(LANG_RECORD_TIMESPLIT);
|
2004-03-16 13:44:56 +00:00
|
|
|
|
items[i++].function = rectimesplit;
|
2004-07-23 23:01:20 +00:00
|
|
|
|
items[i].desc = ID2P(LANG_RECORD_PRERECORD_TIME);
|
2004-03-16 13:44:56 +00:00
|
|
|
|
items[i++].function = recprerecord;
|
2004-07-23 23:01:20 +00:00
|
|
|
|
items[i].desc = ID2P(LANG_RECORD_DIRECTORY);
|
2004-03-16 13:44:56 +00:00
|
|
|
|
items[i++].function = recdirectory;
|
2005-02-04 10:37:21 +00:00
|
|
|
|
items[i].desc = ID2P(LANG_RECORD_STARTUP);
|
|
|
|
|
items[i++].function = reconstartup;
|
2006-02-17 22:47:56 +00:00
|
|
|
|
#ifdef CONFIG_BACKLIGHT
|
|
|
|
|
items[i].desc = ID2P(LANG_CLIP_LIGHT);
|
|
|
|
|
items[i++].function = cliplight;
|
|
|
|
|
#endif
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if !defined(SIMULATOR) && CONFIG_CODEC == MAS3587F
|
2005-09-27 22:42:37 +00:00
|
|
|
|
items[i].desc = ID2P(LANG_RECORD_TRIGGER);
|
2005-04-04 09:12:12 +00:00
|
|
|
|
items[i++].function = rectrigger;
|
|
|
|
|
#endif
|
2004-03-16 13:44:56 +00:00
|
|
|
|
|
|
|
|
|
m=menu_init( items, i, NULL, NULL, NULL, NULL);
|
2002-11-10 23:18:33 +00:00
|
|
|
|
result = menu_run(m);
|
|
|
|
|
menu_exit(m);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endif
|