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-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-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;
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
lcd_puts_scroll(0,0,string);
|
|
|
|
|
|
|
|
|
|
while (!done) {
|
|
|
|
|
val = mpeg_val2phys(setting, *variable);
|
2002-06-28 12:40:32 +00:00
|
|
|
|
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 11:48:53 +00:00
|
|
|
|
lcd_puts(0,1,str);
|
|
|
|
|
lcd_update();
|
|
|
|
|
|
|
|
|
|
switch( button_get(true) ) {
|
|
|
|
|
#ifdef HAVE_RECORDER_KEYPAD
|
|
|
|
|
case BUTTON_UP:
|
|
|
|
|
#else
|
|
|
|
|
case BUTTON_RIGHT:
|
|
|
|
|
#endif
|
|
|
|
|
(*variable)++;
|
|
|
|
|
if(*variable > max )
|
|
|
|
|
*variable = max;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_RECORDER_KEYPAD
|
|
|
|
|
case BUTTON_DOWN:
|
|
|
|
|
#else
|
|
|
|
|
case BUTTON_LEFT:
|
|
|
|
|
#endif
|
|
|
|
|
(*variable)--;
|
|
|
|
|
if(*variable < min )
|
|
|
|
|
*variable = min;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_RECORDER_KEYPAD
|
|
|
|
|
case BUTTON_LEFT:
|
|
|
|
|
#else
|
|
|
|
|
case BUTTON_STOP:
|
|
|
|
|
case BUTTON_MENU:
|
|
|
|
|
#endif
|
|
|
|
|
done = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
mpeg_sound_set(setting, *variable);
|
|
|
|
|
}
|
|
|
|
|
lcd_stop_scroll();
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-26 17:03:52 +00:00
|
|
|
|
static void volume(void)
|
|
|
|
|
{
|
2002-06-28 11:48:53 +00:00
|
|
|
|
set_sound("Volume", &global_settings.volume, SOUND_VOLUME);
|
2002-05-26 17:03:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void bass(void)
|
|
|
|
|
{
|
2002-06-28 11:48:53 +00:00
|
|
|
|
set_sound("Bass", &global_settings.bass, SOUND_BASS);
|
2002-05-26 17:03:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void treble(void)
|
|
|
|
|
{
|
2002-06-28 11:48:53 +00:00
|
|
|
|
set_sound("Treble", &global_settings.treble, SOUND_TREBLE);
|
2002-05-26 17:03:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sound_menu(void)
|
|
|
|
|
{
|
|
|
|
|
int m;
|
|
|
|
|
struct menu_items items[] = {
|
2002-06-27 01:08:11 +00:00
|
|
|
|
{ "Volume", volume },
|
|
|
|
|
{ "Bass", bass },
|
|
|
|
|
{ "Treble", treble }
|
2002-05-26 17:03:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
m=menu_init( items, sizeof items / sizeof(struct menu_items) );
|
|
|
|
|
menu_run(m);
|
|
|
|
|
menu_exit(m);
|
|
|
|
|
}
|