diff -urN rockbox-old/apps/enhanced_menu.c rockbox-new/apps/enhanced_menu.c --- rockbox-old/apps/enhanced_menu.c 1970-01-01 01:00:00.000000000 +0100 +++ rockbox-new/apps/enhanced_menu.c 2003-08-26 14:18:26.000000000 +0200 @@ -0,0 +1,553 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: menu.c,v 1.59 2003/06/05 09:38:24 zagor Exp $ + * + * Copyright (C) 2002 Robert E. Hak + * + * 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. + * + ****************************************************************************/ +#include +#include +#include "sprintf.h" +#include "hwcompat.h" +#include "lcd.h" +#include "font.h" +#include "backlight.h" +#include "menu.h" +#include "enhanced_menu.h" +#include "button.h" +#include "kernel.h" +#include "debug.h" +#include "usb.h" +#include "panic.h" +#include "settings.h" +#include "status.h" +#include "screens.h" + +#ifdef HAVE_LCD_BITMAP +#include "icons.h" +#include "widgets.h" +#endif + +struct menu_enh { + int top; + int cursor; + struct menu_items_enh* items; + int itemcount; +}; + +#define MAX_MENUS 4 +static struct menu_enh menus[MAX_MENUS]; +static bool inuse[MAX_MENUS] = { false }; + +static int item_position(int m, int item) +{ + if (item>menus[m].itemcount) + item=menus[m].itemcount; + else if (item<0) + item=0; + +#ifdef HAVE_LCD_BITMAP + int itempos=item; + int i; + for (i=0; imenu_lines) { + menus[m].top++; + } + + itemcount=menus[m].top; + + /* adjusts # of items to be displayed */ + + while (item_position(m,itemcount)-item_position(m,menus[m].top)max) + parameter=max; + else if (parameterparam_length2)? param_length1 : + param_length2; + + length=LCD_WIDTH-posX-3*fw-param_length-2; + propertybar(posX+fw,posY+fh+1, + length,fh-2, percent, + Grow_Right); + + break; + + case CHECKBOX: + checkbox(posX+1,posY+1,fh-2,parameter); + posX+=fh+2; + break; + + case ARROW: + for (j=min; jparam_length2)? + param_length1:param_length2; + }; + + snprintf(param_buf, 20, "%s", menus[m].items[i].units[parameter]); + lcd_getstringsize(param_buf, ¶m_length, &fh); + lcd_clearrect(posX, posY+fh, LCD_WIDTH, fh); + + length=LCD_WIDTH-4-posX-3*fw-param_length; + if (length<3*fh) { + length=3*fh-2; + if (menus[m].cursor==i) + lcd_putsxy_scroll(posX+3*fh+fw, posY+fh, param_buf); + else + lcd_putsxy(posX+3*fh+fw, posY+fh, param_buf); + }else { + lcd_putsxy(LCD_WIDTH-2-param_length, posY+fh, param_buf); + }; + + arrow(posX+fw/2+2, posY+fh, length, fh, Point_Right); + + break; + }; + +#endif + + if(current_cursor_position(m)==item_position(m,i)-item_position(m,menus[m].top)) + +#ifdef HAVE_LCD_BITMAP + + if (global_settings.invert_cursor) + lcd_putsxy_scroll_style(posX, posY, + text_to_display, STYLE_INVERT); + else + lcd_putsxy_scroll(posX, posY, text_to_display); + else + lcd_putsxy(posX, posY, text_to_display); +#else + lcd_puts_scroll(posX, posY, text_to_display); + else + lcd_puts(posX, posY, text_to_display); + +#endif + } + + /* place the cursor */ + put_cursorxy(CURSOR_X, current_cursor_position(m), true); +#ifdef HAVE_LCD_BITMAP + if (global_settings.scrollbar && menus[m].itemcount > menu_lines) + scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, + LCD_HEIGHT - SCROLLBAR_Y, menus[m].itemcount, menus[m].top, + menus[m].top + menu_lines, VERTICAL); +#endif + status_draw(true); + lcd_update(); +} + +static void put_cursor(int m, int target) +{ + bool do_update = true; + +#ifdef HAVE_LCD_BITMAP + int fw, fh; + int menu_lines; + lcd_getstringsize("A", &fw, &fh); + + if (global_settings.statusbar) + menu_lines = (LCD_HEIGHT - STATUSBAR_HEIGHT) / fh; + else + menu_lines = LCD_HEIGHT/fh; +#else + int menu_lines = MENU_LINES; +#endif + + put_cursorxy(CURSOR_X, current_cursor_position(m), false); + + int diff_with_target=item_position(m,target)-item_position(m,menus[m].top); + menus[m].cursor = target; + + menu_draw_enh(m); + + int target_size=1; + +#ifdef HAVE_LCD_BITMAP + if (menus[m].items[target].type==SLIDEBAR || + menus[m].items[target].type==ARROW) + target_size++; +#endif + + while (diff_with_target<0) { + menus[m].top--; + diff_with_target=item_position(m,target)-item_position(m,menus[m].top); + } + + while (diff_with_target > menu_lines-target_size ) { + menus[m].top++; + diff_with_target=item_position(m,target)-item_position(m,menus[m].top); + } + + menu_draw_enh(m); + do_update = false; + + if (do_update && !global_settings.invert_cursor) { + put_cursorxy(CURSOR_X, current_cursor_position(m), true); + lcd_update(); + } + +} + +int menu_init_enh(struct menu_items_enh* mitems, int count) +{ + int i; + + for ( i=0; imax) + menus[m].items[menus[m].cursor].parameter=min; + + result=menus[m].items[menus[m].cursor].function(menus[m].items[menus[m].cursor].parameter); + menu_draw_enh(m); + } + else { + lcd_clear_display(); + return menus[m].cursor; + }; + break; +#endif + +#ifdef HAVE_RECORDER_KEYPAD + case BUTTON_LEFT: + case BUTTON_LEFT | BUTTON_REPEAT: + + if (menus[m].items[menus[m].cursor].type==SLIDEBAR || + menus[m].items[menus[m].cursor].type==CHECKBOX || + menus[m].items[menus[m].cursor].type==ARROW) { + menus[m].items[menus[m].cursor].parameter-= + menus[m].items[menus[m].cursor].step; + if(menus[m].items[menus[m].cursor].parameter ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: menu.h,v 1.12 2003/01/29 08:26:10 kjer Exp $ + * + * Copyright (C) 2002 Robert E. Hak + * + * 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. + * + ****************************************************************************/ + +#ifndef __ADVANCED_MENU_H__ +#define __ADVANCED_MENU_H__ + +#include + +struct menu_items_enh { + unsigned char *desc; + bool (*function) (int parameter); /* return true if USB was connected */ + int type; + int parameter; /* checkbox/scrollbar value, if there's one */ + int min; + int max; + int step; + char *units[30]; +}; + +int menu_init_enh(struct menu_items_enh* items, int count); +void menu_exit_enh(int menu); + + /* Returns below define, or number of selected menu item*/ +int menu_show_enh(int m); + +bool menu_run_enh(int menu); + +enum { + NORMAL_MENU=0, + SLIDEBAR=1, + CHECKBOX=2, + ARROW=3 +}; + +#endif /* End __ADVANCED_MENU_H__ */ + + + diff -urN rockbox-old/apps/lang/english.lang rockbox-new/apps/lang/english.lang --- rockbox-old/apps/lang/english.lang 2003-08-06 06:00:28.000000000 +0200 +++ rockbox-new/apps/lang/english.lang 2003-08-26 20:28:04.000000000 +0200 @@ -1401,8 +1401,8 @@ new: id: LANG_FADE_ON_STOP -desc: options menu to set fade on stop or pause -eng: "Fade On Stop/Pause" +desc: fade on stop or pause +eng: "on Stop/Pause" new: id: LANG_SOKOBAN_ON @@ -1727,3 +1727,58 @@ desc: Asked from onplay screen eng: "Recursively?" new: + +id: LANG_BATTERY_DISPLAY_NUMERIC +desc: Battery type title +eng: "Numeric Battery Display" +new: + +id: LANG_VOLUME_DISPLAY_NUMERIC +desc: Volume type title +eng: "Numeric Volume Display" +new: + +id: LANG_INVERT_CHECKBOX +desc: in settings_menu +eng: "Inverted LCD" +new: + +id: LANG_PM_RELEASE_AND_UNITS +desc: in the peak meter menu +eng: "Peak Release (In Units Per Read)" +new: + +id: LANG_PM_SCALE_CHECKBOX +desc: in the peak meter menu +eng: "Logarithmic Scale" +new: + +id: LANG_BBOOST_STR +desc: MDB related +eng: "Superbass Strength" +new: + +id: LANG_BBOOST_HAR +desc: MDB related +eng: "Superbass Harmonics" +new: + +id: LANG_BBOOST_FC +desc: MDB related +eng: "Superbass Cutoff Frequency" +new: + +id: LANG_BBOOST_SWITCH +desc: MDB related +eng: "Superbass Activated" +new: + +id: LANG_ADV_BBOOST +desc: MDB related +eng: "Advanced Superbass" +new: + +id: LANG_CHANNEL_STEREO_CHECKBOX +desc; Channel option +eng: "Stereo recording" +new: \ No newline at end of file diff -urN rockbox-old/apps/main.c rockbox-new/apps/main.c --- rockbox-old/apps/main.c 2003-08-26 06:00:10.000000000 +0200 +++ rockbox-new/apps/main.c 2003-08-26 20:02:21.000000000 +0200 @@ -94,6 +94,10 @@ global_settings.balance, global_settings.loudness, global_settings.bass_boost, + global_settings.bboost_str, + global_settings.bboost_har, + global_settings.bboost_fc, + global_settings.bboost_on, global_settings.avc, global_settings.channel_config ); while (button_get(false) != 0) @@ -119,7 +123,7 @@ buffer_init(); settings_reset(); - + lcd_init(); font_init(); @@ -139,9 +143,9 @@ #endif adc_init(); - + usb_init(); - + backlight_init(); button_init(); @@ -172,7 +176,7 @@ #endif panicf("ata: %d", rc); } - + pinfo = disk_init(); if (!pinfo) panicf("disk: NULL"); @@ -196,7 +200,7 @@ } settings_load(); - + status_init(); usb_start_monitoring(); playlist_init(); @@ -210,6 +214,10 @@ global_settings.balance, global_settings.loudness, global_settings.bass_boost, + global_settings.bboost_str, + global_settings.bboost_har, + global_settings.bboost_fc, + global_settings.bboost_on, global_settings.avc, global_settings.channel_config ); @@ -219,7 +227,7 @@ { /* when starting from flash, this time _we_ have to yield */ int fd; #ifdef ARCHOS_PLAYER - static const char filename[] = "/archos.mod"; + static const char filename[] = "/archos.mod"; #else static const char filename[] = "/ajbrec.ajz"; #endif @@ -256,7 +264,7 @@ startup_io.port16[0x16A/2] = *((volatile unsigned short*)0x5FFFF6A); startup_io.port16[0x17A/2] = *((volatile unsigned short*)0x5FFFF7A); /* end of diagnostic */ - + app_main(); while(1) { diff -urN rockbox-old/apps/menu.c rockbox-new/apps/menu.c --- rockbox-old/apps/menu.c 2003-06-06 06:00:28.000000000 +0200 +++ rockbox-new/apps/menu.c 2003-08-25 15:42:15.000000000 +0200 @@ -107,7 +107,7 @@ /* place the cursor */ if(on) { #ifdef HAVE_LCD_BITMAP - lcd_bitmap ( bitmap_icons_6x8[Cursor], + lcd_bitmap ( bitmap_icons_6x8[Cursor], xpos, ypos, 4, 8, true); #else lcd_putc(x, y, CURSOR_CHAR); @@ -128,6 +128,7 @@ int i = 0; #ifdef HAVE_LCD_BITMAP int fw, fh; + int menu_lines; lcd_setfont(FONT_UI); lcd_getstringsize("A", &fw, &fh); @@ -147,11 +148,14 @@ if (menus[m].cursor - menus[m].top >= menu_lines) menus[m].top++; - for (i = menus[m].top; + for (i = menus[m].top; (i < menus[m].itemcount) && (i menu_lines) + if (global_settings.scrollbar && menus[m].itemcount > menu_lines) scrollbar(SCROLLBAR_X, SCROLLBAR_Y, SCROLLBAR_WIDTH - 1, LCD_HEIGHT - SCROLLBAR_Y, menus[m].itemcount, menus[m].top, menus[m].top + menu_lines, VERTICAL); @@ -174,9 +178,9 @@ lcd_update(); } -/* - * Move the cursor to a particular id, - * target: where you want it to be +/* + * Move the cursor to a particular id, + * target: where you want it to be */ static void put_cursor(int m, int target) { @@ -305,6 +309,7 @@ #ifdef HAVE_RECORDER_KEYPAD case BUTTON_LEFT: case BUTTON_F1: + case BUTTON_OFF: #else case BUTTON_STOP: case BUTTON_MENU: @@ -334,7 +339,7 @@ #endif return MENU_ATTACHED_USB; } - + status_draw(false); } return MENU_SELECTED_EXIT; diff -urN rockbox-old/apps/recorder/recording.c rockbox-new/apps/recorder/recording.c --- rockbox-old/apps/recorder/recording.c 2003-07-23 06:00:26.000000000 +0200 +++ rockbox-new/apps/recorder/recording.c 2003-08-25 13:11:46.000000000 +0200 @@ -105,14 +105,14 @@ { int tmp, i, d, numdec; char *unit; - + tmp = mpeg_val2phys(snd, val); numdec = mpeg_sound_numdecimals(snd); unit = mpeg_sound_unit(snd); - + i = tmp / (10*numdec); d = tmp % (10*numdec); - + snprintf(str, len, fmtstr[numdec], i, d, unit); return str; } @@ -125,7 +125,7 @@ { if(cursor < 0) cursor = 0; - + if(cursor > 2) cursor = 2; } @@ -170,12 +170,12 @@ mpeg_init_recording(); mpeg_sound_set(SOUND_VOLUME, global_settings.volume); - + status_set_playmode(STATUS_STOP); /* Yes, we use the D/A for monitoring */ peak_meter_playback(true); - + peak_meter_enabled = true; mpeg_set_recording_options(global_settings.rec_frequency, @@ -227,7 +227,7 @@ adjust_cursor(); update_countdown = 1; /* Update immediately */ break; - + case BUTTON_DOWN: cursor++; adjust_cursor(); @@ -275,7 +275,7 @@ set_gain(); update_countdown = 1; /* Update immediately */ break; - + case BUTTON_LEFT: case BUTTON_LEFT | BUTTON_REPEAT: switch(cursor) @@ -317,7 +317,7 @@ set_gain(); update_countdown = 1; /* Update immediately */ break; - + case BUTTON_F1: if (recording_menu()) return SYS_USB_CONNECTED; @@ -327,7 +327,7 @@ global_settings.rec_source, global_settings.rec_channels, global_settings.rec_editable); - + set_gain(); update_countdown = 1; /* Update immediately */ break; @@ -353,7 +353,7 @@ } peak_meter_peek(); - + if(TIME_AFTER(current_tick, timeout)) { lcd_setfont(FONT_SYSFIXED); @@ -361,7 +361,7 @@ timeout = current_tick + HZ/10; seconds = mpeg_recorded_time() / HZ; - + update_countdown--; if(update_countdown == 0 || seconds > last_seconds) { @@ -378,13 +378,13 @@ str(LANG_RECORDING_TIME), hours, minutes, seconds%60); lcd_puts(0, 0, buf); - + /* if the record timesplit is active */ if (global_settings.rec_timesplit) { unsigned long dseconds, dhours, dminutes; int rti = global_settings.rec_timesplit; - dseconds = rec_timer_seconds[rti]; + dseconds = rec_timer_seconds[rti]; if (mpeg_status() && (seconds >= dseconds)) { @@ -396,7 +396,7 @@ last_seconds = 0; } - /* Display the record timesplit interval rather than + /* Display the record timesplit interval rather than the file size if the record timer is active */ dhours = dseconds / 3600; dminutes = (dseconds - (dhours * 3600)) / 60; @@ -429,7 +429,7 @@ { gain = MAX(global_settings.rec_left_gain, global_settings.rec_right_gain); - + snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN), fmt_gain(SOUND_LEFT_GAIN, gain, buf2, sizeof(buf2))); @@ -437,7 +437,7 @@ lcd_puts_style(0, 3, buf, STYLE_INVERT); else lcd_puts(0, 3, buf); - + snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_LEFT), fmt_gain(SOUND_LEFT_GAIN, global_settings.rec_left_gain, @@ -446,7 +446,7 @@ lcd_puts_style(0, 4, buf, STYLE_INVERT); else lcd_puts(0, 4, buf); - + snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_RIGHT), fmt_gain(SOUND_RIGHT_GAIN, global_settings.rec_right_gain, @@ -485,7 +485,7 @@ done = true; } } - + if(mpeg_status() & MPEG_STATUS_ERROR) { status_set_playmode(STATUS_STOP); @@ -501,7 +501,7 @@ break; } } - + mpeg_init_playback(); mpeg_sound_channel_config(global_settings.channel_config); @@ -509,11 +509,22 @@ mpeg_sound_set(SOUND_TREBLE, global_settings.treble); mpeg_sound_set(SOUND_BALANCE, global_settings.balance); mpeg_sound_set(SOUND_VOLUME, global_settings.volume); - + #ifdef HAVE_MAS3587F + int bbshp; mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness); mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost); mpeg_sound_set(SOUND_AVC, global_settings.avc); + mpeg_sound_set(SOUND_BBOOST_STR, global_settings.bboost_str); + mpeg_sound_set(SOUND_BBOOST_HAR, global_settings.bboost_har); + mpeg_sound_set(SOUND_BBOOST_FC, global_settings.bboost_fc); + + if (!global_settings.bboost_on) + bbshp=0; + else + bbshp=1.5*global_settings.bboost_fc; + + mpeg_sound_set(SOUND_BBOOST_SHAPE, bbshp); #endif lcd_setfont(FONT_UI); return have_recorded; @@ -538,7 +549,7 @@ lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_RECORDING_QUALITY)); snprintf(buf, 32, "%d", global_settings.rec_quality); lcd_putsxy(0, LCD_HEIGHT/2-h, buf); - lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], + lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); /* Frequency */ @@ -569,7 +580,7 @@ lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F2_MODE)); lcd_getstringsize(ptr, &w, &h); lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, ptr); - lcd_bitmap(bitmap_icons_7x8[Icon_FastForward], + lcd_bitmap(bitmap_icons_7x8[Icon_FastForward], LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true); lcd_update(); @@ -622,7 +633,7 @@ global_settings.rec_editable); set_gain(); - + settings_save(); lcd_setfont(FONT_UI); @@ -654,7 +665,7 @@ ptr = src_str[global_settings.rec_source]; lcd_getstringsize(ptr, &w, &h); lcd_putsxy(0, LCD_HEIGHT/2-h, ptr); - lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], + lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); lcd_update(); @@ -707,7 +718,7 @@ global_settings.rec_editable); set_gain(); - + settings_save(); lcd_setfont(FONT_UI); diff -urN rockbox-old/apps/recorder/widgets.c rockbox-new/apps/recorder/widgets.c --- rockbox-old/apps/recorder/widgets.c 2003-08-11 06:00:28.000000000 +0200 +++ rockbox-new/apps/recorder/widgets.c 2003-08-25 23:44:14.000000000 +0200 @@ -23,9 +23,9 @@ #ifdef HAVE_LCD_BITMAP /* Valid dimensions return true, invalid false */ -bool valid_dimensions(int x, int y, int width, int height) +bool valid_dimensions(int x, int y, int width, int height) { - if((x < 0) || (x + width > LCD_WIDTH) || + if((x < 0) || (x + width > LCD_WIDTH) || (y < 0) || (y + height > LCD_HEIGHT)) { return false; @@ -52,7 +52,7 @@ /* * Print a progress bar */ -void progressbar(int x, int y, int width, int height, int percent, +void progressbar(int x, int y, int width, int height, int percent, int direction) { int pos; @@ -138,7 +138,7 @@ /* * Print a scroll bar */ -void scrollbar(int x, int y, int width, int height, int items, int min_shown, +void scrollbar(int x, int y, int width, int height, int items, int min_shown, int max_shown, int orientation) { int min; @@ -186,7 +186,7 @@ } else { /* if null draw a full bar */ start = 0; - if(orientation == VERTICAL) + if(orientation == VERTICAL) size = (height - 2); else size = (width - 2); @@ -211,3 +211,127 @@ } } #endif + +void checkbox(int x, int y, int side, int on_off) +{ + int i, j; + int startpoint=0; + + /* check position and dimensions */ + if (!valid_dimensions(x, y, side, side)) + return; + + init_bar(x, y, side, side); + + /* draw checkbox */ + + switch (on_off) + { + case CHECKBOX_ON: + for (i=1; i 100) + pos = 100; + + switch (direction) + { + case Grow_Right: + pos = (width - height) * pos / 100; + for (i=x; i 0x1c 0x30 -0x1d 0x31 +0x1d 0x31 +0x1e 0x32 +0x1f 0x33 +0x20 0x34 0x21 0x35 0x22 0x36 @@ -133,6 +136,7 @@ 0xAC Max number of files in dir (50-10000) 0xAE fade on pause/unpause/stop setting (bit 0) caption backlight (bit 1) +0xAF [available/unused] 0xB0 peak meter clip hold timeout (bit 0-4), peak meter performance (bit 7) 0xB1 peak meter release step size, peak_meter_dbfs (bit 7) 0xB2 peak meter min either in -db or in percent @@ -144,13 +148,15 @@ 0xB8 (char[20]) WPS file 0xCC (char[20]) Lang file 0xE0 (char[20]) Font file -0xF4 +0xF4 sort order when browsing tree +0xF5 0xF8 0xFC *************************************/ #include "rtc.h" +long lasttime = 0; static unsigned char config_block[CONFIG_BLOCK_SIZE]; /* @@ -162,7 +168,7 @@ unsigned int i; unsigned char cksum[2]; cksum[0] = cksum[1] = 0; - + for (i=0; i < RTC_BLOCK_SIZE - 2; i+=2 ) { cksum[0] ^= buf[i]; cksum[1] ^= buf[i+1]; @@ -177,7 +183,7 @@ static void init_config_buffer( void ) { DEBUGF( "init_config_buffer()\n" ); - + /* reset to 0xff - all unused */ memset(config_block, 0xff, CONFIG_BLOCK_SIZE); /* insert header */ @@ -198,13 +204,13 @@ #endif DEBUGF( "save_config_buffer()\n" ); - + /* update the checksum in the end of the block before saving */ chksum = calculate_config_checksum(config_block); config_block[ RTC_BLOCK_SIZE - 2 ] = chksum >> 8; config_block[ RTC_BLOCK_SIZE - 1 ] = chksum & 0xff; -#ifdef HAVE_RTC +#ifdef HAVE_RTC /* FIXME: okay, it _would_ be cleaner and faster to implement rtc_write so that it would write a number of bytes at a time since the RTC chip supports that, but this will have to do for now 8-) */ @@ -239,7 +245,7 @@ unsigned int i; unsigned char rtc_block[RTC_BLOCK_SIZE]; #endif - + DEBUGF( "load_config_buffer()\n" ); if (fat_startsector() != 0) { @@ -247,7 +253,7 @@ /* calculate the checksum, check it and the header */ chksum = calculate_config_checksum(config_block); - + if (config_block[0] == 'R' && config_block[1] == 'o' && config_block[2] == 'c' && @@ -260,13 +266,13 @@ } } -#ifdef HAVE_RTC +#ifdef HAVE_RTC /* read rtc block */ for (i=0; i < RTC_BLOCK_SIZE; i++ ) rtc_block[i] = rtc_read(0x14+i); chksum = calculate_config_checksum(rtc_block); - + /* if rtc block is ok, use that */ if (rtc_block[0] == 'R' && rtc_block[1] == 'o' && @@ -279,7 +285,7 @@ correct = true; } #endif - + if ( !correct ) { /* if checksum is not valid, clear the config buffer */ DEBUGF( "load_config_buffer: header & checksum test failed\n" ); @@ -296,7 +302,7 @@ int settings_save( void ) { DEBUGF( "settings_save()\n" ); - + /* update the config block buffer with current settings and save the block in the RTC */ config_block[0x4] = (unsigned char)global_settings.volume; @@ -305,7 +311,7 @@ config_block[0x7] = (unsigned char)global_settings.treble; config_block[0x8] = (unsigned char)global_settings.loudness; config_block[0x9] = (unsigned char)global_settings.bass_boost; - + config_block[0xa] = (unsigned char) ((global_settings.contrast & 0x3f) | (global_settings.invert ? 0x40 : 0) | @@ -317,7 +323,7 @@ (global_settings.backlight_timeout & 0x1f)); config_block[0xc] = (unsigned char)global_settings.poweroff; config_block[0xd] = (unsigned char)global_settings.resume; - + config_block[0xe] = (unsigned char) ((global_settings.playlist_shuffle & 1) | ((global_settings.dirfilter & 1) << 1) | @@ -326,19 +332,19 @@ ((global_settings.statusbar & 1) << 4) | ((global_settings.dirfilter & 2) << 4) | ((global_settings.scrollbar & 1) << 6)); - + config_block[0xf] = (unsigned char) ((global_settings.volume_type & 1) | ((global_settings.battery_type & 1) << 1) | ((global_settings.timeformat & 1) << 2) | ( global_settings.scroll_speed << 3)); - + config_block[0x10] = (unsigned char) ((global_settings.ff_rewind_min_step & 15) << 4 | (global_settings.ff_rewind_accel & 15)); config_block[0x11] = (unsigned char) - ((global_settings.avc & 0x03) | + ((global_settings.avc & 0x03) | ((global_settings.channel_config & 0x07) << 2)); memcpy(&config_block[0x12], &global_settings.resume_index, 4); @@ -352,10 +358,15 @@ (((global_settings.browse_current & 1)) | ((global_settings.play_selected & 1) << 1) | ((global_settings.recursive_dir_insert & 3) << 2)); - + config_block[0x1c] = (unsigned char)global_settings.peak_meter_hold | (global_settings.rec_editable?0x80:0); + config_block[0x1d] = (unsigned char)global_settings.bboost_str; + config_block[0x1e] = (unsigned char)global_settings.bboost_har; + config_block[0x1f] = (unsigned char)((global_settings.bboost_fc<<1) | + (global_settings.bboost_on & 1)); + config_block[0x21] = (unsigned char) ((global_settings.repeat_mode & 3) | ((global_settings.rec_channels & 1) << 2) | @@ -372,7 +383,6 @@ ((global_settings.trickle_charge & 1) << 4)); { - static long lasttime = 0; int elapsed_secs; elapsed_secs = (current_tick - lasttime) / HZ; @@ -387,7 +397,7 @@ config_block[0x28]=(unsigned char)(global_settings.topruntime & 0xff); config_block[0x29]=(unsigned char)(global_settings.topruntime >> 8); } - + #ifdef HAVE_LCD_CHARCELLS config_block[0xa8]=(unsigned char)global_settings.jump_scroll; config_block[0xa9]=(unsigned char)global_settings.jump_scroll_delay; @@ -419,6 +429,8 @@ strncpy(&config_block[0xcc], global_settings.lang_file, MAX_FILENAME); strncpy(&config_block[0xe0], global_settings.font_file, MAX_FILENAME); + config_block[0xf4] = (unsigned char)global_settings.tree_sort_order; + if(save_config_buffer()) { lcd_clear_display(); @@ -438,8 +450,8 @@ #ifdef HAVE_LCD_BITMAP /** - * Applies the range infos stored in global_settings to - * the peak meter. + * Applies the range infos stored in global_settings to + * the peak meter. */ void settings_apply_pm_range(void) { @@ -447,15 +459,14 @@ /* depending on the scale mode (dBfs or percent) the values of global_settings.peak_meter_dbfs have different meanings */ - if (global_settings.peak_meter_dbfs) + if (global_settings.peak_meter_dbfs) { /* convert to dBfs * 100 */ pm_min = -(((int)global_settings.peak_meter_min) * 100); pm_max = -(((int)global_settings.peak_meter_max) * 100); } - else - { - /* percent is stored directly -> no conversion */ + else + { /* percent is stored directly -> no conversion */ pm_min = global_settings.peak_meter_min; pm_max = global_settings.peak_meter_max; } @@ -468,6 +479,7 @@ void settings_apply(void) { char buf[64]; + int bbshp; mpeg_sound_set(SOUND_BASS, global_settings.bass); mpeg_sound_set(SOUND_TREBLE, global_settings.treble); @@ -477,6 +489,16 @@ #ifdef HAVE_MAS3587F mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness); mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost); + mpeg_sound_set(SOUND_BBOOST_STR, global_settings.bboost_str); + mpeg_sound_set(SOUND_BBOOST_HAR, global_settings.bboost_har); + mpeg_sound_set(SOUND_BBOOST_FC, global_settings.bboost_fc); + + if (global_settings.bboost_on) + bbshp=global_settings.bboost_fc*1.5; + else + bbshp=0; + + mpeg_sound_set(SOUND_BBOOST_SHAPE, bbshp); mpeg_sound_set(SOUND_AVC, global_settings.avc); #endif @@ -492,7 +514,7 @@ set_poweroff_timeout(global_settings.poweroff); #ifdef HAVE_CHARGE_CTRL - charge_restart_level = global_settings.discharge ? + charge_restart_level = global_settings.discharge ? CHARGE_RESTART_LO : CHARGE_RESTART_HI; enable_trickle_charge(global_settings.trickle_charge); #endif @@ -503,11 +525,11 @@ lcd_set_invert_display(global_settings.invert); settings_apply_pm_range(); peak_meter_init_times( - global_settings.peak_meter_release, global_settings.peak_meter_hold, + global_settings.peak_meter_release, global_settings.peak_meter_hold, global_settings.peak_meter_clip_hold); #endif - if ( global_settings.wps_file[0] && + if ( global_settings.wps_file[0] && global_settings.wps_file[0] != 0xff ) { snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.wps", global_settings.wps_file); @@ -540,6 +562,7 @@ global_settings.lang_file); lang_load(buf); } + } /* @@ -547,12 +570,12 @@ */ void settings_load(void) { - + DEBUGF( "reload_all_settings()\n" ); /* populate settings with default values */ settings_reset(); - + /* load the buffer from the RTC (resets it to all-unused if the block is invalid) and decode the settings which are set in the block */ if (!load_config_buffer()) { @@ -568,7 +591,7 @@ global_settings.loudness = config_block[0x8]; if (config_block[0x9] != 0xFF) global_settings.bass_boost = config_block[0x9]; - + if (config_block[0xa] != 0xFF) { global_settings.contrast = config_block[0xa] & 0x3f; global_settings.invert = @@ -603,7 +626,7 @@ /* Don't use the last bit, it must be unused to detect an uninitialized entry */ } - + if (config_block[0xf] != 0xFF) { global_settings.volume_type = config_block[0xf] & 1; global_settings.battery_type = (config_block[0xf] >> 1) & 1; @@ -644,6 +667,17 @@ (config_block[0x1c] & 0x80)?true:false; } + if (config_block[0x1d] != 0xFF) + global_settings.bboost_str = config_block[0x1d]; + + if (config_block[0x1e] != 0xFF) + global_settings.bboost_har = config_block[0x1e]; + + if (config_block[0x1f] != 0xFF) { + global_settings.bboost_fc = (config_block[0x1f] >> 1); + global_settings.bboost_on = (config_block[0x1f] & 1); + } + if (config_block[0x21] != 0xFF) { global_settings.repeat_mode = config_block[0x21] & 3; @@ -672,7 +706,7 @@ } if (config_block[0x27] != 0xff) - global_settings.runtime = + global_settings.runtime = config_block[0x26] | (config_block[0x27] << 8); if (config_block[0x29] != 0xff) @@ -686,7 +720,7 @@ if(config_block[0xb0] != 0xff) { global_settings.peak_meter_clip_hold = (config_block[0xb0]) & 0x1f; - global_settings.peak_meter_performance = + global_settings.peak_meter_performance = (config_block[0xb0] & 0x80) != 0; } @@ -697,7 +731,7 @@ if(config_block[0xb2] != 0xff) global_settings.peak_meter_min = config_block[0xb2]; - + if(config_block[0xb3] != 0xff) global_settings.peak_meter_max = config_block[0xb3]; @@ -721,9 +755,14 @@ global_settings.max_files_in_playlist = config_block[0xaa] | (config_block[0xab] << 8); + strncpy(global_settings.wps_file, &config_block[0xb8], MAX_FILENAME); strncpy(global_settings.lang_file, &config_block[0xcc], MAX_FILENAME); strncpy(global_settings.font_file, &config_block[0xe0], MAX_FILENAME); + + if (config_block[0xf4] != 0xff) + global_settings.tree_sort_order = config_block[0xf4]; + #ifdef HAVE_LCD_CHARCELLS if (config_block[0xa8] != 0xff) global_settings.jump_scroll = config_block[0xa8]; @@ -735,7 +774,7 @@ settings_apply(); } -/* parse a line from a configuration file. the line format is: +/* parse a line from a configuration file. the line format is: setting name: setting value @@ -787,10 +826,10 @@ extlen++; ptr--; } - + if (strcmp(ROCKBOX_DIR, filename) || (len-extlen > maxlen)) return; - + strncpy(setting, fptr, len-extlen); setting[len-extlen]=0; @@ -822,7 +861,7 @@ static void set_cfg_bool(bool* variable, char* value) { /* look for the 'n' in 'on' */ - if ((value[1] & 0xdf) == 'N') + if ((value[1] & 0xdf) == 'N') *variable = true; else *variable = false; @@ -1010,6 +1049,20 @@ set_sound(value, SOUND_LOUDNESS, &global_settings.loudness); else if (!strcasecmp(name, "bass boost")) set_sound(value, SOUND_SUPERBASS, &global_settings.bass_boost); + else if (!strcasecmp(name, "mdb strength")) + set_sound(value, SOUND_BBOOST_STR, &global_settings.bboost_str); + else if (!strcasecmp(name, "mdb harmonics")) + set_sound(value, SOUND_BBOOST_HAR, &global_settings.bboost_har); + else if (!strcasecmp(name, "mdb cutoff")) + set_sound(value, SOUND_BBOOST_FC, &global_settings.bboost_fc); + else if (!strcasecmp(name, "mdb on")) { + set_cfg_bool(&global_settings.bboost_on, value); + if (global_settings.bboost_on) + mpeg_sound_set(SOUND_BBOOST_SHAPE, + global_settings.bboost_fc*1.5); + else + mpeg_sound_set(SOUND_BBOOST_SHAPE, 0); + } else if (!strcasecmp(name, "auto volume")) { static char* options[] = {"off", "2", "4", "8" }; set_cfg_option(&global_settings.avc, value, options, 4); @@ -1027,12 +1080,12 @@ "00:30","01:00","02:00","04:00", "06:00","08:00","10:00","12:00", "18:00","24:00"}; - set_cfg_option(&global_settings.rec_timesplit, value, + set_cfg_option(&global_settings.rec_timesplit, value, options, 14); } else if (!strcasecmp(name, "rec source")) { static char* options[] = {"mic", "line", "spdif"}; - set_cfg_option(&global_settings.rec_source, value, options, 3); + set_cfg_option(&global_settings.rec_source, value, options, 3); } else if (!strcasecmp(name, "rec frequency")) { static char* options[] = {"44", "48", "32", "22", "24", "16"}; @@ -1073,6 +1126,13 @@ set_cfg_option(&global_settings.recursive_dir_insert, value, options, 3); } + else if (!strcasecmp(name, "tree sort order")) { + static char* options[] = {"directory-all", + "directory-playlist", "playlist-directory", + "playlist-music"}; + set_cfg_option(&global_settings.tree_sort_order, value, + options, 4); + } } close(fd); @@ -1133,7 +1193,7 @@ global_settings.wps_file); if (global_settings.lang_file[0] != 0) - fprintf(fd, "lang: %s/%s.lng\r\n", ROCKBOX_DIR, + fprintf(fd, "lang: %s/%s.lng\r\n", ROCKBOX_DIR, global_settings.lang_file); #ifdef HAVE_LCD_BITMAP @@ -1171,6 +1231,17 @@ value = mpeg_val2phys(SOUND_SUPERBASS, global_settings.bass_boost); fprintf(fd, "bass boost: %d\r\n", value); + value = mpeg_val2phys(SOUND_BBOOST_STR, global_settings.bboost_str); + fprintf(fd, "mdb strength: %d\r\n", value); + + value = mpeg_val2phys(SOUND_BBOOST_HAR, global_settings.bboost_har); + fprintf(fd, "mdb harmonics: %d\r\n", value); + + value = mpeg_val2phys(SOUND_BBOOST_FC, global_settings.bboost_fc); + fprintf(fd, "mdb cutoff: %d\r\n", value); + + fprintf(fd, "mdb on: %s\r\n", boolopt[global_settings.bboost_on]); + { static char* options[] = {"off", "2", "4", "8" }; fprintf(fd, "auto volume: %s\r\n", options[global_settings.avc]); @@ -1217,7 +1288,7 @@ boolopt[global_settings.browse_current]); fprintf(fd, "#\r\n# Display\r\n#\r\n"); - + #ifdef HAVE_LCD_BITMAP fprintf(fd, "statusbar: %s\r\nscrollbar: %s\r\n", boolopt[global_settings.statusbar], @@ -1261,7 +1332,7 @@ #ifdef HAVE_LCD_BITMAP fprintf(fd, "invert: %s\r\n", boolopt[global_settings.invert]); - + fprintf(fd, "invert cursor: %s\r\n", boolopt[global_settings.invert_cursor]); @@ -1331,7 +1402,7 @@ #ifdef HAVE_MAS3587F fprintf(fd, "#\r\n# Recording\r\n#\r\n"); fprintf(fd, "rec quality: %d\r\n", global_settings.rec_quality); - + { static char* options[] = {"44", "48", "32", "22", "24", "16"}; fprintf(fd, "rec frequency: %s\r\n", @@ -1363,13 +1434,21 @@ fprintf(fd, "max files in dir: %d\r\n", global_settings.max_files_in_dir); fprintf(fd, "max files in playlist: %d\r\n", global_settings.max_files_in_playlist); - + { static char* options[] = {"off", "on", "ask"}; fprintf(fd, "recursive directory insert: %s\r\n", options[global_settings.recursive_dir_insert]); } + { + static char* options[] = {"directory-all", + "directory-playlist", "playlist-directory", + "playlist-music"}; + fprintf(fd, "tree sort order: %s\r\n", + options[global_settings.tree_sort_order]); + } + close(fd); lcd_clear_display(); @@ -1381,10 +1460,10 @@ } /* - * reset all settings to their default value + * reset all settings to their default value */ void settings_reset(void) { - + DEBUGF( "settings_reset()\n" ); global_settings.volume = mpeg_sound_default(SOUND_VOLUME); @@ -1393,6 +1472,10 @@ global_settings.treble = mpeg_sound_default(SOUND_TREBLE); global_settings.loudness = mpeg_sound_default(SOUND_LOUDNESS); global_settings.bass_boost = mpeg_sound_default(SOUND_SUPERBASS); + global_settings.bboost_str = mpeg_sound_default(SOUND_BBOOST_STR); + global_settings.bboost_har = mpeg_sound_default(SOUND_BBOOST_HAR); + global_settings.bboost_fc = mpeg_sound_default(SOUND_BBOOST_FC); + global_settings.bboost_on = false; global_settings.avc = mpeg_sound_default(SOUND_AVC); global_settings.channel_config = mpeg_sound_default(SOUND_CHANNELS); global_settings.rec_quality = 5; @@ -1409,7 +1492,7 @@ global_settings.poweroff = DEFAULT_POWEROFF_SETTING; global_settings.backlight_timeout = DEFAULT_BACKLIGHT_TIMEOUT_SETTING; global_settings.invert_cursor = DEFAULT_INVERT_CURSOR_SETTING; - global_settings.backlight_on_when_charging = + global_settings.backlight_on_when_charging = DEFAULT_BACKLIGHT_ON_WHEN_CHARGING_SETTING; global_settings.battery_capacity = 1500; /* mAh */ global_settings.trickle_charge = true; @@ -1428,7 +1511,7 @@ #ifdef HAVE_LCD_CHARCELLS global_settings.jump_scroll = 0; global_settings.jump_scroll_delay = 50; -#endif +#endif global_settings.scroll_delay = 100; global_settings.scroll_step = 6; global_settings.ff_rewind_min_step = DEFAULT_FF_REWIND_MIN_STEP; @@ -1458,11 +1541,12 @@ global_settings.max_files_in_playlist = 10000; global_settings.show_icons = true; global_settings.recursive_dir_insert = RECURSE_OFF; + global_settings.tree_sort_order = 0; } bool set_bool(char* string, bool* variable ) { - return set_bool_options(string, variable, str(LANG_SET_BOOL_YES), + return set_bool_options(string, variable, str(LANG_SET_BOOL_YES), str(LANG_SET_BOOL_NO), NULL); } @@ -1483,12 +1567,12 @@ bool result; boolfunction = function; - result = set_option(string, variable, BOOL, names, 2, + result = set_option(string, variable, BOOL, names, 2, function ? bool_funcwrapper : NULL); return result; } -bool set_int(char* string, +bool set_int(char* string, char* unit, int* variable, void (*function)(int), @@ -1746,7 +1830,7 @@ char cursor[][3] = {{ 0, 8, 12}, {18, 8, 12}, {36, 8, 12}, {24, 16, 24}, {54, 16, 18}, {78, 16, 12}}; char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; - + int monthname_len = 0, dayname_len = 0; @@ -1918,7 +2002,7 @@ break; case BUTTON_DOWN: case BUTTON_DOWN | BUTTON_REPEAT: - timedate[cursorpos]=(timedate[cursorpos]+steps - min - 1) % + timedate[cursorpos]=(timedate[cursorpos]+steps - min - 1) % steps + min; if(timedate[cursorpos] == 0) timedate[cursorpos] += min; diff -urN rockbox-old/apps/settings.h rockbox-new/apps/settings.h --- rockbox-old/apps/settings.h 2003-07-15 12:04:20.000000000 +0200 +++ rockbox-new/apps/settings.h 2003-08-26 20:25:52.000000000 +0200 @@ -24,7 +24,9 @@ #include "config.h" #include "file.h" + #define ROCKBOX_DIR "/.rockbox" +#define PLUGIN_DIR ROCKBOX_DIR"/rocks" #define MAX_FILENAME 20 @@ -50,6 +52,7 @@ #define FF_REWIND_45000 12 #define FF_REWIND_60000 13 + struct user_settings { /* audio settings */ @@ -60,6 +63,10 @@ int treble; /* treble eq: 0-100 0=low 100=high */ int loudness; /* loudness eq: 0-100 0=off 100=max */ int bass_boost; /* bass boost eq: 0-100 0=off 100=max */ + int bboost_str; /* MDB strength: 0-100 0=off 100=max */ + int bboost_har; /* MDB harmonics: 0-100 0=off 100=max */ + int bboost_fc ; /* MDB cutoff freq: 2-30 (Hz/10) */ + bool bboost_on; /* MDB switch: false=off true=on */ int avc; /* auto volume correct: 0=disable, 1=2s 2=4s 3=8s */ int channel_config; /* Stereo, Mono, Mono left, Mono right */ @@ -83,7 +90,7 @@ 5 = 01:00, 6 = 02:00, 7 = 04:00, 8 = 06:00 9 = 08:00, 10= 10:00, 11= 12:00, 12= 18:00, 13= 24:00 */ - + /* device settings */ int contrast; /* lcd contrast: 0-63 0=low 63=high */ @@ -168,6 +175,12 @@ int max_files_in_playlist; /* Max entries in playlist */ bool show_icons; /* 0=hide 1=show */ int recursive_dir_insert; /* should directories be inserted recursively */ + + unsigned int tree_sort_order; /* The order in which files are sorted in tree view. + 0 = Directories, All files alphabetically + 1 = Directories, Playlists, Music, Others + 2 = Playlists, Directories, Music, Others + 3 = Playlists, Music, Directories, Others */ }; enum optiontype { INT, BOOL }; @@ -183,7 +196,7 @@ bool settings_load_config(char* file); bool settings_save_config(void); -bool set_bool_options(char* string, bool* variable, +bool set_bool_options(char* string, bool* variable, char* yes_str, char* no_str, void (*function)(bool)); bool set_bool(char* string, bool* variable ); @@ -199,6 +212,7 @@ /* name of directory where configuration, fonts and other data * files are stored */ extern char rockboxdir[]; +extern long lasttime; /* system defines */ @@ -222,7 +236,11 @@ enum { REPEAT_OFF, REPEAT_ALL, REPEAT_ONE, NUM_REPEAT_MODES }; /* dir filter options */ -enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, SHOW_PLAYLIST, NUM_FILTER_MODES }; +/* Note: Any new filter modes need to be added before NUM_FILTER_MODES. + * Any new rockbox browse filter modes (accessible through the menu) + * must be added after NUM_FILTER_MODES. */ +enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, SHOW_PLAYLIST, NUM_FILTER_MODES, +SHOW_WPS, SHOW_CFG, SHOW_LNG, SHOW_MOD, SHOW_FONT, SHOW_PLUGINS}; /* recursive dir insert options */ enum { RECURSE_OFF, RECURSE_ON, RECURSE_ASK }; diff -urN rockbox-old/apps/settings_menu.c rockbox-new/apps/settings_menu.c --- rockbox-old/apps/settings_menu.c 2003-07-21 06:00:26.000000000 +0200 +++ rockbox-new/apps/settings_menu.c 2003-08-26 20:30:33.000000000 +0200 @@ -24,6 +24,7 @@ #include "lcd.h" #include "menu.h" +#include "enhanced_menu.h" #include "mpeg.h" #include "button.h" #include "kernel.h" @@ -37,20 +38,44 @@ #include "powermgmt.h" #include "rtc.h" #include "ata.h" +#include "tree.h" #include "screens.h" #ifdef HAVE_LCD_BITMAP #include "peakmeter.h" #endif #include "lang.h" -static bool contrast(void) +#ifdef HAVE_LCD_BITMAP + +static bool contrast(int parameter) +{ + global_settings.contrast=parameter; + lcd_set_contrast(parameter); + return true; +} + +static bool caption_backlight(int parameter) { - return set_int( str(LANG_CONTRAST), "", &global_settings.contrast, + global_settings.caption_backlight=parameter; + return true; +} + +static bool show_icons(int parameter) +{ +return global_settings.show_icons=parameter; +} + + +#else /* HAVE_LCD_BITMAP */ + +static bool contrast(int parameter) +{ + return set_int( str(LANG_CONTRAST), "", &global_settings.contrast, lcd_set_contrast, 1, MIN_CONTRAST_SETTING, MAX_CONTRAST_SETTING ); } -static bool caption_backlight(void) +static bool caption_backlight(int parameter) { bool rc = set_bool( str(LANG_CAPTION_BACKLIGHT), &global_settings.caption_backlight); @@ -61,151 +86,119 @@ /** * Menu to set icon visibility */ -static bool show_icons(void) +static bool show_icons(int parameter) { return set_bool( str(LANG_SHOW_ICONS), &global_settings.show_icons ); } +#endif /* HAVE_LCD_BITMAP */ + #ifdef HAVE_LCD_BITMAP /** * Menu to set LCD Mode (normal/inverse) */ -static bool invert(void) +static bool invert(int parameter) { - bool rc = set_bool_options(str(LANG_INVERT), - &global_settings.invert, - str(LANG_INVERT_LCD_INVERSE), - str(LANG_INVERT_LCD_NORMAL), - lcd_set_invert_display); - return rc; + global_settings.invert=parameter; + lcd_set_invert_display(parameter); + return true; } /** * Menu to set Line Selector Type (Pointer/Bar) */ -static bool invert_cursor(void) +static bool invert_cursor(int parameter) { - return set_bool_options(str(LANG_INVERT_CURSOR), - &global_settings.invert_cursor, - str(LANG_INVERT_CURSOR_BAR), - str(LANG_INVERT_CURSOR_POINTER), - NULL); +#ifdef HAVE_LCD_BITMAP + global_settings.invert_cursor=!parameter; + return false; +#else + return set_bool_options(str(LANG_INVERT_CURSOR), + &global_settings.invert_cursor, + str(LANG_INVERT_CURSOR_BAR), + str(LANG_INVERT_CURSOR_POINTER), + NULL); +#endif } /** * Menu to configure the battery display on status bar */ -static bool battery_type(void) +static bool battery_type(int parameter) { - char* names[] = { str(LANG_DISPLAY_GRAPHIC), - str(LANG_DISPLAY_NUMERIC) }; - - return set_option( str(LANG_BATTERY_DISPLAY), - &global_settings.battery_type, INT, names, 2, NULL); + global_settings.battery_type=parameter; + return true; } /** * Menu to configure the volume display on status bar */ -static bool volume_type(void) +static bool volume_type(int parameter) { - char* names[] = { str(LANG_DISPLAY_GRAPHIC), - str(LANG_DISPLAY_NUMERIC) }; - - return set_option( str(LANG_VOLUME_DISPLAY), &global_settings.volume_type, - INT, names, 2, NULL); + global_settings.volume_type=parameter; + return true; } #ifdef PM_DEBUG -static bool peak_meter_fps_menu(void) { - bool retval = false; - retval = set_int( "Refresh rate", "/s", - &peak_meter_fps, - NULL, 1, 5, 40); - return retval; +static bool peak_meter_fps_menu(int parameter) { + peak_meter_fps=parameter; + return true; } #endif /* PM_DEBUG */ /** * Menu to set the hold time of normal peaks. */ -static bool peak_meter_hold(void) { - bool retval = false; - char* names[] = { str(LANG_OFF), - "200 ms ", "300 ms ", "500 ms ", "1 s ", "2 s ", - "3 s ", "4 s ", "5 s ", "6 s ", "7 s", - "8 s", "9 s", "10 s", "15 s", "20 s", - "30 s", "1 min" - }; - retval = set_option( str(LANG_PM_PEAK_HOLD), - &global_settings.peak_meter_hold, INT, names, - 18, NULL); +static bool peak_meter_hold(int parameter) { + global_settings.peak_meter_hold=parameter; peak_meter_init_times(global_settings.peak_meter_release, - global_settings.peak_meter_hold, + global_settings.peak_meter_hold, global_settings.peak_meter_clip_hold); - return retval; + return false; } /** * Menu to set the hold time of clips. */ -static bool peak_meter_clip_hold(void) { - bool retval = false; +static bool peak_meter_clip_hold(int parameter) { - char* names[] = { str(LANG_PM_ETERNAL), - "1s ", "2s ", "3s ", "4s ", "5s ", - "6s ", "7s ", "8s ", "9s ", "10s", - "15s", "20s", "25s", "30s", "45s", - "60s", "90s", "2min", "3min", "5min", - "10min", "20min", "45min", "90min" - }; - - retval = set_option( str(LANG_PM_CLIP_HOLD), - &global_settings.peak_meter_clip_hold, INT, names, - 25, peak_meter_set_clip_hold); - - peak_meter_init_times(global_settings.peak_meter_release, - global_settings.peak_meter_hold, + peak_meter_set_clip_hold(parameter); + global_settings.peak_meter_clip_hold=parameter; + peak_meter_init_times(global_settings.peak_meter_release, + global_settings.peak_meter_hold, global_settings.peak_meter_clip_hold); - return retval; + return false; } /** * Menu to set the release time of the peak meter. */ -static bool peak_meter_release(void) { - bool retval = false; +static bool peak_meter_release(int parameter) { /* The range of peak_meter_release is restricted so that it fits into a 7 bit number. The 8th bit is used for storing something else in the rtc ram. Also, the max value is 0x7e, since the RTC value 0xff is reserved */ - retval = set_int( str(LANG_PM_RELEASE), str(LANG_PM_UNITS_PER_READ), - &global_settings.peak_meter_release, - NULL, 1, 1, 0x7e); + + global_settings.peak_meter_release=parameter; peak_meter_init_times(global_settings.peak_meter_release, - global_settings.peak_meter_hold, + global_settings.peak_meter_hold, global_settings.peak_meter_clip_hold); - return retval; + return true; } /** - * Menu to select wether the scale of the meter + * Menu to select wether the scale of the meter * displays dBfs of linear values. */ -static bool peak_meter_scale(void) { - bool retval = false; - bool use_dbfs = global_settings.peak_meter_dbfs; - retval = set_bool_options(str(LANG_PM_SCALE), - &use_dbfs, - str(LANG_PM_DBFS), str(LANG_PM_LINEAR), - NULL); +static bool peak_meter_scale(int parameter) { + bool use_dbfs = parameter; /* has the user really changed the scale? */ if (use_dbfs != global_settings.peak_meter_dbfs) { @@ -224,7 +217,7 @@ global_settings.peak_meter_max = -peak_meter_get_max() / 100; } else { int max; - + /* linear percent */ global_settings.peak_meter_min = peak_meter_get_min(); @@ -238,14 +231,14 @@ } settings_apply_pm_range(); } - return retval; + return true; } /** * Adjust the min value of the value range that * the peak meter shall visualize. */ -static bool peak_meter_min(void) { +static bool peak_meter_min(int parameter) { bool retval = false; if (global_settings.peak_meter_dbfs) { @@ -257,14 +250,14 @@ &min, NULL, 1, -89, range_max); global_settings.peak_meter_min = - min; - } + } /* for linear scale */ else { int min = global_settings.peak_meter_min; retval = set_int(str(LANG_PM_MIN), "%", - &min, NULL, + &min, NULL, 1, 0, global_settings.peak_meter_max - 1); global_settings.peak_meter_min = (unsigned char)min; @@ -279,7 +272,7 @@ * Adjust the max value of the value range that * the peak meter shall visualize. */ -static bool peak_meter_max(void) { +static bool peak_meter_max(int parameter) { bool retval = false; if (global_settings.peak_meter_dbfs) { @@ -292,14 +285,14 @@ global_settings.peak_meter_max = - max; - } - + } + /* for linear scale */ else { int max = global_settings.peak_meter_max; retval = set_int(str(LANG_PM_MAX), "%", - &max, NULL, + &max, NULL, 1, global_settings.peak_meter_min + 1, 100); global_settings.peak_meter_max = (unsigned char)max; @@ -313,58 +306,142 @@ * Menu to select wether the meter is in * precision or in energy saver mode */ -static bool peak_meter_performance(void) { - bool retval = false; - retval = set_bool_options(str(LANG_PM_PERFORMANCE), - &global_settings.peak_meter_performance, +static bool peak_meter_performance(int parameter) { +/* bool retval = false; + retval = set_bool_options(str(LANG_PM_PERFORMANCE), + &global_settings.peak_meter_performance, str(LANG_PM_HIGH_PERFORMANCE), str(LANG_PM_ENERGY_SAVER), NULL); +*/ + global_settings.peak_meter_performance=parameter; if (global_settings.peak_meter_performance) { peak_meter_fps = 25; } else { peak_meter_fps = 20; } - return retval; + return false; } /** * Menu to configure the peak meter */ -static bool peak_meter_menu(void) +static bool peak_meter_menu(int parameter) { int m; bool result; - struct menu_items items[] = { - { str(LANG_PM_RELEASE) , peak_meter_release }, - { str(LANG_PM_PEAK_HOLD), peak_meter_hold }, - { str(LANG_PM_CLIP_HOLD), peak_meter_clip_hold }, - { str(LANG_PM_PERFORMANCE), peak_meter_performance }, + struct menu_items_enh items[] = { + { str(LANG_PM_RELEASE_AND_UNITS), peak_meter_release, SLIDEBAR, + global_settings.peak_meter_release, 1, 0x7e, 1,{""}}, + { str(LANG_PM_PEAK_HOLD), peak_meter_hold,ARROW, + global_settings.peak_meter_hold,0,17,1,{ str(LANG_OFF), + "200 ms ", "300 ms ", "500 ms ", "1 s ", "2 s ", + "3 s ", "4 s ", "5 s ", "6 s ", "7 s", + "8 s", "9 s", "10 s", "15 s", "20 s", + "30 s", "1 min"}}, + { str(LANG_PM_CLIP_HOLD), peak_meter_clip_hold,ARROW, + global_settings.peak_meter_clip_hold,0,24,1,{ str(LANG_PM_ETERNAL), + "1s ", "2s ", "3s ", "4s ", "5s ", + "6s ", "7s ", "8s ", "9s ", "10s", + "15s", "20s", "25s", "30s", "45s", + "60s", "90s", "2min", "3min", "5min", + "10min", "20min", "45min", "90min"}}, + { str(LANG_PM_PERFORMANCE), peak_meter_performance, ARROW, + global_settings.peak_meter_performance,0,1,1, + {str(LANG_PM_HIGH_PERFORMANCE), str(LANG_PM_ENERGY_SAVER)} }, #ifdef PM_DEBUG - { "Refresh rate" , peak_meter_fps_menu }, + { "Refresh rate", peak_meter_fps_menu, SLIDEBAR, + peak_meter_fps, 5, 40, 1, {"/s"}}, #endif - { str(LANG_PM_SCALE) , peak_meter_scale }, - { str(LANG_PM_MIN) , peak_meter_min }, - { str(LANG_PM_MAX) , peak_meter_max }, + { str(LANG_PM_SCALE_CHECKBOX), peak_meter_scale, CHECKBOX, + global_settings.peak_meter_dbfs, 0, 1, 1, {""}}, + { str(LANG_PM_MIN), peak_meter_min, 0,0,0,0,0,{""}}, + { str(LANG_PM_MAX), peak_meter_max, 0,0,0,0,0,{""}}, }; - - m=menu_init( items, sizeof items / sizeof(struct menu_items) ); - result = menu_run(m); - menu_exit(m); + + m=menu_init_enh( items, sizeof items / sizeof(struct menu_items_enh) ); + result = menu_run_enh(m); + menu_exit_enh(m); return result; } #endif /* HAVE_LCD_BITMAP */ -static bool shuffle(void) +#ifdef HAVE_LCD_BITMAP +static bool shuffle(int parameter) +{ + global_settings.playlist_shuffle=parameter; + return true; +} + +static bool play_selected(int parameter) +{ + global_settings.play_selected=parameter; + return true; +} + +static bool sort_case(int parameter) +{ + global_settings.sort_case=parameter; + return true; +} + +static bool scroll_speed(int parameter) +{ + global_settings.scroll_speed=parameter; + lcd_scroll_speed(parameter); + return true; +} + + +static bool scroll_delay(int parameter) +{ + global_settings.scroll_delay=parameter / (HZ/10); + lcd_scroll_delay(parameter); + return true; +} +#else /* HAVE_LCD_BITMAP */ +static bool shuffle(int parameter) { return set_bool( str(LANG_SHUFFLE), &global_settings.playlist_shuffle ); } -static bool repeat_mode(void) +static bool play_selected(int parameter) { + return set_bool( str(LANG_PLAY_SELECTED), &global_settings.play_selected ); +} + +static bool sort_case(int parameter) +{ + return set_bool( str(LANG_SORT_CASE), &global_settings.sort_case ); +} + +static bool scroll_speed(int parameter) +{ + return set_int(str(LANG_SCROLL), "Hz", &global_settings.scroll_speed, + &lcd_scroll_speed, 1, 1, 10 ); +} + + +static bool scroll_delay(int parameter) +{ + int dummy = global_settings.scroll_delay * (HZ/10); + int rc = set_int(str(LANG_SCROLL_DELAY), "ms", &dummy, + &lcd_scroll_delay, 100, 0, 2500 ); + global_settings.scroll_delay = dummy / (HZ/10); + return rc; +} +#endif /* HAVE_LCD_BITMAP */ + +static bool repeat_mode(int parameter) +{ +#ifdef HAVE_LCD_BITMAP + global_settings.repeat_mode=parameter; + mpeg_flush_and_reload_tracks(); + return false; +#else bool result; - char* names[] = { str(LANG_OFF), + char* names[] = { str(LANG_OFF), str(LANG_REPEAT_ALL), str(LANG_REPEAT_ONE) }; @@ -377,15 +454,15 @@ mpeg_flush_and_reload_tracks(); return result; +#endif } -static bool play_selected(void) -{ - return set_bool( str(LANG_PLAY_SELECTED), &global_settings.play_selected ); -} - -static bool dir_filter(void) +static bool dir_filter(int parameter) { +#ifdef HAVE_LCD_BITMAP + global_settings.dirfilter=parameter; + return false; +#else char* names[] = { str(LANG_FILTER_ALL), str(LANG_FILTER_SUPPORTED), str(LANG_FILTER_MUSIC), @@ -393,34 +470,61 @@ return set_option( str(LANG_FILTER), &global_settings.dirfilter, INT, names, 4, NULL ); +#endif } -static bool sort_case(void) +static bool dir_sort_order(int parameter) { - return set_bool( str(LANG_SORT_CASE), &global_settings.sort_case ); +#ifdef HAVE_LCD_BITMAP + global_settings.tree_sort_order=parameter; + return false; +#else + char* names[] = { str(LANG_SORT_DIRECTORY_ALL_FILES), + str(LANG_SORT_DIRECTORY_PLAYLIST_MUSIC), + str(LANG_SORT_PLAYLIST_DIRECTORY_MUSIC), + str(LANG_SORT_PLAYLIST_MUSIC_DIRECTORY) }; + + return set_option( str(LANG_DIRECTORY_SORT_ORDER), + &global_settings.tree_sort_order, INT, names, 4, NULL ); +#endif } -static bool resume(void) +static bool resume(int parameter) { - char* names[] = { str(LANG_SET_BOOL_NO), +#ifdef HAVE_LCD_BITMAP + global_settings.resume=parameter; + return false; +#else + char* names[] = { str(LANG_SET_BOOL_NO), str(LANG_RESUME_SETTING_ASK), str(LANG_RESUME_SETTING_ASK_ONCE), str(LANG_SET_BOOL_YES) }; return set_option( str(LANG_RESUME), &global_settings.resume, INT, names, 4, NULL ); +#endif } -static bool backlight_on_when_charging(void) +static bool backlight_on_when_charging(int parameter) { +#ifdef HAVE_LCD_BITMAP + bool result = false; + global_settings.backlight_on_when_charging=parameter; +#else bool result = set_bool(str(LANG_BACKLIGHT_ON_WHEN_CHARGING), &global_settings.backlight_on_when_charging); +#endif backlight_set_on_when_charging(global_settings.backlight_on_when_charging); return result; } -static bool backlight_timer(void) +static bool backlight_timer(int parameter) { +#ifdef HAVE_LCD_BITMAP + global_settings.backlight_timeout=parameter; + backlight_set_timeout(parameter); + return false; +#else char* names[] = { str(LANG_OFF), str(LANG_ON), "1s ", "2s ", "3s ", "4s ", "5s ", "6s ", "7s ", "8s ", "9s ", "10s", @@ -429,10 +533,16 @@ return set_option(str(LANG_BACKLIGHT), &global_settings.backlight_timeout, INT, names, 19, backlight_set_timeout ); +#endif } -static bool poweroff_idle_timer(void) +static bool poweroff_idle_timer(int parameter) { +#ifdef HAVE_LCD_BITMAP + global_settings.poweroff=parameter; + set_poweroff_timeout(parameter); + return false; +#else char* names[] = { str(LANG_OFF), "1m ", "2m ", "3m ", "4m ", "5m ", "6m ", "7m ", "8m ", "9m ", "10m", @@ -440,41 +550,32 @@ return set_option(str(LANG_POWEROFF_IDLE), &global_settings.poweroff, INT, names, 15, set_poweroff_timeout); +#endif } -static bool scroll_speed(void) +#ifdef HAVE_LCD_BITMAP +static bool scroll_step(int parameter) { - return set_int(str(LANG_SCROLL), "Hz", &global_settings.scroll_speed, - &lcd_scroll_speed, 1, 1, 10 ); + global_settings.scroll_step=parameter; + lcd_scroll_step(parameter); + return true; } - - -static bool scroll_delay(void) +static bool bidir_limit(int parameter) { - int dummy = global_settings.scroll_delay * (HZ/10); - int rc = set_int(str(LANG_SCROLL_DELAY), "ms", &dummy, - &lcd_scroll_delay, 100, 0, 2500 ); - global_settings.scroll_delay = dummy / (HZ/10); - return rc; + global_settings.bidir_limit=parameter; + lcd_bidir_scroll(parameter); + return true; } - -#ifdef HAVE_LCD_BITMAP -static bool scroll_step(void) -{ - return set_int(str(LANG_SCROLL_STEP_EXAMPLE), "pixels", - &global_settings.scroll_step, - &lcd_scroll_step, 1, 1, LCD_WIDTH ); -} -#endif - -static bool bidir_limit(void) +#else +static bool bidir_limit(int parameter) { - return set_int(str(LANG_BIDIR_SCROLL), "%", &global_settings.bidir_limit, + return set_int(str(LANG_BIDIR_SCROLL), "%", &global_settings.bidir_limit, &lcd_bidir_scroll, 25, 0, 200 ); } +#endif #ifdef HAVE_LCD_CHARCELLS -static bool jump_scroll(void) +static bool jump_scroll(int parameter) { char* names[] = { str(LANG_OFF), str(LANG_ONE_TIME), "2", "3", "4", str(LANG_ALWAYS)}; @@ -483,47 +584,77 @@ INT, names, 6, lcd_jump_scroll); return ret; } -static bool jump_scroll_delay(void) + +static bool jump_scroll_delay(int parameter) { int dummy = global_settings.jump_scroll_delay * (HZ/10); - int rc = set_int(str(LANG_JUMP_SCROLL_DELAY), "ms", &dummy, + int rc = set_int(str(LANG_JUMP_SCROLL_DELAY), "ms", &dummy, &lcd_jump_scroll_delay, 100, 0, 2500 ); global_settings.jump_scroll_delay = dummy / (HZ/10); return rc; } -#endif +#endif /* HAVE_LCD_CHARCELLS */ +#ifdef HAVE_LCD_BITMAP #ifndef SIMULATOR /** * Menu to set the battery capacity */ -static bool battery_capacity(void) +static bool battery_capacity(int parameter) +{ + global_settings.battery_capacity=parameter; + set_battery_capacity(parameter); + return true; +} +#endif + +#ifdef HAVE_CHARGE_CTRL +static bool deep_discharge(int parameter) { - return set_int(str(LANG_BATTERY_CAPACITY), "mAh", &global_settings.battery_capacity, + global_settings.discharge=parameter; + charge_restart_level = global_settings.discharge ? + CHARGE_RESTART_LO : CHARGE_RESTART_HI; + return true; +} +static bool trickle_charge(int parameter) +{ + global_settings.trickle_charge=parameter; + enable_trickle_charge(global_settings.trickle_charge); + return true; +} +#endif /* HAVE_CHARGE_CTRL */ + +#else + +#ifndef SIMULATOR +static bool battery_capacity(int parameter) +{ + return set_int(str(LANG_BATTERY_CAPACITY), "mAh", &global_settings.battery_capacity, &set_battery_capacity, 50, 1500, BATTERY_CAPACITY_MAX ); } #endif #ifdef HAVE_CHARGE_CTRL -static bool deep_discharge(void) +static bool deep_discharge(int parameter) { bool result; result = set_bool( str(LANG_DISCHARGE), &global_settings.discharge ); - charge_restart_level = global_settings.discharge ? + charge_restart_level = global_settings.discharge ? CHARGE_RESTART_LO : CHARGE_RESTART_HI; return result; } -static bool trickle_charge(void) +static bool trickle_charge(int parameter) { bool result; result = set_bool( str(LANG_TRICKLE_CHARGE), &global_settings.trickle_charge ); enable_trickle_charge(global_settings.trickle_charge); return result; } -#endif +#endif /* HAVE_CHARGE_CTRL */ +#endif /* HAVE_LCD_BITMAP */ #ifdef HAVE_LCD_BITMAP -static bool timedate_set(void) +static bool timedate_set(int parameter) { int timedate[7]; /* hour,minute,second,year,month,day,dayofweek */ bool result; @@ -538,22 +669,22 @@ /* day of week not read, calculated in set_time() */ /* hour */ - timedate[0] = ((timedate[0] & 0x30) >> 4) * 10 + (timedate[0] & 0x0f); + timedate[0] = ((timedate[0] & 0x30) >> 4) * 10 + (timedate[0] & 0x0f); /* minute */ - timedate[1] = ((timedate[1] & 0x70) >> 4) * 10 + (timedate[1] & 0x0f); + timedate[1] = ((timedate[1] & 0x70) >> 4) * 10 + (timedate[1] & 0x0f); /* second */ - timedate[2] = ((timedate[2] & 0x70) >> 4) * 10 + (timedate[2] & 0x0f); + timedate[2] = ((timedate[2] & 0x70) >> 4) * 10 + (timedate[2] & 0x0f); /* year */ - timedate[3] = ((timedate[3] & 0xf0) >> 4) * 10 + (timedate[3] & 0x0f); + timedate[3] = ((timedate[3] & 0xf0) >> 4) * 10 + (timedate[3] & 0x0f); /* month */ - timedate[4] = ((timedate[4] & 0x10) >> 4) * 10 + (timedate[4] & 0x0f); + timedate[4] = ((timedate[4] & 0x10) >> 4) * 10 + (timedate[4] & 0x0f); /* day */ timedate[5] = ((timedate[5] & 0x30) >> 4) * 10 + (timedate[5] & 0x0f); /* do some range checks */ /* This prevents problems with time/date setting after a power loss */ if (timedate[0] < 0 || timedate[0] > 23 || - timedate[1] < 0 || timedate[1] > 59 || + timedate[1] < 0 || timedate[1] > 59 || timedate[2] < 0 || timedate[2] > 59 || timedate[3] < 0 || timedate[3] > 99 || timedate[4] < 1 || timedate[4] > 12 || @@ -579,17 +710,17 @@ #ifdef HAVE_RTC if(timedate[0] != -1) { /* hour */ - timedate[0] = ((timedate[0]/10) << 4 | timedate[0]%10) & 0x3f; + timedate[0] = ((timedate[0]/10) << 4 | timedate[0]%10) & 0x3f; /* minute */ - timedate[1] = ((timedate[1]/10) << 4 | timedate[1]%10) & 0x7f; + timedate[1] = ((timedate[1]/10) << 4 | timedate[1]%10) & 0x7f; /* second */ - timedate[2] = ((timedate[2]/10) << 4 | timedate[2]%10) & 0x7f; + timedate[2] = ((timedate[2]/10) << 4 | timedate[2]%10) & 0x7f; /* year */ - timedate[3] = ((timedate[3]/10) << 4 | timedate[3]%10) & 0xff; + timedate[3] = ((timedate[3]/10) << 4 | timedate[3]%10) & 0xff; /* month */ - timedate[4] = ((timedate[4]/10) << 4 | timedate[4]%10) & 0x1f; + timedate[4] = ((timedate[4]/10) << 4 | timedate[4]%10) & 0x1f; /* day */ - timedate[5] = ((timedate[5]/10) << 4 | timedate[5]%10) & 0x3f; + timedate[5] = ((timedate[5]/10) << 4 | timedate[5]%10) & 0x3f; rtc_write(0x03, timedate[0] | (rtc_read(0x03) & 0xc0)); /* hour */ rtc_write(0x02, timedate[1] | (rtc_read(0x02) & 0x80)); /* minute */ @@ -604,118 +735,190 @@ return result; } -static bool timeformat_set(void) +static bool timeformat_set(int parameter) { - char* names[] = { str(LANG_24_HOUR_CLOCK), - str(LANG_12_HOUR_CLOCK) }; - - return set_option(str(LANG_TIMEFORMAT), &global_settings.timeformat, - INT, names, 2, NULL); + global_settings.timeformat=!parameter; + return true; } #endif +#ifdef HAVE_LCD_BITMAP +static bool spindown(int parameter) +{ + global_settings.disk_spindown=parameter; + ata_spindown(parameter); + return true; +} +#else /* HAVE_LCD_BITMAP */ static bool spindown(void) { return set_int(str(LANG_SPINDOWN), "s", &global_settings.disk_spindown, ata_spindown, 1, 3, 254 ); } +#endif /* HAVE_LCD_BITMAP */ + +#ifdef HAVE_LCD_BITMAP +#ifdef HAVE_ATA_POWER_OFF +static bool poweroff(int parameter) +{ + global_settings.disk_poweroff=parameter; + ata_poweroff(global_settings.disk_poweroff); + return true; +} +#endif /* HAVE_ATA_POWER_OFF */ + +static bool max_files_in_dir(int parameter) +{ + global_settings.max_files_in_dir=parameter; + return true; +} +static bool max_files_in_playlist(int parameter) +{ + global_settings.max_files_in_playlist=parameter; + return true; +} + +static bool buffer_margin(int parameter) +{ + global_settings.buffer_margin=parameter; + mpeg_set_buffer_margin(parameter); + return true; +} +static bool ff_rewind_min_step(int parameter) +{ + global_settings.ff_rewind_min_step=parameter; + return true; +} +static bool set_fade_on_stop(int parameter) +{ + global_settings.fade_on_stop=parameter; + return true; +} +static bool browse_current(int parameter) +{ + global_settings.browse_current=parameter; + return true; +} +#else /* HAVE_LCD_BITMAP */ #ifdef HAVE_ATA_POWER_OFF -static bool poweroff(void) +static bool poweroff(int parameter) { bool rc = set_bool(str(LANG_POWEROFF), &global_settings.disk_poweroff); ata_poweroff(global_settings.disk_poweroff); return rc; } -#endif - -static bool max_files_in_dir(void) +#endif /* HAVE_ATA_POWER_OFF */ +static bool max_files_in_dir(int parameter) { return set_int(str(LANG_MAX_FILES_IN_DIR), "", &global_settings.max_files_in_dir, NULL, 50, 50, 10000 ); } - -static bool max_files_in_playlist(void) +static bool max_files_in_playlist(int parameter) { return set_int(str(LANG_MAX_FILES_IN_PLAYLIST), "", &global_settings.max_files_in_playlist, NULL, 1000, 1000, 20000 ); } -static bool buffer_margin(void) +static bool buffer_margin(int parameter) { return set_int(str(LANG_MP3BUFFER_MARGIN), "s", &global_settings.buffer_margin, mpeg_set_buffer_margin, 1, 0, 7 ); } -static bool ff_rewind_min_step(void) -{ +static bool ff_rewind_min_step(int parameter) +{ char* names[] = { "1s", "2s", "3s", "4s", "5s", "6s", "8s", "10s", "15s", "20s", "25s", "30s", "45s", "60s" }; return set_option(str(LANG_FFRW_STEP), &global_settings.ff_rewind_min_step, - INT, names, 14, NULL ); -} - -static bool set_fade_on_stop(void) + INT, names, 14, NULL ); +} +static bool set_fade_on_stop(int parameter) { return set_bool( str(LANG_FADE_ON_STOP), &global_settings.fade_on_stop ); } +static bool browse_current(int parameter) +{ + return set_bool( str(LANG_FOLLOW), &global_settings.browse_current ); +} +#endif /* HAVE_LCD_BITMAP */ -static bool ff_rewind_accel(void) -{ - char* names[] = { str(LANG_OFF), "2x/1s", "2x/2s", "2x/3s", - "2x/4s", "2x/5s", "2x/6s", "2x/7s", +static bool ff_rewind_accel(int parameter) +{ +#ifdef HAVE_LCD_BITMAP + global_settings.ff_rewind_accel=parameter; + return false; +#else + char* names[] = { str(LANG_OFF), "2x/1s", "2x/2s", "2x/3s", + "2x/4s", "2x/5s", "2x/6s", "2x/7s", "2x/8s", "2x/9s", "2x/10s", "2x/11s", "2x/12s", "2x/13s", "2x/14s", "2x/15s", }; - return set_option(str(LANG_FFRW_ACCEL), &global_settings.ff_rewind_accel, - INT, names, 16, NULL ); -} - -static bool browse_current(void) -{ - return set_bool( str(LANG_FOLLOW), &global_settings.browse_current ); + return set_option(str(LANG_FFRW_ACCEL), &global_settings.ff_rewind_accel, + INT, names, 16, NULL ); +#endif } #ifdef HAVE_LCD_BITMAP -static bool scroll_bar(void) +static bool scroll_bar(int parameter) { - return set_bool( str(LANG_SCROLL_BAR), &global_settings.scrollbar ); + global_settings.scrollbar=parameter; + return true; } -static bool status_bar(void) +static bool status_bar(int parameter) { - return set_bool( str(LANG_STATUS_BAR), &global_settings.statusbar ); + global_settings.statusbar=parameter; + return true; } -#endif + +#endif /* HAVE_LCD_BITMAP */ static bool playback_settings_menu(void) { int m; bool result; - struct menu_items items[] = { - { str(LANG_SHUFFLE), shuffle }, - { str(LANG_REPEAT), repeat_mode }, - { str(LANG_PLAY_SELECTED), play_selected }, - { str(LANG_RESUME), resume }, - { str(LANG_FFRW_STEP), ff_rewind_min_step }, - { str(LANG_FFRW_ACCEL), ff_rewind_accel }, - { str(LANG_MP3BUFFER_MARGIN), buffer_margin }, - { str(LANG_FADE_ON_STOP), set_fade_on_stop }, + struct menu_items_enh items[] = { + { str(LANG_SHUFFLE), shuffle, CHECKBOX, + global_settings.playlist_shuffle, 0, 1, 1, {""}}, + { str(LANG_REPEAT), repeat_mode, ARROW, + global_settings.repeat_mode,0,2,1,{ str(LANG_OFF), + str(LANG_REPEAT_ALL), + str(LANG_REPEAT_ONE) } }, + { str(LANG_PLAY_SELECTED), play_selected, CHECKBOX, + global_settings.play_selected, 0, 1, 1, {""}}, + { str(LANG_RESUME), resume, ARROW, + global_settings.resume,0,3,1,{ str(LANG_SET_BOOL_NO), + str(LANG_RESUME_SETTING_ASK), + str(LANG_RESUME_SETTING_ASK_ONCE), + str(LANG_SET_BOOL_YES) } }, + { str(LANG_FFRW_STEP), ff_rewind_min_step, SLIDEBAR, + global_settings.ff_rewind_min_step, 1, 60, 1, {"s"}}, + { str(LANG_FFRW_ACCEL), ff_rewind_accel, ARROW, + global_settings.ff_rewind_accel,0,15,1, + { str(LANG_OFF), "2x/1s", "2x/2s", "2x/3s", + "2x/4s", "2x/5s", "2x/6s", "2x/7s", + "2x/8s", "2x/9s", "2x/10s", "2x/11s", + "2x/12s", "2x/13s", "2x/14s", "2x/15s", } }, + { str(LANG_MP3BUFFER_MARGIN), buffer_margin, SLIDEBAR, + global_settings.buffer_margin, 0, 7, 1, {"s"}}, + { str(LANG_FADE_ON_STOP), set_fade_on_stop, CHECKBOX, + global_settings.fade_on_stop, 0, 1, 1, {""} }, }; bool old_shuffle = global_settings.playlist_shuffle; - - m=menu_init( items, sizeof items / sizeof(struct menu_items) ); - result = menu_run(m); - menu_exit(m); + + m=menu_init_enh( items, sizeof items / sizeof(struct menu_items_enh) ); + result = menu_run_enh(m); + menu_exit_enh(m); if (old_shuffle != global_settings.playlist_shuffle) { @@ -728,14 +931,15 @@ playlist_sort(true); } } + return result; } -static bool reset_settings(void) +static bool reset_settings(int parameter) { bool done=false; int line; - + lcd_clear_display(); #ifdef HAVE_LCD_CHARCELLS @@ -748,7 +952,7 @@ lcd_puts(0,line+1,str(LANG_RESET_CANCEL)); lcd_update(); - + while(!done) { switch(button_get(true)) { case BUTTON_PLAY: @@ -786,71 +990,102 @@ int m; bool result; - struct menu_items items[] = { - { str(LANG_CASE_MENU), sort_case }, - { str(LANG_FILTER), dir_filter }, - { str(LANG_FOLLOW), browse_current }, + struct menu_items_enh items[] = { + { str(LANG_SORT_CASE), sort_case, + CHECKBOX, global_settings.sort_case, 0, 1, 1, {""}}, + { str(LANG_FILTER), dir_filter,ARROW, + global_settings.dirfilter,0,3,1,{ str(LANG_FILTER_ALL), + str(LANG_FILTER_SUPPORTED), + str(LANG_FILTER_MUSIC), + str(LANG_FILTER_PLAYLIST) }}, + { str(LANG_DIRECTORY_SORT_ORDER), dir_sort_order,ARROW, + global_settings.tree_sort_order,0,3,1,{ str(LANG_SORT_DIRECTORY_ALL_FILES), + str(LANG_SORT_DIRECTORY_PLAYLIST_MUSIC), + str(LANG_SORT_PLAYLIST_DIRECTORY_MUSIC), + str(LANG_SORT_PLAYLIST_MUSIC_DIRECTORY) }}, + { str(LANG_FOLLOW), browse_current, + CHECKBOX, global_settings.browse_current, 0, 1, 1, {""} }, }; - m = menu_init( items, sizeof items / sizeof(struct menu_items) ); - result = menu_run(m); - menu_exit(m); + m = menu_init_enh( items, sizeof items / sizeof(struct menu_items_enh) ); + result = menu_run_enh(m); + menu_exit_enh(m); + return result; } - -static bool scroll_settings_menu(void) +static bool scroll_settings_menu(int parameter) { int m; bool result; - struct menu_items items[] = { - { str(LANG_SCROLL_SPEED), scroll_speed }, - { str(LANG_SCROLL_DELAY), scroll_delay }, + struct menu_items_enh items[] = { + { str(LANG_SCROLL_SPEED), scroll_speed, SLIDEBAR, + global_settings.scroll_speed, 1, 10, 1, {"Hz"}}, + { str(LANG_SCROLL_DELAY), scroll_delay, SLIDEBAR, + global_settings.scroll_delay * (HZ/10), 0, 2500, 100, {"ms"}}, #ifdef HAVE_LCD_BITMAP - { str(LANG_SCROLL_STEP), scroll_step }, + { str(LANG_SCROLL_STEP), scroll_step, SLIDEBAR, + global_settings.scroll_step, 1, LCD_WIDTH, 1, {"px"}}, #endif - { str(LANG_BIDIR_SCROLL), bidir_limit }, + { str(LANG_BIDIR_SCROLL), bidir_limit, SLIDEBAR, + global_settings.bidir_limit, 0, 200, 25, {"%"}}, #ifdef HAVE_LCD_CHARCELLS - { str(LANG_JUMP_SCROLL), jump_scroll }, - { str(LANG_JUMP_SCROLL_DELAY), jump_scroll_delay }, + { str(LANG_JUMP_SCROLL), jump_scroll, 0,0,0,0,0,{""}}, + { str(LANG_JUMP_SCROLL_DELAY), jump_scroll_delay, 0,0,0,0,0,{""}}, #endif }; - m = menu_init( items, sizeof items / sizeof(struct menu_items) ); - result = menu_run(m); - menu_exit(m); + m = menu_init_enh( items, sizeof items / sizeof(struct menu_items_enh) ); + result = menu_run_enh(m); + menu_exit_enh(m); + return result; } - - static bool display_settings_menu(void) { int m; bool result; - struct menu_items items[] = { - { str(LANG_SCROLL_MENU), scroll_settings_menu }, - { str(LANG_BACKLIGHT), backlight_timer }, - { str(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging }, - { str(LANG_CONTRAST), contrast }, -#ifdef HAVE_LCD_BITMAP - { str(LANG_SCROLL_BAR), scroll_bar }, - { str(LANG_STATUS_BAR), status_bar }, - { str(LANG_INVERT), invert }, - { str(LANG_INVERT_CURSOR), invert_cursor }, - { str(LANG_PM_MENU), peak_meter_menu }, - { str(LANG_VOLUME_DISPLAY), volume_type }, - { str(LANG_BATTERY_DISPLAY), battery_type }, + struct menu_items_enh items[] = { + { str(LANG_SCROLL_MENU), scroll_settings_menu,0,0,0,0,0,{""}}, + { str(LANG_BACKLIGHT), backlight_timer, ARROW, + global_settings.backlight_timeout,0,18,1,{ str(LANG_OFF), str(LANG_ON), + "1s ", "2s ", "3s ", "4s ", "5s ", + "6s ", "7s ", "8s ", "9s ", "10s", + "15s", "20s", "25s", "30s", "45s", + "60s", "90s"}}, + { str(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging, + CHECKBOX,global_settings.backlight_on_when_charging,0,1,1,{""}}, + { str(LANG_CONTRAST), contrast, SLIDEBAR, + global_settings.contrast, MIN_CONTRAST_SETTING, + MAX_CONTRAST_SETTING, 1, {""}}, +#ifdef HAVE_LCD_BITMAP + { str(LANG_SCROLL_BAR), scroll_bar, CHECKBOX, + global_settings.scrollbar, 0,1,1,{""} }, + { str(LANG_STATUS_BAR), status_bar, CHECKBOX, + global_settings.statusbar, 0,1,1,{""} }, + { str(LANG_INVERT_CHECKBOX), invert, CHECKBOX, + global_settings.invert,0,1,1,{""} }, + { str(LANG_INVERT_CURSOR), invert_cursor,ARROW, + !global_settings.invert_cursor,0,1,1,{str(LANG_INVERT_CURSOR_BAR), + str(LANG_INVERT_CURSOR_POINTER)} }, + { str(LANG_PM_MENU), peak_meter_menu,0,0,0,0,0,{""} }, + { str(LANG_VOLUME_DISPLAY_NUMERIC), volume_type, + CHECKBOX,global_settings.volume_type,0,1,1,{""} }, + { str(LANG_BATTERY_DISPLAY_NUMERIC), battery_type, + CHECKBOX,global_settings.battery_type,0,1,1,{""} }, #endif - { str(LANG_SHOW_ICONS), show_icons }, - { str(LANG_CAPTION_BACKLIGHT), caption_backlight }, + { str(LANG_SHOW_ICONS), show_icons, CHECKBOX, + global_settings.show_icons, 0,1,1,{""}}, + { str(LANG_CAPTION_BACKLIGHT), caption_backlight, + CHECKBOX, global_settings.caption_backlight, 0,1,1,{""}}, }; - - m=menu_init( items, sizeof items / sizeof(struct menu_items) ); - result = menu_run(m); - menu_exit(m); + + m=menu_init_enh( items, sizeof items / sizeof(struct menu_items_enh) ); + result = menu_run_enh(m); + menu_exit_enh(m); return result; } @@ -859,31 +1094,45 @@ int m; bool result; - struct menu_items items[] = { - { str(LANG_SPINDOWN), spindown }, + struct menu_items_enh items[] = { + { str(LANG_SPINDOWN), spindown, SLIDEBAR, + global_settings.disk_spindown, 3, 254, 1, {"s"}}, #ifdef HAVE_ATA_POWER_OFF - { str(LANG_POWEROFF), poweroff }, + { str(LANG_POWEROFF), poweroff, CHECKBOX, + global_settings.disk_poweroff, 0, 1, 1, {""}}, #endif - { str(LANG_MAX_FILES_IN_DIR), max_files_in_dir }, - { str(LANG_MAX_FILES_IN_PLAYLIST), max_files_in_playlist }, + { str(LANG_MAX_FILES_IN_DIR), max_files_in_dir, SLIDEBAR, + global_settings.max_files_in_dir, 50, 10000, 50, {""}}, + { str(LANG_MAX_FILES_IN_PLAYLIST), max_files_in_playlist, + SLIDEBAR, global_settings.max_files_in_playlist, + 1000, 20000, 1000, {""}}, #ifndef SIMULATOR - { str(LANG_BATTERY_CAPACITY), battery_capacity }, + { str(LANG_BATTERY_CAPACITY), battery_capacity, SLIDEBAR, + global_settings.battery_capacity, 1500, BATTERY_CAPACITY_MAX, + 50, {"mAh"}}, #endif #ifdef HAVE_CHARGE_CTRL - { str(LANG_DISCHARGE), deep_discharge }, - { str(LANG_TRICKLE_CHARGE), trickle_charge }, + { str(LANG_DISCHARGE), deep_discharge, CHECKBOX, + global_settings.discharge, 0,1,1,{""}}, + { str(LANG_TRICKLE_CHARGE), trickle_charge, CHECKBOX, + global_settings.trickle_charge, 0,1,1,{""}}, #endif #ifdef HAVE_LCD_BITMAP - { str(LANG_TIME), timedate_set }, - { str(LANG_TIMEFORMAT), timeformat_set }, + { str(LANG_TIME), timedate_set,0,0,0,0,0,{""} }, + { str(LANG_24_HOUR_CLOCK), timeformat_set,CHECKBOX, + !global_settings.timeformat,0,1,1,{""} }, #endif - { str(LANG_POWEROFF_IDLE), poweroff_idle_timer }, - { str(LANG_RESET), reset_settings }, + { str(LANG_POWEROFF_IDLE), poweroff_idle_timer,ARROW, + global_settings.poweroff,0,14,1,{ str(LANG_OFF), + "1m ", "2m ", "3m ", "4m ", "5m ", + "6m ", "7m ", "8m ", "9m ", "10m", + "15m", "30m", "45m", "60m"} }, + { str(LANG_RESET), reset_settings,0,0,0,0,0,{""} }, }; - - m=menu_init( items, sizeof items / sizeof(struct menu_items) ); - result = menu_run(m); - menu_exit(m); + + m=menu_init_enh( items, sizeof items / sizeof(struct menu_items_enh) ); + result = menu_run_enh(m); + menu_exit_enh(m); return result; } @@ -899,7 +1148,7 @@ { str(LANG_SYSTEM), system_settings_menu }, { str(LANG_SAVE_SETTINGS), settings_save_config }, }; - + m = menu_init( items, sizeof items / sizeof(struct menu_items) ); result = menu_run(m); menu_exit(m); diff -urN rockbox-old/apps/sound_menu.c rockbox-new/apps/sound_menu.c --- rockbox-old/apps/sound_menu.c 2003-06-12 06:00:20.000000000 +0200 +++ rockbox-new/apps/sound_menu.c 2003-08-26 14:01:05.000000000 +0200 @@ -19,20 +19,31 @@ #include "config.h" #include #include +#include + #include "kernel.h" #include "lcd.h" #include "menu.h" +#include "enhanced_menu.h" #include "button.h" #include "mpeg.h" #include "settings.h" #include "status.h" #include "screens.h" -#ifdef HAVE_LCD_BITMAP -#include "icons.h" -#endif #include "lang.h" #include "sprintf.h" +#ifdef HAVE_LCD_BITMAP + +#include "icons.h" + +bool set_sound(int variable, int setting) { + mpeg_sound_set(setting, variable); + return false; + } + +#else + static char *fmt[] = { "", /* no decimals */ @@ -40,14 +51,14 @@ "%d.%02d %s " /* 2 decimals */ }; -bool set_sound(char* string, +bool set_sound(char* string, int* variable, int setting) { + int val; bool done = false; bool changed = true; int min, max; - int val; int numdec; int integer; int dec; @@ -58,13 +69,7 @@ numdec = mpeg_sound_numdecimals(setting); min = mpeg_sound_min(setting); max = mpeg_sound_max(setting); - -#ifdef HAVE_LCD_BITMAP - if(global_settings.statusbar) - lcd_setmargins(0, STATUSBAR_HEIGHT); - else - lcd_setmargins(0, 0); -#endif + lcd_clear_display(); lcd_puts_scroll(0,0,string); @@ -82,6 +87,7 @@ snprintf(str,sizeof str,"%d %s ", val, unit); } } + lcd_puts(0,1,str); status_draw(true); lcd_update(); @@ -134,11 +140,47 @@ mpeg_sound_set(SOUND_VOLUME, global_settings.volume); #endif } + } lcd_stop_scroll(); + + return false; } +#endif /* HAVE_LCD_BITMAP */ + +#ifdef HAVE_LCD_BITMAP +static bool volume(int parameter) +{ + int var=mpeg_phys2val(SOUND_VOLUME,parameter); + global_settings.volume=var; + return set_sound(var, SOUND_VOLUME); +} + +static bool balance(int parameter) +{ + int var=mpeg_phys2val(SOUND_BALANCE,parameter); + global_settings.balance=var; + return set_sound(var, SOUND_BALANCE); +} + +static bool bass(int parameter) +{ + int var=mpeg_phys2val(SOUND_BASS,parameter); + global_settings.bass=var; + return set_sound(var, SOUND_BASS); +} + +static bool treble(int parameter) +{ + int var=mpeg_phys2val(SOUND_TREBLE,parameter); + global_settings.treble=var; + return set_sound(var, SOUND_TREBLE); +} + +#else /* HAVE_LCD_BITMAP */ + static bool volume(void) { return set_sound(str(LANG_VOLUME), &global_settings.volume, SOUND_VOLUME); @@ -153,91 +195,84 @@ static bool bass(void) { return set_sound(str(LANG_BASS), &global_settings.bass, SOUND_BASS); -}; +} static bool treble(void) { return set_sound(str(LANG_TREBLE), &global_settings.treble, SOUND_TREBLE); } -#ifdef HAVE_MAS3587F -static bool loudness(void) -{ - return set_sound(str(LANG_LOUDNESS), &global_settings.loudness, - SOUND_LOUDNESS); -}; +#endif /* HAVE_LCD_BITMAP */ -static bool bass_boost(void) -{ - return set_sound(str(LANG_BBOOST), &global_settings.bass_boost, - SOUND_SUPERBASS); -}; +#ifdef HAVE_MAS3587F static void set_avc(int val) { mpeg_sound_set(SOUND_AVC, val); } -static bool avc(void) +#ifdef HAVE_LCD_BITMAP + +static bool loudness(int parameter) { - char* names[] = { str(LANG_OFF), "2s", "4s", "8s" }; - return set_option(str(LANG_DECAY), &global_settings.avc, INT, - names, 4, set_avc); + int var=mpeg_phys2val(SOUND_LOUDNESS,parameter); + global_settings.loudness=var; + return set_sound(var, SOUND_LOUDNESS); } -static bool recsource(void) +static bool bass_boost(int parameter) { - char *names[] = {str(LANG_RECORDING_SRC_MIC), str(LANG_RECORDING_SRC_LINE), - str(LANG_RECORDING_SRC_DIGITAL) }; - return set_option(str(LANG_RECORDING_SOURCE), - &global_settings.rec_source, INT, - names, 3, NULL ); + global_settings.bass_boost=mpeg_phys2val(SOUND_SUPERBASS,parameter); + global_settings.bboost_str=mpeg_phys2val(SOUND_BBOOST_STR,parameter); + global_settings.bboost_har=48*100/127; + global_settings.bboost_fc=6; + global_settings.bboost_on=true; + return set_sound(global_settings.bass_boost, SOUND_SUPERBASS); } -static bool recfrequency(void) +static bool avc(int parameter) { - char *names[] = {"44.1kHz", "48kHz", "32kHz", - "22.05kHz", "24kHz", "16kHz"}; - - return set_option(str(LANG_RECORDING_FREQUENCY), - &global_settings.rec_frequency, INT, - names, 6, NULL ); + global_settings.avc=parameter; + set_avc(parameter); + return false; } -static bool recchannels(void) +#endif /* HAVE_LCD_BITMAP */ + +static bool recsource(int parameter) { - char *names[] = {str(LANG_CHANNEL_STEREO), str(LANG_CHANNEL_MONO)}; + global_settings.rec_source=parameter; + return false; +} - return set_option(str(LANG_RECORDING_CHANNELS), - &global_settings.rec_channels, INT, - names, 2, NULL ); +static bool recfrequency(int parameter) +{ + global_settings.rec_frequency=parameter; + return false; } -static bool recquality(void) +static bool recchannels(int parameter) { - return set_int(str(LANG_RECORDING_QUALITY), "", - &global_settings.rec_quality, - NULL, 1, 0, 7 ); + global_settings.rec_channels=!parameter; + return false; } -static bool receditable(void) +static bool recquality(int parameter) { - return set_bool(str(LANG_RECORDING_EDITABLE), - &global_settings.rec_editable); + global_settings.rec_quality=parameter; + return false; } -static bool rectimesplit(void) +static bool receditable(int parameter) { - char *names[] = { - str(LANG_OFF), "00:05","00:10","00:15", - "00:30","01:00","02:00","04:00", - "06:00","08:00","10:00","12:00", - "18:00","24:00" - }; + global_settings.rec_editable=parameter; + return false; +} - return set_option(str(LANG_RECORD_TIMESPLIT), - &global_settings.rec_timesplit, INT, - names, 14, NULL ); +static bool rectimesplit(int parameter) +{ + global_settings.rec_timesplit=parameter; + return false; } #endif /* HAVE_MAS3587F */ @@ -247,15 +282,90 @@ mpeg_sound_set(SOUND_CHANNELS, val); } +#ifdef HAVE_LCD_BITMAP +static bool bboost_str(int parameter) { + global_settings.bboost_str=mpeg_phys2val(SOUND_BBOOST_STR, parameter); + mpeg_sound_set(SOUND_BBOOST_STR, global_settings.bboost_str); + return false; +} +static bool bboost_har(int parameter) { + global_settings.bboost_har=mpeg_phys2val(SOUND_BBOOST_HAR, parameter); + mpeg_sound_set(SOUND_BBOOST_HAR, global_settings.bboost_har); + return false; +} +static bool bboost_fc(int parameter) { + global_settings.bboost_fc=mpeg_phys2val(SOUND_BBOOST_FC, parameter); + mpeg_sound_set(SOUND_BBOOST_FC, global_settings.bboost_fc); + mpeg_sound_set(SOUND_BBOOST_SHAPE, global_settings.bboost_fc*1.5); + return false; +} + +static bool bboost_switch(int parameter) { + global_settings.bboost_on=parameter; + + if (global_settings.bboost_on) + mpeg_sound_set(SOUND_BBOOST_SHAPE, + global_settings.bboost_fc*1.5); + else + mpeg_sound_set(SOUND_BBOOST_SHAPE, 0); + + return false; +} +#endif /* HAVE_LCD_BITMAP */ + +#ifdef HAVE_LCD_BITMAP + +static bool adv_bass_boost_menu(int parameter) +{ + int m; + bool result=false; + + int bbstr=mpeg_val2phys(SOUND_BBOOST_STR, global_settings.bboost_str); + int bbhar=mpeg_val2phys(SOUND_BBOOST_HAR, global_settings.bboost_har); + int bbfc=mpeg_val2phys(SOUND_BBOOST_FC, global_settings.bboost_fc); + + int bbstr_min=mpeg_val2phys(SOUND_BBOOST_STR,mpeg_sound_min(SOUND_BBOOST_STR)); + int bbhar_min=mpeg_val2phys(SOUND_BBOOST_HAR,mpeg_sound_min(SOUND_BBOOST_HAR)); + int bbfc_min=mpeg_val2phys(SOUND_BBOOST_FC,mpeg_sound_min(SOUND_BBOOST_FC)); + + int bbstr_max=mpeg_val2phys(SOUND_BBOOST_STR,mpeg_sound_max(SOUND_BBOOST_STR)); + int bbhar_max=mpeg_val2phys(SOUND_BBOOST_HAR,mpeg_sound_max(SOUND_BBOOST_HAR)); + int bbfc_max=mpeg_val2phys(SOUND_BBOOST_FC,mpeg_sound_max(SOUND_BBOOST_FC)); + + char *bbstr_unit=mpeg_sound_unit(SOUND_BBOOST_STR); + char *bbhar_unit=mpeg_sound_unit(SOUND_BBOOST_HAR); + char *bbfc_unit=mpeg_sound_unit(SOUND_BBOOST_FC); + + struct menu_items_enh items[] = { + {str(LANG_BBOOST_STR), bboost_str, SLIDEBAR, + bbstr, bbstr_min, bbstr_max, 1, {bbstr_unit}}, + {str(LANG_BBOOST_HAR), bboost_har, SLIDEBAR, + bbhar, bbhar_min, bbhar_max, 1, {bbhar_unit}}, + {str(LANG_BBOOST_FC), bboost_fc, SLIDEBAR, + bbfc, bbfc_min, bbfc_max, 10, {bbfc_unit}}, + {str(LANG_BBOOST_SWITCH), bboost_switch, CHECKBOX, + global_settings.bboost_on, 0, 1, 1, {""}} + }; + + m=menu_init_enh( items, sizeof items / sizeof(struct menu_items_enh) ); + result = menu_run_enh(m); + menu_exit_enh(m); + + return result; +} + +static bool chanconf(int parameter) { + global_settings.channel_config=parameter; + set_chanconf(parameter); + return false; +} + +#else static bool chanconf(void) { char *names[] = { str(LANG_CHANNEL_STEREO), -#ifdef HAVE_LCD_CHARCELLS str(LANG_CHANNEL_STEREO_NARROW_PLAYER), -#else - str(LANG_CHANNEL_STEREO_NARROW_RECORDER), -#endif str(LANG_CHANNEL_MONO), str(LANG_CHANNEL_LEFT), str(LANG_CHANNEL_RIGHT), str(LANG_CHANNEL_KARAOKE), str(LANG_CHANNEL_STEREO_WIDE) @@ -263,27 +373,84 @@ return set_option(str(LANG_CHANNEL), &global_settings.channel_config, INT, names, 7, set_chanconf ); } +#endif bool sound_menu(void) { int m; bool result; +#ifdef HAVE_LCD_BITMAP + + int volume_val=mpeg_val2phys(SOUND_VOLUME,global_settings.volume); + int bass_val=mpeg_val2phys(SOUND_BASS,global_settings.bass); + int treble_val=mpeg_val2phys(SOUND_TREBLE,global_settings.treble); + int balance_val=mpeg_val2phys(SOUND_BALANCE,global_settings.balance); + int loudness_val=mpeg_val2phys(SOUND_LOUDNESS,global_settings.loudness); + int bboost_val=mpeg_val2phys(SOUND_SUPERBASS,global_settings.bass_boost); + + int volume_min=mpeg_val2phys(SOUND_VOLUME,mpeg_sound_min(SOUND_VOLUME)); + int bass_min=mpeg_val2phys(SOUND_BASS,mpeg_sound_min(SOUND_BASS)); + int treble_min=mpeg_val2phys(SOUND_TREBLE,mpeg_sound_min(SOUND_TREBLE)); + int balance_min=mpeg_val2phys(SOUND_BALANCE,mpeg_sound_min(SOUND_BALANCE)); + int loudness_min=mpeg_val2phys(SOUND_LOUDNESS,mpeg_sound_min(SOUND_LOUDNESS)); + int bboost_min=mpeg_val2phys(SOUND_SUPERBASS,mpeg_sound_min(SOUND_SUPERBASS)); + + int volume_max=mpeg_val2phys(SOUND_VOLUME,mpeg_sound_max(SOUND_VOLUME)); + int bass_max=mpeg_val2phys(SOUND_BASS,mpeg_sound_max(SOUND_BASS)); + int treble_max=mpeg_val2phys(SOUND_TREBLE,mpeg_sound_max(SOUND_TREBLE)); + int balance_max=mpeg_val2phys(SOUND_BALANCE,mpeg_sound_max(SOUND_BALANCE)); + int loudness_max=mpeg_val2phys(SOUND_LOUDNESS,mpeg_sound_max(SOUND_LOUDNESS)); + int bboost_max=mpeg_val2phys(SOUND_SUPERBASS,mpeg_sound_max(SOUND_SUPERBASS)); + + char *volume_unit=mpeg_sound_unit(SOUND_VOLUME); + char *bass_unit=mpeg_sound_unit(SOUND_BASS); + char *treble_unit=mpeg_sound_unit(SOUND_TREBLE); + char *balance_unit=mpeg_sound_unit(SOUND_BALANCE); + char *loudness_unit=mpeg_sound_unit(SOUND_LOUDNESS); + char *bboost_unit=mpeg_sound_unit(SOUND_SUPERBASS); + + struct menu_items_enh items[] = { + + { str(LANG_VOLUME), volume, SLIDEBAR, volume_val, + volume_min, volume_max, 1, {volume_unit} }, + { str(LANG_BASS), bass, SLIDEBAR, bass_val, + bass_min, bass_max, 1, {bass_unit} }, + { str(LANG_TREBLE), treble, SLIDEBAR, treble_val, + treble_min, treble_max, 1, {treble_unit} }, + { str(LANG_BALANCE), balance, SLIDEBAR, balance_val, + balance_min, balance_max, 1, {balance_unit} }, + { str(LANG_CHANNEL_MENU), chanconf, ARROW, + global_settings.channel_config, 0, 6, 1, { + str(LANG_CHANNEL_STEREO), + str(LANG_CHANNEL_STEREO_NARROW_RECORDER), + str(LANG_CHANNEL_MONO), + str(LANG_CHANNEL_LEFT), str(LANG_CHANNEL_RIGHT), + str(LANG_CHANNEL_KARAOKE), str(LANG_CHANNEL_STEREO_WIDE) + }}, + { str(LANG_LOUDNESS), loudness, SLIDEBAR, loudness_val, + loudness_min, loudness_max, 1, {loudness_unit} }, + { str(LANG_BBOOST), bass_boost, SLIDEBAR, + bboost_val, bboost_min, bboost_max, 1, {bboost_unit} }, + { str(LANG_AUTOVOL), avc, ARROW, + global_settings.avc, 0, 3, 1, + { str(LANG_OFF), "2s", "4s", "8s" } }, + { str(LANG_ADV_BBOOST), adv_bass_boost_menu, 0,0,0,0,0,{""} } + }; + m=menu_init_enh( items, sizeof items / sizeof(struct menu_items_enh) ); + result = menu_run_enh(m); + menu_exit_enh(m); +#else /* HAVE_LCD_BITMAP */ struct menu_items items[] = { { str(LANG_VOLUME), volume }, { str(LANG_BASS), bass }, { str(LANG_TREBLE), treble }, { str(LANG_BALANCE), balance }, - { str(LANG_CHANNEL_MENU), chanconf }, -#ifdef HAVE_MAS3587F - { str(LANG_LOUDNESS), loudness }, - { str(LANG_BBOOST), bass_boost }, - { str(LANG_AUTOVOL), avc } -#endif + { str(LANG_CHANNEL_MENU), chanconf } }; - m=menu_init( items, sizeof items / sizeof(struct menu_items) ); result = menu_run(m); menu_exit(m); +#endif /* HAVE_LCD_BITMAP */ return result; } @@ -293,18 +460,33 @@ { int m; bool result; - struct menu_items items[] = { - { str(LANG_RECORDING_QUALITY), recquality }, - { str(LANG_RECORDING_FREQUENCY), recfrequency }, - { str(LANG_RECORDING_SOURCE), recsource }, - { str(LANG_RECORDING_CHANNELS), recchannels }, - { str(LANG_RECORDING_EDITABLE), receditable }, - { str(LANG_RECORD_TIMESPLIT), rectimesplit }, + struct menu_items_enh items[] = { + { str(LANG_RECORDING_QUALITY), recquality, SLIDEBAR, + global_settings.rec_quality, 0, 7, 1, {""}}, + { str(LANG_RECORDING_FREQUENCY), recfrequency, ARROW, + global_settings.rec_frequency, 0, 5, 1, + {"44.1kHz", "48kHz", "32kHz", + "22.05kHz", "24kHz", "16kHz"}}, + { str(LANG_RECORDING_SOURCE), recsource, ARROW, + global_settings.rec_source, 0, 2, 1, + {str(LANG_RECORDING_SRC_MIC), str(LANG_RECORDING_SRC_LINE), + str(LANG_RECORDING_SRC_DIGITAL) }}, + { str(LANG_CHANNEL_STEREO_CHECKBOX), recchannels, CHECKBOX, + !global_settings.rec_channels, 0, 1, 1, {""}}, + { str(LANG_RECORDING_EDITABLE), receditable, CHECKBOX, + global_settings.rec_editable, 0, 1, 1, {""}}, + { str(LANG_RECORD_TIMESPLIT), rectimesplit, ARROW, + global_settings.rec_timesplit, 0, 13, 1, { + str(LANG_OFF), "00:05","00:10","00:15", + "00:30","01:00","02:00","04:00", + "06:00","08:00","10:00","12:00", + "18:00","24:00" + }}, }; - - m=menu_init( items, sizeof items / sizeof(struct menu_items) ); - result = menu_run(m); - menu_exit(m); + + m=menu_init_enh( items, sizeof items / sizeof(struct menu_items_enh) ); + result = menu_run_enh(m); + menu_exit_enh(m); return result; } diff -urN rockbox-old/firmware/drivers/lcd-recorder.c rockbox-new/firmware/drivers/lcd-recorder.c --- rockbox-old/firmware/drivers/lcd-recorder.c 2003-07-10 06:00:52.000000000 +0200 +++ rockbox-new/firmware/drivers/lcd-recorder.c 2003-08-26 19:20:55.000000000 +0200 @@ -226,19 +226,19 @@ void lcd_set_invert_display(bool yesno) { - if (yesno) + if (yesno) lcd_write(true, LCD_SET_REVERSE_DISPLAY); - else + else lcd_write(true, LCD_SET_NORMAL_DISPLAY); } /** * Rolls up the lcd display by the specified amount of lines. * Lines that are rolled out over the top of the screen are - * rolled in from the bottom again. This is a hardware + * rolled in from the bottom again. This is a hardware * remapping only and all operations on the lcd are affected. - * -> - * @param int lines - The number of lines that are rolled. + * -> + * @param int lines - The number of lines that are rolled. * The value must be 0 <= pixels < LCD_HEIGHT. */ void lcd_roll(int lines) @@ -337,6 +337,39 @@ #endif } +void lcd_putsxy_style(int xpos, int ypos, unsigned char *str, int style) +{ + int w,h; + +#if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) + /* We make the simulator truncate the string if it reaches the right edge, + as otherwise it'll wrap. The real target doesn't wrap. */ + + char buffer[12]; + if(strlen(str)+x > 11 ) { + strncpy(buffer, str, sizeof buffer); + buffer[11-x]=0; + str = buffer; + } + xmargin = 0; + ymargin = 8; +#endif + + if(!str || !str[0]) + return; + + lcd_getstringsize(str, &w, &h); + lcd_putsxy(xpos, ypos, str); + lcd_clearrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); + if (style & STYLE_INVERT) + lcd_invertrect(xpos, ypos, LCD_WIDTH - xpos, h); + +#if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) + lcd_update(); +#endif +} + + /* put a string at a given pixel position, skipping first ofs pixel columns */ static void lcd_putsxyofs(int x, int y, int ofs, unsigned char *str) { @@ -373,7 +406,7 @@ if (width > 0) { int rows = (pf->height + 7) / 8; - bitmap_t* bits = pf->bits + + bitmap_t* bits = pf->bits + (pf->offset ? pf->offset[ch] : (pf->height * ch)); lcd_bitmap (((unsigned char*) bits) + ofs*rows, x, y, width, pf->height, true); @@ -420,7 +453,7 @@ if (((unsigned)(x + nx)) >= LCD_WIDTH) nx = LCD_WIDTH - x; if (((unsigned)(y + ny)) >= LCD_HEIGHT) - ny = LCD_HEIGHT - y; + ny = LCD_HEIGHT - y; shift = y & 7; dst2 = &lcd_framebuffer[x][y/8]; @@ -472,7 +505,7 @@ } } -/* +/* * Draw a rectangle with upper left corner at (x, y) * and size (nx, ny) */ @@ -543,6 +576,29 @@ INVERT_PIXEL((x + i), (y + j)); } +/* Reverse the invert setting of the scrolling line (if any) at given char + position. Setting will go into affect next time line scrolls. */ +void lcd_invertscroll(int x, int y) +{ + struct scrollinfo* s; + int index; + + for ( index = 0; index < SCROLLABLE_LINES; index++ ) { + /* is this a scrolling line? */ + if ( !(scrolling_lines&(1<startx == x && s->starty == y) + { + /* Found the line */ + s->invert = !s->invert; + break; + } + } +} + void lcd_drawline( int x1, int y1, int x2, int y2 ) { int numpixels; @@ -716,11 +772,12 @@ { struct scrollinfo* s; int w, h; + int fw; int index; int free_index=0; DEBUGF("puts_scroll_style: %s\n", string); - + for (index = 0; index < SCROLLABLE_LINES; index++) { s = &scroll[index]; @@ -749,8 +806,94 @@ lcd_puts(x,y,string); lcd_getstringsize(string, &w, &h); + lcd_getstringsize(" ", &fw, &h); + + if (LCD_WIDTH - x * fw - xmargin < w) { + /* prepare scroll line */ + char *end; + + memset(s->line, 0, sizeof s->line); + strcpy(s->line, string); + + /* get width */ + s->width = lcd_getstringsize(s->line, &w, &h); + + /* scroll bidirectional or forward only depending on the string + width */ + if ( bidir_limit ) { + s->bidir = s->width < (LCD_WIDTH - xmargin - fw*x) * + (100 + bidir_limit) / 100; + } + else + s->bidir = false; + + if (!s->bidir) { /* add spaces if scrolling in the round */ + strcat(s->line, " "); + /* get new width incl. spaces */ + s->width = lcd_getstringsize(s->line, &w, &h); + } + + end = strchr(s->line, '\0'); + strncpy(end, string, LCD_WIDTH/2); + + s->len = strlen(string); + s->offset = 0; + s->startx = xmargin + x*fw+1; + s->starty = ymargin + y*h; + s->backward = false; + scrolling_lines |= (1<starty == ypos) { + /* we prefer to re-use an existing index with the + same y-position */ + free_index=index; + break; + } + } + else { + /* remember the last unused one */ + free_index=index; + } + } + index=free_index; + s = &scroll[index]; /* get the proper 's' */ + s->start_tick = current_tick + scroll_delay; + s->invert = false; + if (style & STYLE_INVERT) { + s->invert = true; + lcd_putsxy_style(xpos,ypos,string,STYLE_INVERT); + } + else + lcd_putsxy(xpos,ypos,string); + + lcd_getstringsize(string, &w, &h); + lcd_getstringsize(" ", &fw, &h); - if (LCD_WIDTH - x * 8 - xmargin < w) { + if (LCD_WIDTH - xpos < w) { /* prepare scroll line */ char *end; @@ -763,7 +906,7 @@ /* scroll bidirectional or forward only depending on the string width */ if ( bidir_limit ) { - s->bidir = s->width < (LCD_WIDTH - xmargin) * + s->bidir = s->width < (LCD_WIDTH - xpos) * (100 + bidir_limit) / 100; } else @@ -780,8 +923,8 @@ s->len = strlen(string); s->offset = 0; - s->startx = x; - s->starty = y; + s->startx = xpos; + s->starty = ypos; s->backward = false; scrolling_lines |= (1<start_tick)) continue; + xpos = s->startx; + ypos = s->starty; + if (s->backward) s->offset -= scroll_step; else s->offset += scroll_step; if (s->bidir) { /* scroll bidirectional */ + if (s->offset >= s->width - (LCD_WIDTH - xpos)) { + /* at end of line */ + s->offset = s->width - (LCD_WIDTH - xpos); + s->backward = true; + s->start_tick = current_tick + scroll_delay * 2; + } if (s->offset <= 0) { /* at beginning of line */ s->offset = 0; s->backward = false; s->start_tick = current_tick + scroll_delay * 2; } - if (s->offset >= s->width - (LCD_WIDTH - xmargin)) { - /* at end of line */ - s->offset = s->width - (LCD_WIDTH - xmargin); - s->backward = true; - s->start_tick = current_tick + scroll_delay * 2; - } } else { /* scroll forward the whole time */ @@ -861,15 +1007,13 @@ s->offset %= s->width; } - lcd_getstringsize(s->line, &w, &h); - xpos = xmargin + s->startx * w / s->len; - ypos = ymargin + s->starty * h; + lcd_getstringsize(" ", &w, &h); - lcd_clearrect(xpos, ypos, LCD_WIDTH - xmargin, h); + lcd_clearrect(xpos, ypos, LCD_WIDTH - xpos, h); lcd_putsxyofs(xpos, ypos, s->offset, s->line); if (s->invert) - lcd_invertrect(xpos, ypos, LCD_WIDTH - xmargin, h); - lcd_update_rect(xpos, ypos, LCD_WIDTH - xmargin, h); + lcd_invertrect(xpos, ypos, LCD_WIDTH - xpos, h); + lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, h); } sleep(HZ/scroll_speed); diff -urN rockbox-old/firmware/export/lcd.h rockbox-new/firmware/export/lcd.h --- rockbox-old/firmware/export/lcd.h 2003-07-10 06:00:52.000000000 +0200 +++ rockbox-new/firmware/export/lcd.h 2003-08-26 12:21:55.000000000 +0200 @@ -38,6 +38,9 @@ extern void lcd_puts_scroll(int x, int y, unsigned char* string ); extern void lcd_puts_scroll_style(int x, int y, unsigned char* string, int style); +extern void lcd_putsxy_scroll(int xpos, int ypos, unsigned char* string ); +extern void lcd_putsxy_scroll_style(int xpos, int ypos, unsigned char* string, + int style); extern void lcd_icon(int icon, bool enable); extern void lcd_stop_scroll(void); extern void lcd_scroll_speed( int speed ); @@ -121,11 +124,12 @@ extern int lcd_getxmargin(void); extern int lcd_getymargin(void); extern void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny, - bool clear); + bool clear); extern void lcd_clearrect (int x, int y, int nx, int ny); extern void lcd_fillrect (int x, int y, int nx, int ny); extern void lcd_drawrect (int x, int y, int nx, int ny); extern void lcd_invertrect (int x, int y, int nx, int ny); +extern void lcd_invertscroll(int x, int y); extern void lcd_drawline( int x1, int y1, int x2, int y2 ); extern void lcd_clearline( int x1, int y1, int x2, int y2 ); extern void lcd_drawpixel(int x, int y); diff -urN rockbox-old/firmware/export/mpeg.h rockbox-new/firmware/export/mpeg.h --- rockbox-old/firmware/export/mpeg.h 2003-07-23 06:00:28.000000000 +0200 +++ rockbox-new/firmware/export/mpeg.h 2003-08-25 11:28:59.000000000 +0200 @@ -59,8 +59,9 @@ int lowest_watermark_level; }; -void mpeg_init(int volume, int bass, int treble, int balance, - int loudness, int bass_boost, int avc, int channel_config); +void mpeg_init(int volume, int bass, int treble, int balance, int loudness, + int bass_boost, int bbstr, int bbhar, int bbfc, int bbon, + int avc, int channel_config); void mpeg_play(int offset); void mpeg_stop(void); void mpeg_pause(void); @@ -110,6 +111,10 @@ #define SOUND_RIGHT_GAIN 9 #define SOUND_MIC_GAIN 10 #define SOUND_NUMSETTINGS 11 +#define SOUND_BBOOST_STR 12 +#define SOUND_BBOOST_HAR 13 +#define SOUND_BBOOST_FC 14 +#define SOUND_BBOOST_SHAPE 15 #define MPEG_SOUND_STEREO 0 #define MPEG_SOUND_STEREO_NARROW 1 diff -urN rockbox-old/firmware/mpeg.c rockbox-new/firmware/mpeg.c --- rockbox-old/firmware/mpeg.c 2003-08-20 06:00:56.000000000 +0200 +++ rockbox-new/firmware/mpeg.c 2003-08-26 20:17:52.000000000 +0200 @@ -5,7 +5,7 @@ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ - * $Id: mpeg.c,v 1.238 2003/08/20 02:11:00 hardeeps Exp $ + * $Id: mpeg.c,v 1.237 2003/07/22 18:34:22 linusnielsen Exp $ * * Copyright (C) 2002 by Linus Nielsen Feltzing * @@ -97,6 +97,10 @@ "dB", /* Left gain */ "dB", /* Right gain */ "dB", /* Mic gain */ + "", /* -- numsettings -- */ + "%", /* MDB strength */ + "%", /* MDB harmonics */ + "Hz", /* MDB cutoff freq */ }; static int numdecimals[] = @@ -112,6 +116,10 @@ 1, /* Left gain */ 1, /* Right gain */ 1, /* Mic gain */ + 0, /* -- numsettings -- */ + 0, /* MDB strength */ + 0, /* MDB harmonics */ + 0, /* MDB cutoff freq */ }; static int minval[] = @@ -127,6 +135,10 @@ 0, /* Left gain */ 0, /* Right gain */ 0, /* Mic gain */ + 15, /* -- numsettings -- */ + 0, /* MDB strength */ + 0, /* MDB harmonics */ + 2, /* MDB cutoff freq */ }; static int maxval[] = @@ -147,6 +159,10 @@ 15, /* Left gain */ 15, /* Right gain */ 15, /* Mic gain */ + 15, /* -- numsettings -- */ + 100, /* MDB strength */ + 100, /* MDB harmonics */ + 30, /* MDB cutoff freq */ }; static int defaultval[] = @@ -167,6 +183,10 @@ 8, /* Left gain */ 2, /* Right gain */ 2, /* Mic gain */ + 15, /* -- numsettings -- */ + 0, /* MDB strength */ + 0, /* MDB harmonics */ + 6, /* MDB cutoff freq */ }; char *mpeg_sound_unit(int setting) @@ -261,7 +281,7 @@ static void remove_current_tag(void) { int oldidx = tag_read_idx; - + if(num_tracks_in_memory() > 0) { /* First move the index, so nobody tries to access the tag */ @@ -293,7 +313,7 @@ static void remove_all_tags(void) { int i; - + for(i = 0;i < MAX_ID3_TAGS;i++) remove_current_tag(); @@ -319,7 +339,7 @@ break; } } - + i--; if (i < 0) i = 0; @@ -332,7 +352,7 @@ } else { - nextpos = 256; + nextpos = 256; } remainder = id3->offset - (relpos * (id3->filesize / 256)); @@ -511,9 +531,9 @@ and set a high threshold */ if(bitrate == 0) bitrate = 320; - + bytes_per_sec = bitrate * 1000 / 8; - + if(time) { /* No drive spins up faster than 3.5s */ @@ -572,9 +592,9 @@ interval_in_ms); return; } - + /* We are using timer 1 */ - + TSTR &= ~0x02; /* Stop the timer */ TSNC &= ~0x02; /* No synchronization */ TMDR &= ~0x02; /* Operate normally */ @@ -585,7 +605,7 @@ /* Enable interrupt on level 5 */ IPRC = (IPRC & ~0x000f) | 0x0005; - + TSR1 &= ~0x02; TIER1 = 0xf9; /* Enable GRA match interrupt */ @@ -599,7 +619,7 @@ count = FREQ / 1000 / 8; /* We are using timer 1 */ - + TSTR &= ~0x02; /* Stop the timer */ TSNC &= ~0x02; /* No synchronization */ TMDR &= ~0x02; /* Operate normally */ @@ -610,7 +630,7 @@ /* Enable interrupt on level 5 */ IPRC = (IPRC & ~0x000f) | 0x0005; - + TSR1 &= ~0x02; TIER1 = 0xf9; /* Enable GRA match interrupt */ @@ -622,7 +642,7 @@ static void dbg_timer_start(void) { /* We are using timer 2 */ - + TSTR &= ~0x04; /* Stop the timer */ TSNC &= ~0x04; /* No synchronization */ TMDR &= ~0x44; /* Operate normally */ @@ -725,9 +745,9 @@ while((*((volatile unsigned char *)PBDR_ADDR) & 0x40)) { PADR |= 0x800; - + while(*((volatile unsigned char *)PBDR_ADDR) & 0x80); - + /* It must take at least 5 cycles before the data is read */ asm(" nop\n nop\n nop\n"); @@ -742,14 +762,14 @@ while((*((volatile unsigned char *)PBDR_ADDR) & 0x40)) { PADR &= ~0x800; - + while(*((volatile unsigned char *)PBDR_ADDR) & 0x80); - + /* It must take at least 5 cycles before the data is read */ asm(" nop\n nop\n nop\n"); asm(" nop\n nop\n nop\n"); - + PADR |= 0x800; while(!(*((volatile unsigned char *)PBDR_ADDR) & 0x80)); @@ -801,17 +821,17 @@ PADR |= 0x800; while(*((volatile unsigned char *)PBDR_ADDR) & 0x80); - + /* It must take at least 5 cycles before the data is read */ asm(" nop\n nop\n nop\n"); mp3buf[mp3buf_write++] = *(unsigned char *)0x4000000; - + if(mp3buf_write >= mp3buflen) mp3buf_write = 0; i++; - + PADR &= ~0x800; /* No wait for /RTW, cause it's not necessary */ @@ -824,19 +844,19 @@ && i < 30) { PADR &= ~0x800; - + while(*((volatile unsigned char *)PBDR_ADDR) & 0x80); - + /* It must take at least 5 cycles before the data is read */ asm(" nop\n nop\n nop\n"); mp3buf[mp3buf_write++] = *(unsigned char *)0x4000000; - + if(mp3buf_write >= mp3buflen) mp3buf_write = 0; i++; - + PADR |= 0x800; /* No wait for /RTW, cause it's not necessary */ @@ -848,7 +868,7 @@ #endif num_rec_bytes += i; - + /* Signal to save the data if we are running out of buffer space */ num_bytes = mp3buf_write - mp3buf_read; @@ -886,7 +906,7 @@ mp3buf_read += last_dma_chunk_size; if(mp3buf_read >= mp3buflen) mp3buf_read = 0; - + /* First, check if we are on a track boundary */ if (num_tracks_in_memory() > 0) { @@ -896,17 +916,17 @@ track_offset = (track_offset+1) & MAX_ID3_TAGS_MASK; } } - + unplayed_space_left = get_unplayed_space(); - + space_until_end_of_buffer = mp3buflen - mp3buf_read; - + if(!filling && unplayed_space_left < low_watermark) { filling = true; queue_post(&mpeg_queue, MPEG_NEED_DATA, 0); } - + if(unplayed_space_left) { last_dma_chunk_size = MIN(0x2000, unplayed_space_left); @@ -946,7 +966,7 @@ /* Update the watermark debug level */ if(unplayed_space_left < lowest_watermark_level) lowest_watermark_level = unplayed_space_left; - + DEBUGF("DMA underrun.\n"); dma_underrun = true; } @@ -970,7 +990,7 @@ static void demand_irq_enable(bool on) { int oldlevel = set_irq_level(15); - + if(on) { IPRA = (IPRA & 0xfff0) | 0x000b; @@ -1006,7 +1026,7 @@ { /* Begin with setting the IRQ to edge sensitive */ ICR |= 0x0010; - + if(mpeg_mode == MPEG_ENCODER) dma_tick(); else @@ -1063,9 +1083,9 @@ trackname = playlist_peek( start + steps ); if ( !trackname ) return -1; - + DEBUGF("playing %s\n", trackname); - + mpeg_file = open(trackname, O_RDONLY); if(mpeg_file < 0) { DEBUGF("Couldn't open file: %s\n",trackname); @@ -1089,7 +1109,7 @@ else { /* skip past id3v2 tag */ - lseek(mpeg_file, + lseek(mpeg_file, id3tags[new_tag_idx]->id3.first_frame_offset, SEEK_SET); id3tags[new_tag_idx]->id3.index = steps; @@ -1102,7 +1122,7 @@ else recalculate_watermark( id3tags[new_tag_idx]->id3.bitrate); - + } } } while ( mpeg_file < 0 ); @@ -1174,7 +1194,7 @@ playable_space = mp3buf_swapwrite - mp3buf_read; if(playable_space < 0) playable_space += mp3buflen; - + /* See if we have started playing yet. If not, do it. */ if(play_pending || dma_underrun) { @@ -1187,7 +1207,7 @@ DEBUGF("P\n"); play_pending = false; playing = true; - + init_dma(); if (!paused) { @@ -1226,7 +1246,7 @@ else amount_to_swap = MIN(MPEG_SWAP_CHUNKSIZE, free_space_left); } - + if(mp3buf_write < mp3buf_swapwrite) amount_to_swap = MIN(mp3buflen - mp3buf_swapwrite, amount_to_swap); @@ -1268,7 +1288,7 @@ int framelen; unsigned long saved_header; #endif - + is_playing = false; play_pending = false; playing = false; @@ -1295,7 +1315,7 @@ } start_playback_if_ready(); - + switch(ev.id) { case MPEG_PLAY: @@ -1337,8 +1357,8 @@ } else { /* skip past id3v2 tag */ - lseek(mpeg_file, - id3tags[tag_read_idx]->id3.first_frame_offset, + lseek(mpeg_file, + id3tags[tag_read_idx]->id3.first_frame_offset, SEEK_SET); } @@ -1383,7 +1403,7 @@ if ( current_track_counter == pause_track ) last_dma_tick += current_tick - pause_tick; else - last_dma_tick = current_tick; + last_dma_tick = current_tick; pause_tick = 0; start_dma(); } @@ -1439,7 +1459,7 @@ /* Open the next file */ if (mpeg_file >= 0) close(mpeg_file); - + if (new_file(1) < 0) { DEBUGF("No more files to play\n"); filling = false; @@ -1447,7 +1467,7 @@ /* Make it read more data */ filling = true; queue_post(&mpeg_queue, MPEG_NEED_DATA, 0); - + /* Tell the file loading code that we want to start playing as soon as we have some data */ play_pending = true; @@ -1463,7 +1483,7 @@ if (!playlist_check(-1)) break; - + /* stop the current stream */ play_pending = false; playing = false; @@ -1510,20 +1530,20 @@ /* Use the TOC to find the new position */ unsigned int percent, remainder; int curtoc, nexttoc, plen; - - percent = (newtime*100)/id3->length; + + percent = (newtime*100)/id3->length; if (percent > 99) percent = 99; - + curtoc = id3->toc[percent]; - + if (percent < 99) nexttoc = id3->toc[percent+1]; else nexttoc = 256; - + newpos = (id3->filesize/256)*curtoc; - + /* Use the remainder to get a more accurate position */ remainder = (newtime*100)%id3->length; remainder = (remainder*100)/id3->length; @@ -1533,7 +1553,9 @@ else { /* No TOC exists, estimate the new position */ - newpos = (id3->filesize/id3->length)*newtime; + /* Calculate using seconds to avoid round off error */ + newpos = (id3->filesize/(id3->length/1000)); + newpos *= (newtime/1000); } } else if (id3->bpf && id3->tpf) @@ -1601,7 +1623,7 @@ hasn't yet advanced up to the new location of the read pointer. We just move it, there is no need to swap data that won't be played anyway. */ - + if (unswapped_space_left > unplayed_space_left) { DEBUGF("Moved swapwrite\n"); @@ -1732,7 +1754,7 @@ /* Don't read more than until the end of the buffer */ amount_to_read = MIN(mp3buflen - mp3buf_write, amount_to_read); -#if MEM == 8 +#if MEM == 8 amount_to_read = MIN(0x100000, amount_to_read); #endif @@ -1756,7 +1778,7 @@ int i; char *tag = "TAG"; int taglen = 128; - + for(i = 0;i < 3;i++) { if(tagptr >= mp3buflen) @@ -1783,7 +1805,7 @@ } mp3buf_write += len; - + if(mp3buf_write >= mp3buflen) { mp3buf_write = 0; @@ -1799,10 +1821,10 @@ { DEBUGF("MPEG read error\n"); } - + close(mpeg_file); mpeg_file = -1; - + if(new_file(1) < 0) { /* No more data to play */ @@ -1817,17 +1839,17 @@ } } break; - + case MPEG_TRACK_CHANGE: track_change(); break; - + case SYS_USB_CONNECTED: is_playing = false; paused = false; stop_playing(); #ifndef SIMULATOR - + /* Tell the USB thread that we are safe */ DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n"); usb_acknowledge(SYS_USB_CONNECTED_ACK); @@ -1836,7 +1858,7 @@ usb_wait_for_disconnect(&mpeg_queue); #endif break; - + #ifdef HAVE_MAS3587F case MPEG_INIT_RECORDING: init_recording(); @@ -1865,9 +1887,9 @@ start_recording(); demand_irq_enable(true); - + mpeg_file = open(recording_filename, O_WRONLY|O_CREAT); - + if(mpeg_file < 0) panicf("recfile: %d", mpeg_file); @@ -1877,15 +1899,15 @@ DEBUGF("MPEG_STOP\n"); demand_irq_enable(false); stop_recording(); - + /* Save the remaining data in the buffer */ stop_pending = true; queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0); break; - + case MPEG_STOP_DONE: DEBUGF("MPEG_STOP_DONE\n"); - + if(mpeg_file >= 0) close(mpeg_file); @@ -1902,18 +1924,18 @@ /* Read the first MP3 frame from the recorded stream */ lseek(mpeg_file, MPEG_RESERVED_HEADER_SPACE, SEEK_SET); read(mpeg_file, &saved_header, 4); - + framelen = create_xing_header(mpeg_file, 0, num_rec_bytes, mp3buf, num_recorded_frames, saved_header, NULL, false); - + lseek(mpeg_file, MPEG_RESERVED_HEADER_SPACE-framelen, SEEK_SET); write(mpeg_file, mp3buf, framelen); close(mpeg_file); - + mpeg_file = -1; - + #ifdef DEBUG1 { int i; @@ -1929,17 +1951,17 @@ #endif mpeg_stop_done = true; break; - + case MPEG_SAVE_DATA: amount_to_save = mp3buf_write - mp3buf_read; - + /* If the result is negative, the write index has wrapped */ if(amount_to_save < 0) { amount_to_save += mp3buflen; } - + DEBUGF("r: %x w: %x\n", mp3buf_read, mp3buf_write); DEBUGF("ats: %x\n", amount_to_save); /* Save data only if the buffer is getting full, @@ -1951,16 +1973,16 @@ stop_pending) { int rc; - + /* Only save up to the end of the buffer */ writelen = MIN(amount_to_save, mp3buflen - mp3buf_read); - + DEBUGF("wrl: %x\n", writelen); - + rc = write(mpeg_file, mp3buf + mp3buf_read, writelen); - + if(rc < 0) { if(errno == ENOSPC) @@ -1976,7 +1998,7 @@ panicf("rec wrt: %d", rc); } } - + rc = fsync(mpeg_file); if(rc < 0) panicf("rec fls: %d", rc); @@ -1984,7 +2006,7 @@ mp3buf_read += amount_to_save; if(mp3buf_read >= mp3buflen) mp3buf_read = 0; - + queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0); } else @@ -2003,7 +2025,7 @@ ata_sleep(); } break; - + case MPEG_INIT_PLAYBACK: init_playback(); init_playback_done = true; @@ -2018,7 +2040,7 @@ { /* PB15 is I/O, PB14 is IRQ6, PB12 is SCK0, PB9 is TxD0 */ PBCR1 = (PBCR1 & 0x0cff) | 0x1208; - + /* Set PB12 to output */ PBIOR |= 0x1000; @@ -2046,7 +2068,7 @@ /* Enable End of DMA interrupt at prio 8 */ IPRC = (IPRC & 0xf0ff) | 0x0800; - + /* Enable Tx (only!) */ SCR0 |= 0x20; } @@ -2110,16 +2132,16 @@ reset_mp3_buffer(); remove_all_tags(); - + if(mpeg_file >= 0) close(mpeg_file); mpeg_file = -1; /* Init the recording variables */ is_recording = false; - + mas_reset(); - + /* Enable the audio CODEC and the DSP core, max analog voltage range */ rc = mas_direct_config_write(MAS_CONTROL, 0x8c00); if(rc < 0) @@ -2127,7 +2149,7 @@ /* Stop the current application */ val = 0; - mas_writemem(MAS_BANK_D0,0x7f6,&val,1); + mas_writemem(MAS_BANK_D0,0x7f6,&val,1); do { mas_readmem(MAS_BANK_D0, 0x7f7, &val, 1); @@ -2149,7 +2171,7 @@ /* Copy left channel to right (mono mode) */ mas_codec_writereg(8, 0x8000); - + /* ADC scale 0%, DSP scale 100% We use the DSP output for monitoring, because it works with all sources including S/PDIF */ @@ -2158,8 +2180,8 @@ /* No mute */ val = 0; - mas_writemem(MAS_BANK_D0, 0x7f9, &val, 1); - + mas_writemem(MAS_BANK_D0, 0x7f9, &val, 1); + /* Set Demand mode, no monitoring and validate all settings */ val = 0x125; mas_writemem(MAS_BANK_D0, 0x7f1, &val, 1); @@ -2178,7 +2200,7 @@ DMA transfer has taken place. Now let's wait for some data to be encoded. */ sleep(20); - + /* Disable IRQ6 */ IPRB &= 0xff0f; @@ -2193,9 +2215,9 @@ int rc; stop_dma(); - + mas_reset(); - + /* Enable the audio CODEC and the DSP core, max analog voltage range */ rc = mas_direct_config_write(MAS_CONTROL, 0x8c00); if(rc < 0) @@ -2203,12 +2225,12 @@ /* Stop the current application */ val = 0; - mas_writemem(MAS_BANK_D0,0x7f6,&val,1); + mas_writemem(MAS_BANK_D0,0x7f6,&val,1); do { mas_readmem(MAS_BANK_D0, 0x7f7, &val, 1); } while(val); - + /* Enable the D/A Converter */ mas_codec_writereg(0x0, 0x0001); @@ -2248,10 +2270,10 @@ void mpeg_record(char *filename) { mpeg_errno = 0; - + strncpy(recording_filename, filename, MAX_PATH - 1); recording_filename[MAX_PATH - 1] = 0; - + num_rec_bytes = 0; queue_post(&mpeg_queue, MPEG_RECORD, NULL); } @@ -2261,7 +2283,7 @@ unsigned long val; num_recorded_frames = 0; - + /* Stop monitoring and record for real */ mas_readmem(MAS_BANK_D0, 0x7f1, &val, 1); val &= ~(1 << 10); @@ -2275,7 +2297,7 @@ } while(val & 1); sleep(20); - + /* Store the current time */ record_start_time = current_tick; @@ -2292,7 +2314,7 @@ /* Read the number of frames recorded */ mas_readmem(MAS_BANK_D0, 0xfd0, &num_recorded_frames, 1); - + /* Start monitoring */ mas_readmem(MAS_BANK_D0, 0x7f1, &val, 1); val |= (1 << 10) | 1; @@ -2303,7 +2325,7 @@ { mas_readmem(MAS_BANK_D0, 0x7f1, &val,1); } while(val & 1); - + drain_dma_buffer(); } @@ -2332,7 +2354,7 @@ int steps=0; is_playing = true; - + do { trackname = playlist_peek( steps ); if (!trackname) @@ -2352,7 +2374,7 @@ } while(1); #else is_playing = true; - + queue_post(&mpeg_queue, MPEG_PLAY, (void*)offset); #endif @@ -2370,7 +2392,7 @@ is_playing = false; playing = false; #endif - + } void mpeg_pause(void) @@ -2475,7 +2497,7 @@ if(paused) ret |= MPEG_STATUS_PAUSE; - + #ifdef HAVE_MAS3587F if(is_recording) ret |= MPEG_STATUS_RECORD; @@ -2483,7 +2505,7 @@ if(mpeg_errno) ret |= MPEG_STATUS_ERROR; - + return ret; } @@ -2524,7 +2546,7 @@ bass or treble */ mas_writereg(MAS_REG_KPRESCALE, prescale_table[prescale/10]); - + /* gain up the analog volume to compensate the prescale reduction gain */ l = current_left_volume + prescale; r = current_right_volume + prescale; @@ -2547,7 +2569,7 @@ if(!mpeg_is_initialized) return; - + switch(setting) { case SOUND_VOLUME: @@ -2557,21 +2579,21 @@ #else l = value; r = value; - + if(current_balance > 0) { l -= current_balance; if(l < 0) l = 0; } - + if(current_balance < 0) { r += current_balance; if(r < 0) r = 0; } - + l = 0x38 * l / 100; r = 0x38 * r / 100; @@ -2597,7 +2619,7 @@ #ifdef HAVE_MAS3587F tmp = (((value-12) * 8) & 0xff) << 8; mas_codec_writereg(0x14, tmp & 0xff00); -#else +#else mas_writereg(MAS_REG_KBASS, bass_table[value]); current_bass = (value-15) * 10; set_prescaled_volume(); @@ -2608,13 +2630,13 @@ #ifdef HAVE_MAS3587F tmp = (((value-12) * 8) & 0xff) << 8; mas_codec_writereg(0x15, tmp & 0xff00); -#else +#else mas_writereg(MAS_REG_KTREBLE, treble_table[value]); current_treble = (value-15) * 10; set_prescaled_volume(); #endif break; - + #ifdef HAVE_MAS3587F case SOUND_SUPERBASS: if (value) { @@ -2636,12 +2658,51 @@ mas_codec_writereg(MAS_REG_KMDB_SWITCH, 0); /* MDB_SWITCH disable */ } break; - + + case SOUND_BBOOST_STR: + /* Strength */ + if (value) { + tmp = MAX(MIN(value*127/100, 0x7f), 0); + mas_codec_writereg(MAS_REG_KMDB_STR, (tmp & 0xff) << 8); + } else { + mas_codec_writereg(MAS_REG_KMDB_STR, 0); + }; + break; + + case SOUND_BBOOST_HAR: + /* Harmonics */ + if (value) { + tmp = MAX(MIN(value*127/100, 0x7f), 0); + mas_codec_writereg(MAS_REG_KMDB_HAR, (tmp & 0xff) << 8); + } else { + mas_codec_writereg(MAS_REG_KMDB_HAR, 0); + }; + break; + + case SOUND_BBOOST_FC: + /* Cutoff Frequency */ + if (value) { + tmp=MAX(MIN(value, 30), 2); + mas_codec_writereg(MAS_REG_KMDB_FC, (tmp & 0xff) << 8); + }; + break; + + case SOUND_BBOOST_SHAPE: + /* Steepness of the slope of the bandpass */ + if (value) { + tmp=MAX(MIN(value, 30), 5); + mas_codec_writereg(MAS_REG_KMDB_SWITCH, + ((tmp & 0xff) << 8 | 2)); + } else { + mas_codec_writereg(MAS_REG_KMDB_SWITCH, 0); + }; + break; + case SOUND_LOUDNESS: tmp = MAX(MIN(value * 4, 0x44), 0); mas_codec_writereg(MAS_REG_KLOUDNESS, (tmp & 0xff) << 8); break; - + case SOUND_AVC: switch (value) { case 1: /* 2s */ @@ -2659,7 +2720,7 @@ break; default: /* off */ tmp = 0; - break; + break; } mas_codec_writereg(MAS_REG_KAVC, tmp); break; @@ -2674,17 +2735,17 @@ int mpeg_val2phys(int setting, int value) { int result = 0; - + switch(setting) { case SOUND_VOLUME: result = value; break; - + case SOUND_BALANCE: result = value * 2; break; - + case SOUND_BASS: #ifdef HAVE_MAS3587F result = value - 12; @@ -2692,7 +2753,7 @@ result = value - 15; #endif break; - + case SOUND_TREBLE: #ifdef HAVE_MAS3587F result = value - 12; @@ -2703,9 +2764,14 @@ #ifdef HAVE_MAS3587F case SOUND_LOUDNESS: + case SOUND_AVC: + case SOUND_BBOOST_STR: + case SOUND_BBOOST_HAR: result = value; break; - + + case SOUND_BBOOST_FC: + case SOUND_BBOOST_SHAPE: case SOUND_SUPERBASS: result = value * 10; break; @@ -2726,17 +2792,17 @@ int mpeg_phys2val(int setting, int value) { int result = 0; - + switch(setting) { case SOUND_VOLUME: result = value; break; - + case SOUND_BALANCE: result = value / 2; break; - + case SOUND_BASS: #ifdef HAVE_MAS3587F result = value + 12; @@ -2744,7 +2810,7 @@ result = value + 15; #endif break; - + case SOUND_TREBLE: #ifdef HAVE_MAS3587F result = value + 12; @@ -2754,15 +2820,25 @@ break; #ifdef HAVE_MAS3587F + case SOUND_BBOOST_FC: + case SOUND_BBOOST_SHAPE: case SOUND_SUPERBASS: result = value / 10; break; - case SOUND_LOUDNESS: - case SOUND_AVC: case SOUND_LEFT_GAIN: case SOUND_RIGHT_GAIN: + result = value/15 + 2; + break; + case SOUND_MIC_GAIN: + result = (value-210)/15; + break; + + case SOUND_LOUDNESS: + case SOUND_AVC: + case SOUND_BBOOST_STR: + case SOUND_BBOOST_HAR: result = value; break; #endif @@ -2781,7 +2857,7 @@ unsigned long val_lr = 0; unsigned long val_rl = 0; unsigned long val_rr = 0x80000; - + switch(configuration) { case MPEG_SOUND_STEREO: @@ -2864,7 +2940,7 @@ /* Calculate the new (bogus) frequency */ val = 18432*pitch/1000; - + mas_writemem(MAS_BANK_D0,0x7f3,&val,1); /* We must tell the MAS that the frequency has changed. @@ -2886,7 +2962,7 @@ rec_version_index = is_mpeg1?3:2; rec_frequency_index = frequency % 3; - + val = (quality << 17) | (rec_frequency_index << 10) | ((is_mpeg1?1:0) << 9) | @@ -2914,7 +2990,7 @@ DEBUGF("mas_writemem(MAS_BANK_D0, 0x7f1, %x)\n", val); drain_dma_buffer(); - + if(source == 0) /* Mic */ { /* Copy left channel to right (mono mode) */ @@ -2960,28 +3036,32 @@ } #endif -void mpeg_init(int volume, int bass, int treble, int balance, int loudness, - int bass_boost, int avc, int channel_config) +void mpeg_init(int volume, int bass, int treble, int balance, int loudness, + int bass_boost, int bbstr, int bbhar, int bbfc, int bbon, + int avc, int channel_config) { mpeg_errno = 0; - + #ifdef SIMULATOR volume = bass = treble = balance = loudness - = bass_boost = avc = channel_config; + = bass_boost = bbstr = bbhar = bbfc = bbon = avc = channel_config; create_thread(mpeg_thread, mpeg_stack, sizeof(mpeg_stack), mpeg_thread_name); #else #ifdef HAVE_MAS3507D unsigned long val; - loudness = bass_boost = avc; + loudness = bass_boost = bbstr = bbhar = bbfc = bbon = avc; #endif + + setup_sci0(); #ifdef HAVE_MAS3587F + int bbshp=0; PAIOR |= 0x0800; /* output for /PR */ init_playback(); - + mas_version_code = mas_readver(); DEBUGF("MAS3587 derivate %d, version B%d\n", (mas_version_code & 0xff00) >> 8, mas_version_code & 0xff); @@ -2990,13 +3070,13 @@ #ifdef HAVE_DAC3550A dac_init(); #endif - + #ifdef HAVE_MAS3507D PBDR &= ~0x20; sleep(HZ/5); PBDR |= 0x20; sleep(HZ/5); - + /* set IRQ6 to edge detect */ ICR |= 0x02; @@ -3004,7 +3084,7 @@ IPRB = ( IPRB & 0xff0f ) | 0x0080; mas_readmem(MAS_BANK_D1, 0xff7, &mas_version_code, 1); - + mas_writereg(0x3b, 0x20); /* Don't ask why. The data sheet doesn't say */ mas_run(1); sleep(HZ); @@ -3012,7 +3092,7 @@ /* Clear the upper 12 bits of the 32-bit samples */ mas_writereg(0xc5, 0); mas_writereg(0xc6, 0); - + /* We need to set the PLL for a 14.1318MHz crystal */ if(mas_version_code == 0x0601) /* Version F10? */ { @@ -3034,7 +3114,7 @@ mas_writemem(MAS_BANK_D0, 0x36f, &val, 1); mas_run(0xfcb); } - + #endif mp3buflen = mp3end - mp3buf; @@ -3059,16 +3139,26 @@ /* Must be done before calling mpeg_sound_set() */ mpeg_is_initialized = true; - + mpeg_sound_set(SOUND_BASS, bass); mpeg_sound_set(SOUND_TREBLE, treble); mpeg_sound_set(SOUND_BALANCE, balance); mpeg_sound_set(SOUND_VOLUME, volume); - + #ifdef HAVE_MAS3587F mpeg_sound_channel_config(channel_config); mpeg_sound_set(SOUND_LOUDNESS, loudness); mpeg_sound_set(SOUND_SUPERBASS, bass_boost); + mpeg_sound_set(SOUND_BBOOST_STR, bbstr); + mpeg_sound_set(SOUND_BBOOST_HAR, bbhar); + mpeg_sound_set(SOUND_BBOOST_FC, bbfc); + + if (!bbon) + bbshp=0; + else + bbshp=1.5*bbfc; + + mpeg_sound_set(SOUND_BBOOST_SHAPE, bbshp); mpeg_sound_set(SOUND_AVC, avc); #endif #endif /* !SIMULATOR */ @@ -3082,7 +3172,7 @@ else inverted_pr = false; #endif - + #ifdef DEBUG dbg_timer_start(); dbg_cnt2us(0); Binary files rockbox-old/tools/bmp2rb.exe and rockbox-new/tools/bmp2rb.exe differ Binary files rockbox-old/tools/convbdf.exe and rockbox-new/tools/convbdf.exe differ Binary files rockbox-old/tools/descramble.exe and rockbox-new/tools/descramble.exe differ Binary files rockbox-old/tools/generate_rocklatin.exe and rockbox-new/tools/generate_rocklatin.exe differ Binary files rockbox-old/tools/scramble.exe and rockbox-new/tools/scramble.exe differ Binary files rockbox-old/tools/sh2d.exe and rockbox-new/tools/sh2d.exe differ