diff -Naur rockbox-19442/apps/gui/pitchscreen.c _000/apps/gui/pitchscreen.c --- rockbox-19442/apps/gui/pitchscreen.c 2008-12-15 12:40:51.937500000 +0900 +++ _000/apps/gui/pitchscreen.c 2008-12-16 03:26:37.942216000 +0900 @@ -53,7 +53,8 @@ #define PITCH_NUDGE_DELTA 20 -static int pitch_mode = PITCH_MODE_ABSOLUTE; /* 1 - absolute, -1 - semitone */ +static bool pitch_mode_initialized = false; +static int pitch_mode; enum { @@ -260,6 +261,12 @@ bool nudged = false; bool exit = false; short i; + + if (!pitch_mode_initialized) { + pitch_mode = global_settings.pitch_change_mode; + pitch_mode_initialized = true; + } + struct viewport parent[NB_SCREENS]; /* should maybe be a parameter of this function */ short max_lines[NB_SCREENS]; @@ -336,7 +343,8 @@ break; case ACTION_PS_TOGGLE_MODE: - pitch_mode = -pitch_mode; + pitch_mode = (pitch_mode == PITCH_MODE_ABSOLUTE) ? + PITCH_MODE_SEMITONE : PITCH_MODE_ABSOLUTE; break; case ACTION_PS_EXIT: diff -Naur rockbox-19442/apps/lang/english.lang _000/apps/lang/english.lang --- rockbox-19442/apps/lang/english.lang 2008-12-15 21:26:56.000000000 +0900 +++ _000/apps/lang/english.lang 2008-12-16 03:23:52.013622400 +0900 @@ -8055,15 +8055,15 @@ user: *: none - pitchscreen: "Pitch" + pitchscreen: "Quick pitch" *: none - pitchscreen: "Pitch" + pitchscreen: "Quick pitch" *: none - pitchscreen: "Pitch" + pitchscreen: "Quick pitch" @@ -12373,3 +12373,62 @@ *: "Set as playlist catalog directory" + + id: LANG_PITCH_CHANGE_MODE + desc: in the system menu + user: + + *: "Pitch Change Mode" + + + *: "Pitch Change Mode" + + + *: "Pitch Change Mode" + + + + id: LANG_PITCH_CHANGE_SMALL_STEPS + desc: in the pitch change mode menu + user: + + *: "Small Steps" + + + *: "Small Steps" + + + *: "Small Steps" + + + + id: LANG_PITCH_CHANGE_SEMITONES + desc: in the pitch change mode menu + user: + + *: "Semitones" + + + *: "Semitones" + + + *: "Semitones" + + + + id: LANG_PPITCH + desc: "pitch" in the pitch screen + user: + + *: none + pitchscreen: "pitch" + + + *: none + pitchscreen: "pitch" + + + *: none + pitchscreen: "pitch" + + diff -Naur rockbox-19442/apps/menus/settings_menu.c _000/apps/menus/settings_menu.c --- rockbox-19442/apps/menus/settings_menu.c 2008-12-15 17:17:09.671875000 +0900 +++ _000/apps/menus/settings_menu.c 2008-12-16 03:21:54.000000000 +0900 @@ -270,6 +270,9 @@ MENUITEM_SETTING(touchpad_sensitivity, &global_settings.touchpad_sensitivity, NULL); #endif +#ifdef HAVE_PITCHSCREEN +MENUITEM_SETTING(pitch_change_mode, &global_settings.pitch_change_mode, NULL); +#endif MAKE_MENU(system_menu, ID2P(LANG_SYSTEM), 0, Icon_System_menu, @@ -303,6 +306,9 @@ #ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING &touchpad_sensitivity, #endif +#ifdef HAVE_PITCHSCREEN + &pitch_change_mode, +#endif ); /* SYSTEM MENU */ diff -Naur rockbox-19442/apps/menus/sound_menu.c _000/apps/menus/sound_menu.c --- rockbox-19442/apps/menus/sound_menu.c 2008-12-15 10:19:58.000000000 +0900 +++ _000/apps/menus/sound_menu.c 2008-12-16 03:21:54.000000000 +0900 @@ -102,6 +102,10 @@ MENUITEM_SETTING(mdb_shape, &global_settings.mdb_shape, NULL); #endif +#ifdef HAVE_PITCHSCREEN + MENUITEM_SETTING(pitch, &global_settings.pitch, lowlatency_callback); +#endif + MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio, @@ -122,5 +126,8 @@ ,&loudness,&avc,&superbass,&mdb_enable,&mdb_strength ,&mdb_harmonics,&mdb_center,&mdb_shape #endif +#ifdef HAVE_PITCHSCREEN + ,&pitch +#endif ); diff -Naur rockbox-19442/apps/plugins/mpegplayer/mpeg_settings.c _000/apps/plugins/mpegplayer/mpeg_settings.c --- rockbox-19442/apps/plugins/mpegplayer/mpeg_settings.c 2008-12-15 10:20:02.000000000 +0900 +++ _000/apps/plugins/mpegplayer/mpeg_settings.c 2008-12-13 22:19:56.000000000 +0900 @@ -193,6 +193,10 @@ {TYPE_INT, 0, 2, &settings.crossfeed, "Crossfeed", NULL, NULL}, {TYPE_INT, 0, 2, &settings.equalizer, "Equalizer", NULL, NULL}, {TYPE_INT, 0, 2, &settings.dithering, "Dithering", NULL, NULL}, +#ifdef HAVE_PITCHSCREEN + {TYPE_INT, 0, 2, &settings.pitch, "Pitch", NULL, NULL}, +#endif + {TYPE_INT, 0, 2, &settings.play_mode, "Play mode", NULL, NULL}, #ifdef HAVE_BACKLIGHT_BRIGHTNESS {TYPE_INT, -1, INT_MAX, &settings.backlight_brightness, "Backlight brightness", NULL, NULL}, @@ -204,6 +208,11 @@ { "Yes", -1 }, }; +static const struct opt_items dirfile[2] = { + { "File", -1 }, + { "Directory", -1 }, +}; + static const struct opt_items enabledisable[2] = { { "Disable", -1 }, { "Enable", -1 }, @@ -375,6 +384,16 @@ rb->dsp_dither_enable((global || settings.dithering) ? rb->global_settings->dithering_enabled : false); break; + +#ifdef HAVE_PITCHSCREEN + case MPEG_AUDIO_PITCH: + val0 = (global || settings.pitch) ? + rb->global_settings->pitch : + SOUND_PITCH; + rb->sound_set(SOUND_PITCH, val0); + break; +#endif + } } @@ -388,6 +407,9 @@ MPEG_AUDIO_CROSSFEED, MPEG_AUDIO_EQUALIZER, MPEG_AUDIO_DITHERING, +#ifdef HAVE_PITCHSCREEN + MPEG_AUDIO_PITCH, +#endif }; unsigned i; @@ -1004,6 +1026,10 @@ { "Equalizer", NULL }, [MPEG_AUDIO_DITHERING] = { "Dithering", NULL }, +#ifdef HAVE_PITCHSCREEN + [MPEG_AUDIO_PITCH] = + { "Pitch", NULL }, +#endif }; menu_id = menu_init(rb, items, ARRAYLEN(items), @@ -1048,6 +1074,14 @@ sync_audio_setting(result, false); break; +#ifdef HAVE_PITCHSCREEN + case MPEG_AUDIO_PITCH: + mpeg_set_option("Pitch", &settings.pitch, INT, + globaloff, 2, NULL); + sync_audio_setting(result, false); + break; +#endif + default: menu_quit = true; break; @@ -1105,6 +1139,8 @@ { "Resume Options", NULL }, [MPEG_MENU_CLEAR_RESUMES] = { clear_str, NULL }, + [MPEG_MENU_PLAY_MODE] = + { "Play mode", NULL }, [MPEG_MENU_QUIT] = { "Quit mpegplayer", NULL }, }; @@ -1147,6 +1183,11 @@ clear_resume_count(); break; + case MPEG_MENU_PLAY_MODE: + mpeg_set_option("Play mode", + &settings.play_mode, INT, dirfile, 2, NULL); + break; + case MPEG_MENU_QUIT: default: menu_quit = true; @@ -1174,6 +1215,7 @@ settings.showfps = 0; /* Do not show FPS */ settings.limitfps = 1; /* Limit FPS */ settings.skipframes = 1; /* Skip frames */ + settings.play_mode = 0; /* Play single video */ settings.resume_options = MPEG_RESUME_MENU_ALWAYS; /* Enable start menu */ settings.resume_count = -1; #ifdef HAVE_BACKLIGHT_BRIGHTNESS @@ -1187,6 +1229,9 @@ settings.crossfeed = false; settings.equalizer = false; settings.dithering = false; +#ifdef HAVE_PITCHSCREEN + settings.pitch = false; +#endif configfile_init(rb); @@ -1237,6 +1282,8 @@ settings.limitfps); configfile_update_entry(SETTINGS_FILENAME, "Skip frames", settings.skipframes); + configfile_update_entry(SETTINGS_FILENAME, "Play mode", + settings.play_mode); configfile_update_entry(SETTINGS_FILENAME, "Resume options", settings.resume_options); @@ -1267,6 +1314,10 @@ settings.equalizer); configfile_update_entry(SETTINGS_FILENAME, "Dithering", settings.dithering); +#ifdef HAVE_PITCHSCREEN + configfile_update_entry(SETTINGS_FILENAME, "Pitch", + settings.pitch); +#endif /* Restore audio options */ sync_audio_settings(true); diff -Naur rockbox-19442/apps/plugins/mpegplayer/mpeg_settings.h _000/apps/plugins/mpegplayer/mpeg_settings.h --- rockbox-19442/apps/plugins/mpegplayer/mpeg_settings.h 2008-12-15 10:20:02.000000000 +0900 +++ _000/apps/plugins/mpegplayer/mpeg_settings.h 2008-12-13 22:19:56.000000000 +0900 @@ -34,6 +34,9 @@ MPEG_AUDIO_CROSSFEED, MPEG_AUDIO_EQUALIZER, MPEG_AUDIO_DITHERING, +#ifdef HAVE_PITCHSCREEN + MPEG_AUDIO_PITCH, +#endif }; enum mpeg_resume_id @@ -61,6 +64,7 @@ MPEG_MENU_AUDIO_SETTINGS, MPEG_MENU_ENABLE_START_MENU, MPEG_MENU_CLEAR_RESUMES, + MPEG_MENU_PLAY_MODE, MPEG_MENU_QUIT, }; @@ -71,6 +75,7 @@ int resume_options; /* type of resume action at start */ int resume_count; /* total # of resumes in config file */ int resume_time; /* resume time for current mpeg (in half minutes) */ + int play_mode; /* play single file or all files in directory */ char resume_filename[MAX_PATH]; /* filename of current mpeg */ #if MPEG_OPTION_DITHERING_ENABLED int displayoptions; @@ -81,6 +86,10 @@ int crossfeed; int equalizer; int dithering; +#ifdef HAVE_PITCHSCREEN + int pitch; +#endif + /* Backlight options */ #ifdef HAVE_BACKLIGHT_BRIGHTNESS int backlight_brightness; diff -Naur rockbox-19442/apps/settings.c _000/apps/settings.c --- rockbox-19442/apps/settings.c 2008-12-15 15:58:30.000000000 +0900 +++ _000/apps/settings.c 2008-12-16 03:21:54.000000000 +0900 @@ -720,6 +720,9 @@ sound_set(SOUND_MDB_ENABLE, global_settings.mdb_enable); sound_set(SOUND_SUPERBASS, global_settings.superbass); #endif +#ifdef HAVE_PITCHSCREEN + sound_set(SOUND_PITCH, global_settings.pitch); +#endif #ifdef HAVE_WM8758 sound_set(SOUND_BASS_CUTOFF, global_settings.bass_cutoff); diff -Naur rockbox-19442/apps/settings.h _000/apps/settings.h --- rockbox-19442/apps/settings.h 2008-12-15 21:27:40.390625000 +0900 +++ _000/apps/settings.h 2008-12-16 03:28:31.996217600 +0900 @@ -187,6 +187,14 @@ /* Not really a setting but several files should stay synced */ #define KEYCLICK_DURATION 2 +#ifdef HAVE_PITCHSCREEN +enum +{ + PITCH_MODE_ABSOLUTE = 0, + PITCH_MODE_SEMITONE +}; +#endif /* HAVE_PITCHSCREEN */ + /** virtual pointer stuff.. move to another .h maybe? **/ /* These define "virtual pointers", which could either be a literal string, or a mean a string ID if the pointer is in a certain range. @@ -318,6 +326,13 @@ int treble; /* treble boost/cut in decibels */ int channel_config; /* Stereo, Mono, Custom, Mono left, Mono right, Karaoke */ int stereo_width; /* 0-255% */ +#ifdef HAVE_PITCHSCREEN + int pitch; /* pitch in permille of the normal sound (2000=octave higher) */ + int pitch_change_mode; /* How pitch is changed in the pitch screen. */ + /* 0=small steps, 1=semitone. This is not a sound setting, */ + /* but it's better to keep these settings together since they */ + /* are guarded by the same #ifdef */ +#endif #if CONFIG_CODEC != SWCODEC int loudness; /* loudness eq: 0-100 0=off 100=max */ diff -Naur rockbox-19442/apps/settings_list.c _000/apps/settings_list.c --- rockbox-19442/apps/settings_list.c 2008-12-15 21:26:56.000000000 +0900 +++ _000/apps/settings_list.c 2008-12-16 03:30:13.111614400 +0900 @@ -466,6 +466,12 @@ SOUND_SETTING(0, balance, LANG_BALANCE, "balance", SOUND_BALANCE), SOUND_SETTING(F_NO_WRAP,bass, LANG_BASS, "bass", SOUND_BASS), SOUND_SETTING(F_NO_WRAP,treble, LANG_TREBLE, "treble", SOUND_TREBLE), +#ifdef HAVE_PITCHSCREEN + SOUND_SETTING(F_NO_WRAP, pitch, LANG_PPITCH, "pitch", SOUND_PITCH), + CHOICE_SETTING(0, pitch_change_mode, LANG_PITCH_CHANGE_MODE, 0, + "pitch change mode", "small steps,semitones", NULL, 2, + ID2P(LANG_PITCH_CHANGE_SMALL_STEPS), ID2P(LANG_PITCH_CHANGE_SEMITONES)), +#endif #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) SOUND_SETTING(0,loudness, LANG_LOUDNESS, "loudness", SOUND_LOUDNESS), diff -Naur rockbox-19442/firmware/drivers/audio/wm8978.c _000/firmware/drivers/audio/wm8978.c --- rockbox-19442/firmware/drivers/audio/wm8978.c 2008-12-15 10:20:06.000000000 +0900 +++ _000/firmware/drivers/audio/wm8978.c 2008-12-16 03:31:19.056438400 +0900 @@ -61,6 +61,9 @@ [SOUND_BASS_CUTOFF] = {"", 0, 1, 1, 4, 1}, [SOUND_TREBLE_CUTOFF] = {"", 0, 1, 1, 4, 1}, #endif +#ifdef HAVE_PITCHSCREEN + [SOUND_PITCH] = {"%", 1, 1, 500,2000,1000}, +#endif }; static uint16_t wmc_regs[WMC_NUM_REGISTERS] = diff -Naur rockbox-19442/firmware/drivers/audio/wm8985.c _000/firmware/drivers/audio/wm8985.c --- rockbox-19442/firmware/drivers/audio/wm8985.c 2008-12-15 10:20:06.000000000 +0900 +++ _000/firmware/drivers/audio/wm8985.c 2008-12-16 03:31:04.114953600 +0900 @@ -101,6 +101,9 @@ #endif [SOUND_BASS_CUTOFF] = {"", 0, 1, 1, 4, 1}, [SOUND_TREBLE_CUTOFF] = {"", 0, 1, 1, 4, 1}, +#ifdef HAVE_PITCHSCREEN + [SOUND_PITCH] = {"%", 1, 1, 500,2000,1000}, +#endif }; /* shadow registers */ diff -Naur rockbox-19442/firmware/export/audiohw.h _000/firmware/export/audiohw.h --- rockbox-19442/firmware/export/audiohw.h 2008-12-15 10:20:06.000000000 +0900 +++ _000/firmware/export/audiohw.h 2008-12-16 03:21:54.000000000 +0900 @@ -118,6 +118,9 @@ #if defined(AUDIOHW_HAVE_TREBLE_CUTOFF) SOUND_TREBLE_CUTOFF, #endif +#ifdef HAVE_PITCHSCREEN + SOUND_PITCH, +#endif }; enum Channel { diff -Naur rockbox-19442/firmware/export/mp3_playback.h _000/firmware/export/mp3_playback.h --- rockbox-19442/firmware/export/mp3_playback.h 2008-12-15 10:20:08.000000000 +0900 +++ _000/firmware/export/mp3_playback.h 2008-12-16 03:21:54.000000000 +0900 @@ -31,7 +31,7 @@ int avc, int channel_config, int stereo_width, int mdb_strength, int mdb_harmonics, int mdb_center, int mdb_shape, bool mdb_enable, - bool superbass); + bool superbass, int pitch); /* exported just for mpeg.c, to keep the recording there */ #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) diff -Naur rockbox-19442/firmware/export/sound.h _000/firmware/export/sound.h --- rockbox-19442/firmware/export/sound.h 2008-12-15 10:20:08.000000000 +0900 +++ _000/firmware/export/sound.h 2008-12-16 03:21:53.683472000 +0900 @@ -59,7 +59,7 @@ void sound_set(int setting, int value); int sound_val2phys(int setting, int value); -#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) +#ifdef HAVE_PITCHSCREEN void sound_set_pitch(int permille); int sound_get_pitch(void); #endif diff -Naur rockbox-19442/firmware/mp3_playback.c _000/firmware/mp3_playback.c --- rockbox-19442/firmware/mp3_playback.c 2008-12-15 10:20:09.000000000 +0900 +++ _000/firmware/mp3_playback.c 2008-12-16 03:21:54.000000000 +0900 @@ -336,7 +336,7 @@ int avc, int channel_config, int stereo_width, int mdb_strength, int mdb_harmonics, int mdb_center, int mdb_shape, bool mdb_enable, - bool superbass) + bool superbass, int pitch) { #ifdef SIMULATOR (void)volume; @@ -353,6 +353,7 @@ (void)mdb_shape; (void)mdb_enable; (void)superbass; + (void)pitch; #else #if CONFIG_CODEC == MAS3507D unsigned long val; @@ -470,6 +471,13 @@ sound_set(SOUND_MDB_ENABLE, mdb_enable); sound_set(SOUND_SUPERBASS, superbass); #endif + +#if HAVE_PITCHSCREEN + sound_set(SOUND_PITCH, pitch); +#else + (void)pitch; +#endif + #endif /* !SIMULATOR */ playing = false; diff -Naur rockbox-19442/firmware/sound.c _000/firmware/sound.c --- rockbox-19442/firmware/sound.c 2008-12-15 18:03:00.734375000 +0900 +++ _000/firmware/sound.c 2008-12-16 03:21:54.000000000 +0900 @@ -89,8 +89,11 @@ [SOUND_MDB_ENABLE] = {"", 0, 1, 0, 1, 0}, [SOUND_SUPERBASS] = {"", 0, 1, 0, 1, 0}, #endif -}; +#ifdef HAVE_PITCHSCREEN + [SOUND_PITCH] = {"%", 1, 1, 500,2000,1000}, #endif +}; +#endif /* #ifdef SIMULATOR */ const char *sound_unit(int setting) { @@ -196,6 +199,11 @@ result = sound_set_superbass; break; #endif +#ifdef HAVE_PITCHSCREEN + case SOUND_PITCH: + result = sound_set_pitch; + break; +#endif } return result;