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>
|
|
|
|
|
#include <stdbool.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"
|
2002-05-26 17:03:52 +00:00
|
|
|
|
#include "mpeg.h"
|
2002-06-19 14:58:57 +00:00
|
|
|
|
#include "settings.h"
|
2002-08-13 09:15:21 +00:00
|
|
|
|
#include "status.h"
|
2002-08-20 19:37:00 +00:00
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
|
#include "icons.h"
|
|
|
|
|
#endif
|
2002-05-26 17:03:52 +00:00
|
|
|
|
|
2002-06-28 12:40:32 +00:00
|
|
|
|
static char *fmt[] =
|
|
|
|
|
{
|
|
|
|
|
"", /* no decimals */
|
|
|
|
|
"%d.%d %s ", /* 1 decimal */
|
|
|
|
|
"%d.%02d %s " /* 2 decimals */
|
|
|
|
|
};
|
|
|
|
|
|
2002-06-28 11:48:53 +00:00
|
|
|
|
void set_sound(char* string,
|
|
|
|
|
int* variable,
|
|
|
|
|
int setting)
|
|
|
|
|
{
|
|
|
|
|
bool done = false;
|
2002-08-20 20:30:32 +00:00
|
|
|
|
bool changed = true;
|
2002-06-28 11:48:53 +00:00
|
|
|
|
int min, max;
|
|
|
|
|
int val;
|
2002-06-28 12:40:32 +00:00
|
|
|
|
int numdec;
|
|
|
|
|
int integer;
|
|
|
|
|
int dec;
|
2002-06-28 11:48:53 +00:00
|
|
|
|
char* unit;
|
|
|
|
|
char str[32];
|
|
|
|
|
|
|
|
|
|
unit = mpeg_sound_unit(setting);
|
2002-06-28 12:40:32 +00:00
|
|
|
|
numdec = mpeg_sound_numdecimals(setting);
|
2002-06-28 11:48:53 +00:00
|
|
|
|
min = mpeg_sound_min(setting);
|
|
|
|
|
max = mpeg_sound_max(setting);
|
|
|
|
|
|
2002-08-20 19:37:00 +00:00
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
|
if(global_settings.statusbar)
|
|
|
|
|
lcd_setmargins(0, STATUSBAR_HEIGHT);
|
|
|
|
|
else
|
|
|
|
|
lcd_setmargins(0, 0);
|
|
|
|
|
#endif
|
2002-06-28 11:48:53 +00:00
|
|
|
|
lcd_clear_display();
|
|
|
|
|
lcd_puts_scroll(0,0,string);
|
|
|
|
|
|
|
|
|
|
while (!done) {
|
2002-08-20 19:37:00 +00:00
|
|
|
|
if (changed) {
|
|
|
|
|
val = mpeg_val2phys(setting, *variable);
|
|
|
|
|
if(numdec)
|
|
|
|
|
{
|
|
|
|
|
integer = val / (10 * numdec);
|
|
|
|
|
dec = val % (10 * numdec);
|
|
|
|
|
snprintf(str,sizeof str, fmt[numdec], integer, dec, unit);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
snprintf(str,sizeof str,"%d %s ", val, unit);
|
|
|
|
|
}
|
2002-06-28 12:40:32 +00:00
|
|
|
|
}
|
2002-06-28 11:48:53 +00:00
|
|
|
|
lcd_puts(0,1,str);
|
2002-08-13 09:15:21 +00:00
|
|
|
|
status_draw();
|
2002-08-20 19:37:00 +00:00
|
|
|
|
lcd_update();
|
2002-06-28 11:48:53 +00:00
|
|
|
|
|
2002-08-20 19:37:00 +00:00
|
|
|
|
changed = false;
|
|
|
|
|
switch( button_get_w_tmo(HZ/2) ) {
|
2002-06-28 11:48:53 +00:00
|
|
|
|
#ifdef HAVE_RECORDER_KEYPAD
|
|
|
|
|
case BUTTON_UP:
|
2002-07-27 22:45:29 +00:00
|
|
|
|
case BUTTON_UP | BUTTON_REPEAT:
|
2002-06-28 11:48:53 +00:00
|
|
|
|
#else
|
|
|
|
|
case BUTTON_RIGHT:
|
2002-07-27 22:45:29 +00:00
|
|
|
|
case BUTTON_RIGHT | BUTTON_REPEAT:
|
2002-06-28 11:48:53 +00:00
|
|
|
|
#endif
|
|
|
|
|
(*variable)++;
|
|
|
|
|
if(*variable > max )
|
|
|
|
|
*variable = max;
|
2002-08-20 19:37:00 +00:00
|
|
|
|
changed = true;
|
2002-06-28 11:48:53 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_RECORDER_KEYPAD
|
|
|
|
|
case BUTTON_DOWN:
|
2002-07-27 22:45:29 +00:00
|
|
|
|
case BUTTON_DOWN | BUTTON_REPEAT:
|
2002-06-28 11:48:53 +00:00
|
|
|
|
#else
|
|
|
|
|
case BUTTON_LEFT:
|
2002-07-27 22:45:29 +00:00
|
|
|
|
case BUTTON_LEFT | BUTTON_REPEAT:
|
2002-06-28 11:48:53 +00:00
|
|
|
|
#endif
|
|
|
|
|
(*variable)--;
|
|
|
|
|
if(*variable < min )
|
|
|
|
|
*variable = min;
|
2002-08-20 19:37:00 +00:00
|
|
|
|
changed = true;
|
2002-06-28 11:48:53 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_RECORDER_KEYPAD
|
|
|
|
|
case BUTTON_LEFT:
|
|
|
|
|
#else
|
|
|
|
|
case BUTTON_STOP:
|
|
|
|
|
case BUTTON_MENU:
|
|
|
|
|
#endif
|
|
|
|
|
done = true;
|
|
|
|
|
break;
|
2002-08-20 19:37:00 +00:00
|
|
|
|
#ifdef HAVE_RECORDER_KEYPAD
|
|
|
|
|
case BUTTON_F3:
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
|
global_settings.statusbar = !global_settings.statusbar;
|
|
|
|
|
settings_save();
|
|
|
|
|
if(global_settings.statusbar)
|
|
|
|
|
lcd_setmargins(0, STATUSBAR_HEIGHT);
|
|
|
|
|
else
|
|
|
|
|
lcd_setmargins(0, 0);
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
lcd_puts_scroll(0, 0, string);
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
#endif
|
2002-06-28 11:48:53 +00:00
|
|
|
|
}
|
2002-08-20 19:37:00 +00:00
|
|
|
|
if (changed) {
|
|
|
|
|
mpeg_sound_set(setting, *variable);
|
2002-08-14 21:30:06 +00:00
|
|
|
|
#ifdef HAVE_MAS3507D
|
2002-08-20 19:37:00 +00:00
|
|
|
|
if(setting == SOUND_BALANCE)
|
|
|
|
|
mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
|
2002-08-14 21:30:06 +00:00
|
|
|
|
#endif
|
2002-08-20 19:37:00 +00:00
|
|
|
|
}
|
2002-06-28 11:48:53 +00:00
|
|
|
|
}
|
|
|
|
|
lcd_stop_scroll();
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-23 12:32:52 +00:00
|
|
|
|
static Menu volume(void)
|
2002-05-26 17:03:52 +00:00
|
|
|
|
{
|
2002-06-28 11:48:53 +00:00
|
|
|
|
set_sound("Volume", &global_settings.volume, SOUND_VOLUME);
|
2002-08-23 12:32:52 +00:00
|
|
|
|
return MENU_OK;
|
2002-05-26 17:03:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-08-23 12:32:52 +00:00
|
|
|
|
static Menu balance(void)
|
2002-08-14 21:30:06 +00:00
|
|
|
|
{
|
|
|
|
|
set_sound("Balance", &global_settings.balance, SOUND_BALANCE);
|
2002-08-23 12:32:52 +00:00
|
|
|
|
return MENU_OK;
|
2002-08-14 21:30:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-08-23 12:32:52 +00:00
|
|
|
|
static Menu bass(void)
|
2002-05-26 17:03:52 +00:00
|
|
|
|
{
|
2002-06-28 11:48:53 +00:00
|
|
|
|
set_sound("Bass", &global_settings.bass, SOUND_BASS);
|
2002-08-23 12:32:52 +00:00
|
|
|
|
return MENU_OK;
|
2002-05-26 17:03:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2002-08-23 12:32:52 +00:00
|
|
|
|
static Menu treble(void)
|
2002-05-26 17:03:52 +00:00
|
|
|
|
{
|
2002-06-28 11:48:53 +00:00
|
|
|
|
set_sound("Treble", &global_settings.treble, SOUND_TREBLE);
|
2002-08-23 12:32:52 +00:00
|
|
|
|
return MENU_OK;
|
2002-05-26 17:03:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-08-08 20:44:25 +00:00
|
|
|
|
#ifdef HAVE_MAS3587F
|
2002-08-23 12:32:52 +00:00
|
|
|
|
static Menu loudness(void)
|
2002-07-22 16:39:17 +00:00
|
|
|
|
{
|
|
|
|
|
set_sound("Loudness", &global_settings.loudness, SOUND_LOUDNESS);
|
2002-08-23 12:32:52 +00:00
|
|
|
|
return MENU_OK;
|
2002-07-22 16:39:17 +00:00
|
|
|
|
};
|
|
|
|
|
|
2002-08-23 12:32:52 +00:00
|
|
|
|
static Menu bass_boost(void)
|
2002-07-22 16:39:17 +00:00
|
|
|
|
{
|
|
|
|
|
set_sound("Bass boost", &global_settings.bass_boost, SOUND_SUPERBASS);
|
2002-08-23 12:32:52 +00:00
|
|
|
|
return MENU_OK;
|
2002-07-22 16:39:17 +00:00
|
|
|
|
};
|
2002-07-25 15:55:22 +00:00
|
|
|
|
|
2002-08-23 12:32:52 +00:00
|
|
|
|
static Menu avc(void)
|
2002-07-25 15:55:22 +00:00
|
|
|
|
{
|
|
|
|
|
char* names[] = { "off", "2s ", "4s ", "8s " };
|
2002-07-26 14:32:07 +00:00
|
|
|
|
set_option("[AV decay time]", &global_settings.avc, names, 4 );
|
2002-07-25 15:55:22 +00:00
|
|
|
|
mpeg_sound_set(SOUND_AVC, global_settings.avc);
|
2002-08-23 12:32:52 +00:00
|
|
|
|
return MENU_OK;
|
2002-07-25 15:55:22 +00:00
|
|
|
|
}
|
2002-07-22 16:39:17 +00:00
|
|
|
|
#endif /* ARCHOS_RECORDER */
|
|
|
|
|
|
2002-08-23 12:32:52 +00:00
|
|
|
|
Menu sound_menu(void)
|
2002-05-26 17:03:52 +00:00
|
|
|
|
{
|
|
|
|
|
int m;
|
2002-08-23 12:32:52 +00:00
|
|
|
|
Menu result;
|
2002-05-26 17:03:52 +00:00
|
|
|
|
struct menu_items items[] = {
|
2002-06-27 01:08:11 +00:00
|
|
|
|
{ "Volume", volume },
|
|
|
|
|
{ "Bass", bass },
|
2002-07-22 16:39:17 +00:00
|
|
|
|
{ "Treble", treble },
|
2002-08-14 21:30:06 +00:00
|
|
|
|
{ "Balance", balance },
|
2002-08-08 20:44:25 +00:00
|
|
|
|
#ifdef HAVE_MAS3587F
|
2002-07-22 16:39:17 +00:00
|
|
|
|
{ "Loudness", loudness },
|
2002-07-25 15:55:22 +00:00
|
|
|
|
{ "Bass Boost", bass_boost },
|
2002-07-26 14:32:07 +00:00
|
|
|
|
{ "Auto Volume", avc }
|
2002-07-22 16:39:17 +00:00
|
|
|
|
#endif
|
2002-05-26 17:03:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
m=menu_init( items, sizeof items / sizeof(struct menu_items) );
|
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
|
|
|
|
|
|
|
|
|
return result;
|
2002-05-26 17:03:52 +00:00
|
|
|
|
}
|