summaryrefslogtreecommitdiff
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)
322 /* Only act if the mpeg is stopped */ 322 /* Only act if the mpeg is stopped */
323 if(!(mpeg_status() & MPEG_STATUS_RECORD)) 323 if(!(mpeg_status() & MPEG_STATUS_RECORD))
324 { 324 {
325 if (global_settings.talk_menu)
326 { /* no voice possible here, but a beep */
327 mpeg_beep(0,HZ/4); /* longer beep on start */
328 }
325 have_recorded = true; 329 have_recorded = true;
326 talk_buffer_steal(); /* we use the mp3 buffer */ 330 talk_buffer_steal(); /* we use the mp3 buffer */
327 mpeg_record(rec_create_filename(path_buffer)); 331 mpeg_record(rec_create_filename(path_buffer));
@@ -332,6 +336,10 @@ bool recording_screen(void)
332 { 336 {
333 if(mpeg_status() & MPEG_STATUS_PAUSE) 337 if(mpeg_status() & MPEG_STATUS_PAUSE)
334 { 338 {
339 if (global_settings.talk_menu)
340 { /* no voice possible here, but a beep */
341 mpeg_beep(0,HZ/8); /* short beep on resume */
342 }
335 mpeg_resume_recording(); 343 mpeg_resume_recording();
336 } 344 }
337 else 345 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);
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)