forked from len0rd/rockbox
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
This commit is contained in:
parent
bfba2d2028
commit
3bf321ff1c
3 changed files with 32 additions and 7 deletions
|
|
@ -322,6 +322,10 @@ bool recording_screen(void)
|
||||||
/* Only act if the mpeg is stopped */
|
/* Only act if the mpeg is stopped */
|
||||||
if(!(mpeg_status() & MPEG_STATUS_RECORD))
|
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;
|
have_recorded = true;
|
||||||
talk_buffer_steal(); /* we use the mp3 buffer */
|
talk_buffer_steal(); /* we use the mp3 buffer */
|
||||||
mpeg_record(rec_create_filename(path_buffer));
|
mpeg_record(rec_create_filename(path_buffer));
|
||||||
|
|
@ -332,6 +336,10 @@ bool recording_screen(void)
|
||||||
{
|
{
|
||||||
if(mpeg_status() & MPEG_STATUS_PAUSE)
|
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();
|
mpeg_resume_recording();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ unsigned int mpeg_error(void);
|
||||||
void mpeg_error_clear(void);
|
void mpeg_error_clear(void);
|
||||||
int mpeg_get_file_pos(void);
|
int mpeg_get_file_pos(void);
|
||||||
unsigned long mpeg_get_last_header(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 */
|
/* in order to keep the recording here, I have to expose this */
|
||||||
void rec_tick(void);
|
void rec_tick(void);
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ static void stop_recording(void);
|
||||||
static int get_unsaved_space(void);
|
static int get_unsaved_space(void);
|
||||||
static void pause_recording(void);
|
static void pause_recording(void);
|
||||||
static void resume_recording(void);
|
static void resume_recording(void);
|
||||||
|
static int shadow_codec_reg0;
|
||||||
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
#endif /* #if CONFIG_HWCODEC == MAS3587F */
|
||||||
|
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
|
|
@ -2090,7 +2091,8 @@ static void init_recording(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable A/D Converters */
|
/* 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) */
|
/* Copy left channel to right (mono mode) */
|
||||||
mas_codec_writereg(8, 0x8000);
|
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)
|
void mpeg_set_recording_gain(int left, int right, bool use_mic)
|
||||||
{
|
{
|
||||||
/* Enable both left and right A/D */
|
/* Enable both left and right A/D */
|
||||||
mas_codec_writereg(0x0,
|
shadow_codec_reg0 = (left << 12) |
|
||||||
(left << 12) |
|
(right << 8) |
|
||||||
(right << 8) |
|
(left << 4) |
|
||||||
(left << 4) |
|
(use_mic?0x0008:0) | /* Connect left A/D to mic */
|
||||||
(use_mic?0x0008:0) | /* Connect left A/D to mic */
|
0x0007;
|
||||||
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)
|
void mpeg_new_file(const char *filename)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue