summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2005-08-20 21:17:41 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2005-08-20 21:17:41 +0000
commit9d7fd1804e32b29b76a2aae02bbebd8b5464c23c (patch)
tree4e0a9363c5bc5763fcc770d293c92f67530e9f92
parent5d0fe30feb022030c2f43f44b0ccca35ddef3446 (diff)
Now beep can be disabled.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7365 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/lib/xxx2wav.c5
-rw-r--r--apps/lang/english.lang24
-rw-r--r--apps/playback.c6
-rw-r--r--apps/settings.c1
-rw-r--r--apps/settings.h1
-rw-r--r--apps/settings_menu.c16
6 files changed, 51 insertions, 2 deletions
diff --git a/apps/codecs/lib/xxx2wav.c b/apps/codecs/lib/xxx2wav.c
index 8c6ceed69e..9de0a7ae19 100644
--- a/apps/codecs/lib/xxx2wav.c
+++ b/apps/codecs/lib/xxx2wav.c
@@ -37,6 +37,9 @@ void* codec_malloc(size_t size)
{
void* x;
+ if (mem_ptr + size > bufsize)
+ return NULL;
+
x=&mallocbuf[mem_ptr];
mem_ptr+=(size+3)&~3; /* Keep memory 32-bit aligned */
@@ -47,6 +50,8 @@ void* codec_calloc(size_t nmemb, size_t size)
{
void* x;
x = codec_malloc(nmemb*size);
+ if (x == NULL)
+ return NULL;
local_rb->memset(x,0,nmemb*size);
return(x);
}
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index dc1137c04c..eb1c887fae 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -3262,3 +3262,27 @@ desc: in browse_id3
eng: " (VBR)"
voice ""
new:
+
+id: LANG_BEEP
+desc: in playback settings
+eng: "Beep volume"
+voice "Beep volume"
+new:
+
+id: LANG_WEAK
+desc: in beep volume in playback settings
+eng: "Weak"
+voice "Weak"
+new:
+
+id: LANG_MODERATE
+desc: in beep volume in playback settings
+eng: "Moderate"
+voice "Moderate"
+new:
+
+id: LANG_STRONG
+desc: in beep volume in playback settings
+eng: "Strong"
+voice "Strong"
+new:
diff --git a/apps/playback.c b/apps/playback.c
index e340938c0c..e601233636 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -1654,13 +1654,15 @@ void audio_thread(void)
case AUDIO_NEXT:
logf("audio_next");
- pcmbuf_beep(5000, 100, 5000);
+ if (global_settings.beep)
+ pcmbuf_beep(5000, 100, 2500*global_settings.beep);
initiate_track_change(1);
break ;
case AUDIO_PREV:
logf("audio_prev");
- pcmbuf_beep(5000, 100, 5000);
+ if (global_settings.beep)
+ pcmbuf_beep(5000, 100, 2500*global_settings.beep);
initiate_track_change(-1);
break;
diff --git a/apps/settings.c b/apps/settings.c
index 05138aaa98..9bcdc558a2 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -432,6 +432,7 @@ static const struct bit_entry hd_bits[] =
{1, S_O(replaygain_track), false, "replaygain type", "track,album" },
{1, S_O(replaygain_noclip), false, "replaygain noclip", off_on },
{8 | SIGNED, S_O(replaygain_preamp), 0, "replaygain preamp", NULL },
+ {2, S_O(beep), 0, "off,weak,moderate,strong", NULL },
#endif
/* If values are just added to the end, no need to bump the version. */
diff --git a/apps/settings.h b/apps/settings.h
index 7eaabec02e..767fa49463 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -335,6 +335,7 @@ struct user_settings
bool replaygain_track; /* true for track gain, false for album gain */
bool replaygain_noclip; /* scale to prevent clips */
int replaygain_preamp; /* scale replaygained tracks by this */
+ int beep; /* system beep volume when changing tracks etc. */
#endif
};
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 57b4cc897e..780c2940b4 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -1269,6 +1269,21 @@ static bool replaygain_settings_menu(void)
menu_exit(m);
return result;
}
+
+static bool beep(void)
+{
+ static const struct opt_items names[] = {
+ { STR(LANG_OFF) },
+ { STR(LANG_WEAK) },
+ { STR(LANG_MODERATE) },
+ { STR(LANG_STRONG) },
+ };
+ bool ret;
+ ret=set_option( str(LANG_BEEP),
+ &global_settings.beep, INT, names, 4, NULL);
+
+ return ret;
+}
#endif
static bool playback_settings_menu(void)
@@ -1288,6 +1303,7 @@ static bool playback_settings_menu(void)
{ ID2P(LANG_CROSSFADE), crossfade },
{ ID2P(LANG_CROSSFADE_DURATION), crossfade_duration },
{ ID2P(LANG_REPLAYGAIN), replaygain_settings_menu },
+ { ID2P(LANG_BEEP), beep },
#endif
#ifdef HAVE_SPDIF_POWER
{ ID2P(LANG_SPDIF_ENABLE), spdif },