summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2004-12-21 23:49:43 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2004-12-21 23:49:43 +0000
commit3bf321ff1c515da30357f830c435f3cb1c8d899e (patch)
tree8b08236188bc09dc952fa184832ad049fbd3bd1b /firmware
parentbfba2d20280dde9981c6f4d25b79734db13f1998 (diff)
downloadrockbox-3bf321ff1c515da30357f830c435f3cb1c8d899e.tar.gz
rockbox-3bf321ff1c515da30357f830c435f3cb1c8d899e.zip
aid for blind recorders: longer beep when starting a recording, short beep when resuming it (you may disable the voice UI to get rid of it)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5502 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/mpeg.h1
-rw-r--r--firmware/mpeg.c30
2 files changed, 24 insertions, 7 deletions
diff --git a/firmware/export/mpeg.h b/firmware/export/mpeg.h
index f24664edc9..d61789c26e 100644
--- a/firmware/export/mpeg.h
+++ b/firmware/export/mpeg.h
@@ -99,6 +99,7 @@ unsigned int mpeg_error(void);
99void mpeg_error_clear(void); 99void mpeg_error_clear(void);
100int mpeg_get_file_pos(void); 100int mpeg_get_file_pos(void);
101unsigned long mpeg_get_last_header(void); 101unsigned long mpeg_get_last_header(void);
102void mpeg_beep(int freq, int duration);
102 103
103/* in order to keep the recording here, I have to expose this */ 104/* in order to keep the recording here, I have to expose this */
104void rec_tick(void); 105void rec_tick(void);
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index 5a199a4169..26bfbc0dc3 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -53,6 +53,7 @@ static void stop_recording(void);
53static int get_unsaved_space(void); 53static int get_unsaved_space(void);
54static void pause_recording(void); 54static void pause_recording(void);
55static void resume_recording(void); 55static void resume_recording(void);
56static int shadow_codec_reg0;
56#endif /* #if CONFIG_HWCODEC == MAS3587F */ 57#endif /* #if CONFIG_HWCODEC == MAS3587F */
57 58
58#ifndef SIMULATOR 59#ifndef SIMULATOR
@@ -2090,7 +2091,8 @@ static void init_recording(void)
2090 } 2091 }
2091 2092
2092 /* Enable A/D Converters */ 2093 /* Enable A/D Converters */
2093 mas_codec_writereg(0x0, 0xcccd); 2094 shadow_codec_reg0 = 0xcccd;
2095 mas_codec_writereg(0x0, shadow_codec_reg0);
2094 2096
2095 /* Copy left channel to right (mono mode) */ 2097 /* Copy left channel to right (mono mode) */
2096 mas_codec_writereg(8, 0x8000); 2098 mas_codec_writereg(8, 0x8000);
@@ -2366,12 +2368,26 @@ void mpeg_set_recording_options(int frequency, int quality,
2366void mpeg_set_recording_gain(int left, int right, bool use_mic) 2368void mpeg_set_recording_gain(int left, int right, bool use_mic)
2367{ 2369{
2368 /* Enable both left and right A/D */ 2370 /* Enable both left and right A/D */
2369 mas_codec_writereg(0x0, 2371 shadow_codec_reg0 = (left << 12) |
2370 (left << 12) | 2372 (right << 8) |
2371 (right << 8) | 2373 (left << 4) |
2372 (left << 4) | 2374 (use_mic?0x0008:0) | /* Connect left A/D to mic */
2373 (use_mic?0x0008:0) | /* Connect left A/D to mic */ 2375 0x0007;
2374 0x0007); 2376 mas_codec_writereg(0x0, shadow_codec_reg0);
2377}
2378
2379/* try to make some kind of beep, also in recording mode */
2380void mpeg_beep(int freq, int duration)
2381{
2382 (void)freq; /* not used yet */
2383 long starttick = current_tick;
2384 do
2385 {
2386 mas_codec_writereg(0, 0); /* some little-understood sequence, */
2387 mas_codec_writereg(0, 1); /* there may be better ways */
2388 }
2389 while (current_tick - starttick < duration);
2390 mas_codec_writereg(0, shadow_codec_reg0); /* restore it */
2375} 2391}
2376 2392
2377void mpeg_new_file(const char *filename) 2393void mpeg_new_file(const char *filename)