summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/recorder/recording.c8
-rw-r--r--firmware/export/mpeg.h1
-rw-r--r--firmware/mpeg.c30
3 files changed, 32 insertions, 7 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index d67124a6cf..71cd20d797 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -322,6 +322,10 @@ bool recording_screen(void)
/* Only act if the mpeg is stopped */
if(!(mpeg_status() & MPEG_STATUS_RECORD))
{
+ if (global_settings.talk_menu)
+ { /* no voice possible here, but a beep */
+ mpeg_beep(0,HZ/4); /* longer beep on start */
+ }
have_recorded = true;
talk_buffer_steal(); /* we use the mp3 buffer */
mpeg_record(rec_create_filename(path_buffer));
@@ -332,6 +336,10 @@ bool recording_screen(void)
{
if(mpeg_status() & MPEG_STATUS_PAUSE)
{
+ if (global_settings.talk_menu)
+ { /* no voice possible here, but a beep */
+ mpeg_beep(0,HZ/8); /* short beep on resume */
+ }
mpeg_resume_recording();
}
else
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);
void mpeg_error_clear(void);
int mpeg_get_file_pos(void);
unsigned long mpeg_get_last_header(void);
+void mpeg_beep(int freq, int duration);
/* in order to keep the recording here, I have to expose this */
void 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);
static int get_unsaved_space(void);
static void pause_recording(void);
static void resume_recording(void);
+static int shadow_codec_reg0;
#endif /* #if CONFIG_HWCODEC == MAS3587F */
#ifndef SIMULATOR
@@ -2090,7 +2091,8 @@ static void init_recording(void)
}
/* Enable A/D Converters */
- mas_codec_writereg(0x0, 0xcccd);
+ shadow_codec_reg0 = 0xcccd;
+ mas_codec_writereg(0x0, shadow_codec_reg0);
/* Copy left channel to right (mono mode) */
mas_codec_writereg(8, 0x8000);
@@ -2366,12 +2368,26 @@ void mpeg_set_recording_options(int frequency, int quality,
void mpeg_set_recording_gain(int left, int right, bool use_mic)
{
/* Enable both left and right A/D */
- mas_codec_writereg(0x0,
- (left << 12) |
- (right << 8) |
- (left << 4) |
- (use_mic?0x0008:0) | /* Connect left A/D to mic */
- 0x0007);
+ shadow_codec_reg0 = (left << 12) |
+ (right << 8) |
+ (left << 4) |
+ (use_mic?0x0008:0) | /* Connect left A/D to mic */
+ 0x0007;
+ mas_codec_writereg(0x0, shadow_codec_reg0);
+}
+
+/* try to make some kind of beep, also in recording mode */
+void mpeg_beep(int freq, int duration)
+{
+ (void)freq; /* not used yet */
+ long starttick = current_tick;
+ do
+ {
+ mas_codec_writereg(0, 0); /* some little-understood sequence, */
+ mas_codec_writereg(0, 1); /* there may be better ways */
+ }
+ while (current_tick - starttick < duration);
+ mas_codec_writereg(0, shadow_codec_reg0); /* restore it */
}
void mpeg_new_file(const char *filename)