forked from len0rd/rockbox
iRiver: Initial support for wav-recording in recording menu. Supports mic/line-in (and radio), monitor mode, time-splitting (and byte-splitting), pause/resume etc. Things todo: Prerecording, peakmeter (should be simple), frequency other than 44.1 kHz, etc..
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7818 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
663fba1399
commit
e6e5496535
19 changed files with 778 additions and 386 deletions
|
@ -65,7 +65,4 @@ playback.c
|
||||||
metadata.c
|
metadata.c
|
||||||
codecs.c
|
codecs.c
|
||||||
dsp.c
|
dsp.c
|
||||||
#ifndef SIMULATOR
|
|
||||||
pcm_recording.c
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -58,9 +58,6 @@
|
||||||
#include "ata_mmc.h"
|
#include "ata_mmc.h"
|
||||||
#endif
|
#endif
|
||||||
#include "logfdisp.h"
|
#include "logfdisp.h"
|
||||||
#if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR)
|
|
||||||
extern bool pcm_rec_screen(void);
|
|
||||||
#endif
|
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
#include "pcmbuf.h"
|
#include "pcmbuf.h"
|
||||||
#include "pcm_playback.h"
|
#include "pcm_playback.h"
|
||||||
|
@ -1781,7 +1778,6 @@ bool debug_menu(void)
|
||||||
{ "CPU frequency", dbg_cpufreq },
|
{ "CPU frequency", dbg_cpufreq },
|
||||||
#endif
|
#endif
|
||||||
#if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR)
|
#if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR)
|
||||||
{ "PCM recording", pcm_rec_screen },
|
|
||||||
{ "S/PDIF analyzer", dbg_spdif },
|
{ "S/PDIF analyzer", dbg_spdif },
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
|
#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE)
|
||||||
|
|
|
@ -939,13 +939,13 @@ new:
|
||||||
|
|
||||||
id: LANG_RECORDING_LEFT
|
id: LANG_RECORDING_LEFT
|
||||||
desc: in the recording screen
|
desc: in the recording screen
|
||||||
eng: "Left"
|
eng: "Gain Left"
|
||||||
voice: ""
|
voice: ""
|
||||||
new:
|
new:
|
||||||
|
|
||||||
id: LANG_RECORDING_RIGHT
|
id: LANG_RECORDING_RIGHT
|
||||||
desc: in the recording screen
|
desc: in the recording screen
|
||||||
eng: "Right"
|
eng: "Gain Right"
|
||||||
voice: ""
|
voice: ""
|
||||||
new:
|
new:
|
||||||
|
|
||||||
|
@ -3352,3 +3352,21 @@ desc: in crossfade settings menu
|
||||||
eng: "Fade out mode"
|
eng: "Fade out mode"
|
||||||
voice: "Fade out mode"
|
voice: "Fade out mode"
|
||||||
new:
|
new:
|
||||||
|
|
||||||
|
id: LANG_RECORDING_ADC_RIGHT
|
||||||
|
desc: in the recording settings
|
||||||
|
eng: "ADC Gain Right"
|
||||||
|
voice: "ADC Gain Right"
|
||||||
|
new:
|
||||||
|
|
||||||
|
id: LANG_RECORDING_ADC_LEFT
|
||||||
|
desc: in the recording settings
|
||||||
|
eng: "ADC Gain Left"
|
||||||
|
voice: "ADC Gain Left"
|
||||||
|
new:
|
||||||
|
|
||||||
|
id: LANG_RECORDING_MONITOR
|
||||||
|
desc: in the recording settings
|
||||||
|
eng: "Monitor Mode"
|
||||||
|
voice: "Monitor Mode"
|
||||||
|
new:
|
||||||
|
|
|
@ -323,7 +323,7 @@ void init(void)
|
||||||
sound_settings_apply();
|
sound_settings_apply();
|
||||||
#endif
|
#endif
|
||||||
#if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR)
|
#if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR)
|
||||||
pcm_init_recording();
|
pcm_rec_init();
|
||||||
#endif
|
#endif
|
||||||
talk_init();
|
talk_init();
|
||||||
/* runtime database has to be initialized after audio_init() */
|
/* runtime database has to be initialized after audio_init() */
|
||||||
|
|
|
@ -226,7 +226,7 @@ bool radio_screen(void)
|
||||||
audio_stop();
|
audio_stop();
|
||||||
|
|
||||||
#if CONFIG_CODEC != SWCODEC
|
#if CONFIG_CODEC != SWCODEC
|
||||||
mpeg_init_recording();
|
audio_init_recording();
|
||||||
|
|
||||||
sound_settings_apply();
|
sound_settings_apply();
|
||||||
|
|
||||||
|
@ -238,23 +238,24 @@ bool radio_screen(void)
|
||||||
if (global_settings.rec_prerecord_time)
|
if (global_settings.rec_prerecord_time)
|
||||||
talk_buffer_steal(); /* will use the mp3 buffer */
|
talk_buffer_steal(); /* will use the mp3 buffer */
|
||||||
|
|
||||||
mpeg_set_recording_options(global_settings.rec_frequency,
|
audio_set_recording_options(global_settings.rec_frequency,
|
||||||
global_settings.rec_quality,
|
global_settings.rec_quality,
|
||||||
1, /* Line In */
|
1, /* Line In */
|
||||||
global_settings.rec_channels,
|
global_settings.rec_channels,
|
||||||
global_settings.rec_editable,
|
global_settings.rec_editable,
|
||||||
global_settings.rec_prerecord_time);
|
global_settings.rec_prerecord_time,
|
||||||
|
global_settings.rec_monitor);
|
||||||
|
|
||||||
|
|
||||||
mpeg_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
|
audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
|
||||||
sound_default(SOUND_RIGHT_GAIN), false);
|
sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN);
|
||||||
#else
|
#else
|
||||||
uda1380_enable_recording(false);
|
uda1380_enable_recording(false);
|
||||||
uda1380_set_recvol(0, 0, 10);
|
uda1380_set_recvol(10, 10, AUDIO_GAIN_LINEIN);
|
||||||
uda1380_set_monitor(true);
|
uda1380_set_monitor(true);
|
||||||
|
|
||||||
/* Set the input multiplexer to FM */
|
/* Set the input multiplexer to FM */
|
||||||
pcmrec_set_mux(1);
|
pcm_rec_mux(1);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -345,14 +346,14 @@ bool radio_screen(void)
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
if(audio_status() == AUDIO_STATUS_RECORD)
|
if(audio_status() == AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
mpeg_new_file(rec_create_filename(buf));
|
audio_new_file(rec_create_filename(buf));
|
||||||
update_screen = true;
|
update_screen = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
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(buf));
|
audio_record(rec_create_filename(buf));
|
||||||
update_screen = true;
|
update_screen = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -517,7 +518,7 @@ bool radio_screen(void)
|
||||||
|
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
#if CONFIG_CODEC != SWCODEC
|
#if CONFIG_CODEC != SWCODEC
|
||||||
seconds = mpeg_recorded_time() / HZ;
|
seconds = audio_recorded_time() / HZ;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if(update_screen || seconds > last_seconds)
|
if(update_screen || seconds > last_seconds)
|
||||||
|
@ -609,8 +610,8 @@ bool radio_screen(void)
|
||||||
{
|
{
|
||||||
#if CONFIG_CODEC != SWCODEC
|
#if CONFIG_CODEC != SWCODEC
|
||||||
/* Enable the Left and right A/D Converter */
|
/* Enable the Left and right A/D Converter */
|
||||||
mpeg_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
|
audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
|
||||||
sound_default(SOUND_RIGHT_GAIN), false);
|
sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN);
|
||||||
mas_codec_writereg(6, 0x4000);
|
mas_codec_writereg(6, 0x4000);
|
||||||
#endif
|
#endif
|
||||||
radio_set_status(FMRADIO_POWERED); /* leave it powered */
|
radio_set_status(FMRADIO_POWERED); /* leave it powered */
|
||||||
|
@ -619,7 +620,7 @@ bool radio_screen(void)
|
||||||
{
|
{
|
||||||
radio_stop();
|
radio_stop();
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
pcmrec_set_mux(0); /* Line In */
|
pcm_rec_mux(0); /* Line In */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -913,12 +914,13 @@ static bool fm_recording_settings(void)
|
||||||
if (global_settings.rec_prerecord_time)
|
if (global_settings.rec_prerecord_time)
|
||||||
talk_buffer_steal(); /* will use the mp3 buffer */
|
talk_buffer_steal(); /* will use the mp3 buffer */
|
||||||
|
|
||||||
mpeg_set_recording_options(global_settings.rec_frequency,
|
audio_set_recording_options(global_settings.rec_frequency,
|
||||||
global_settings.rec_quality,
|
global_settings.rec_quality,
|
||||||
1, /* Line In */
|
1, /* Line In */
|
||||||
global_settings.rec_channels,
|
global_settings.rec_channels,
|
||||||
global_settings.rec_editable,
|
global_settings.rec_editable,
|
||||||
global_settings.rec_prerecord_time);
|
global_settings.rec_prerecord_time,
|
||||||
|
global_settings.rec_monitor);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,13 @@
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
#include "mpeg.h"
|
#include "mpeg.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
|
#if CONFIG_CODEC == SWCODEC
|
||||||
|
#include "pcm_record.h"
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_UDA1380
|
||||||
|
#include "uda1380.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "mp3_playback.h"
|
#include "mp3_playback.h"
|
||||||
#include "mas.h"
|
#include "mas.h"
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
|
@ -79,9 +86,12 @@
|
||||||
|
|
||||||
#elif CONFIG_KEYPAD == IRIVER_H100_PAD
|
#elif CONFIG_KEYPAD == IRIVER_H100_PAD
|
||||||
#define REC_STOPEXIT BUTTON_OFF
|
#define REC_STOPEXIT BUTTON_OFF
|
||||||
#define REC_RECPAUSE BUTTON_ON
|
#define REC_RECPAUSE BUTTON_REC
|
||||||
#define REC_INC BUTTON_RIGHT
|
#define REC_INC BUTTON_RIGHT
|
||||||
#define REC_DEC BUTTON_LEFT
|
#define REC_DEC BUTTON_LEFT
|
||||||
|
#define REC_NEXT BUTTON_DOWN
|
||||||
|
#define REC_PREV BUTTON_UP
|
||||||
|
#define REC_SETTINGS BUTTON_MODE
|
||||||
|
|
||||||
#elif CONFIG_KEYPAD == GMINI100_PAD
|
#elif CONFIG_KEYPAD == GMINI100_PAD
|
||||||
#define REC_STOPEXIT BUTTON_OFF
|
#define REC_STOPEXIT BUTTON_OFF
|
||||||
|
@ -102,6 +112,12 @@ bool f3_rec_screen(void);
|
||||||
#define MAX_SOURCE SOURCE_LINE
|
#define MAX_SOURCE SOURCE_LINE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_CODEC == SWCODEC
|
||||||
|
#define REC_FILE_ENDING ".wav"
|
||||||
|
#else
|
||||||
|
#define REC_FILE_ENDING ".mp3"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_FILE_SIZE 0x7FF00000 /* 2 GB - 1 MB */
|
#define MAX_FILE_SIZE 0x7FF00000 /* 2 GB - 1 MB */
|
||||||
|
|
||||||
const char* const freq_str[6] =
|
const char* const freq_str[6] =
|
||||||
|
@ -118,13 +134,18 @@ static void set_gain(void)
|
||||||
{
|
{
|
||||||
if(global_settings.rec_source == SOURCE_MIC)
|
if(global_settings.rec_source == SOURCE_MIC)
|
||||||
{
|
{
|
||||||
mpeg_set_recording_gain(global_settings.rec_mic_gain, 0, true);
|
audio_set_recording_gain(global_settings.rec_mic_gain, 0, AUDIO_GAIN_MIC);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mpeg_set_recording_gain(global_settings.rec_left_gain,
|
audio_set_recording_gain(global_settings.rec_left_gain,
|
||||||
global_settings.rec_right_gain, false);
|
global_settings.rec_right_gain, AUDIO_GAIN_LINEIN);
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_UDA1380
|
||||||
|
audio_set_recording_gain(global_settings.rec_adc_left_gain,
|
||||||
|
global_settings.rec_adc_right_gain,
|
||||||
|
AUDIO_GAIN_ADC);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* const fmtstr[] =
|
static const char* const fmtstr[] =
|
||||||
|
@ -176,9 +197,9 @@ char *rec_create_filename(char *buffer)
|
||||||
strncpy(buffer, rec_base_directory, MAX_PATH);
|
strncpy(buffer, rec_base_directory, MAX_PATH);
|
||||||
|
|
||||||
#ifdef HAVE_RTC
|
#ifdef HAVE_RTC
|
||||||
create_datetime_filename(buffer, buffer, "R", ".mp3");
|
create_datetime_filename(buffer, buffer, "R", REC_FILE_ENDING);
|
||||||
#else
|
#else
|
||||||
create_numbered_filename(buffer, buffer, "rec_", ".mp3", 4);
|
create_numbered_filename(buffer, buffer, "rec_", REC_FILE_ENDING, 4);
|
||||||
#endif
|
#endif
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +248,7 @@ static void trigger_listener(int trigger_status)
|
||||||
if((audio_status() & AUDIO_STATUS_RECORD) != AUDIO_STATUS_RECORD)
|
if((audio_status() & AUDIO_STATUS_RECORD) != AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
talk_buffer_steal(); /* we use the mp3 buffer */
|
talk_buffer_steal(); /* we use the mp3 buffer */
|
||||||
mpeg_record(rec_create_filename(path_buffer));
|
audio_record(rec_create_filename(path_buffer));
|
||||||
|
|
||||||
/* give control to mpeg thread so that it can start recording */
|
/* give control to mpeg thread so that it can start recording */
|
||||||
yield(); yield(); yield();
|
yield(); yield(); yield();
|
||||||
|
@ -236,7 +257,7 @@ static void trigger_listener(int trigger_status)
|
||||||
/* if we're already recording this is a retrigger */
|
/* if we're already recording this is a retrigger */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mpeg_new_file(rec_create_filename(path_buffer));
|
audio_new_file(rec_create_filename(path_buffer));
|
||||||
/* tell recording_screen to reset the time */
|
/* tell recording_screen to reset the time */
|
||||||
last_seconds = 0;
|
last_seconds = 0;
|
||||||
}
|
}
|
||||||
|
@ -273,6 +294,7 @@ bool recording_screen(void)
|
||||||
char path_buffer[MAX_PATH];
|
char path_buffer[MAX_PATH];
|
||||||
bool been_in_usb_mode = false;
|
bool been_in_usb_mode = false;
|
||||||
int last_audio_stat = -1;
|
int last_audio_stat = -1;
|
||||||
|
int audio_stat;
|
||||||
#if CONFIG_LED == LED_REAL
|
#if CONFIG_LED == LED_REAL
|
||||||
bool led_state = false;
|
bool led_state = false;
|
||||||
int led_countdown = 2;
|
int led_countdown = 2;
|
||||||
|
@ -289,7 +311,7 @@ bool recording_screen(void)
|
||||||
#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
|
#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
|
||||||
ata_set_led_enabled(false);
|
ata_set_led_enabled(false);
|
||||||
#endif
|
#endif
|
||||||
mpeg_init_recording();
|
audio_init_recording();
|
||||||
|
|
||||||
sound_set_volume(global_settings.volume);
|
sound_set_volume(global_settings.volume);
|
||||||
|
|
||||||
|
@ -298,15 +320,20 @@ bool recording_screen(void)
|
||||||
|
|
||||||
peak_meter_enabled = true;
|
peak_meter_enabled = true;
|
||||||
|
|
||||||
|
#if CONFIG_CODEC == SWCODEC
|
||||||
|
audio_stop();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (global_settings.rec_prerecord_time)
|
if (global_settings.rec_prerecord_time)
|
||||||
talk_buffer_steal(); /* will use the mp3 buffer */
|
talk_buffer_steal(); /* will use the mp3 buffer */
|
||||||
|
|
||||||
mpeg_set_recording_options(global_settings.rec_frequency,
|
audio_set_recording_options(global_settings.rec_frequency,
|
||||||
global_settings.rec_quality,
|
global_settings.rec_quality,
|
||||||
global_settings.rec_source,
|
global_settings.rec_source,
|
||||||
global_settings.rec_channels,
|
global_settings.rec_channels,
|
||||||
global_settings.rec_editable,
|
global_settings.rec_editable,
|
||||||
global_settings.rec_prerecord_time);
|
global_settings.rec_prerecord_time,
|
||||||
|
global_settings.rec_monitor);
|
||||||
|
|
||||||
set_gain();
|
set_gain();
|
||||||
|
|
||||||
|
@ -321,7 +348,12 @@ bool recording_screen(void)
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
int audio_stat = audio_status();
|
#if CONFIG_CODEC == SWCODEC
|
||||||
|
audio_stat = pcm_rec_status();
|
||||||
|
#else
|
||||||
|
audio_stat = audio_status();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CONFIG_LED == LED_REAL
|
#if CONFIG_LED == LED_REAL
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -390,7 +422,7 @@ bool recording_screen(void)
|
||||||
|
|
||||||
if(audio_stat & AUDIO_STATUS_RECORD)
|
if(audio_stat & AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
audio_stop();
|
audio_stop_recording();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -416,7 +448,7 @@ bool recording_screen(void)
|
||||||
/* manual recording */
|
/* manual recording */
|
||||||
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));
|
audio_record(rec_create_filename(path_buffer));
|
||||||
last_seconds = 0;
|
last_seconds = 0;
|
||||||
if (global_settings.talk_menu)
|
if (global_settings.talk_menu)
|
||||||
{ /* no voice possible here, but a beep */
|
{ /* no voice possible here, but a beep */
|
||||||
|
@ -438,7 +470,7 @@ bool recording_screen(void)
|
||||||
{
|
{
|
||||||
if(audio_stat & AUDIO_STATUS_PAUSE)
|
if(audio_stat & AUDIO_STATUS_PAUSE)
|
||||||
{
|
{
|
||||||
mpeg_resume_recording();
|
audio_resume_recording();
|
||||||
if (global_settings.talk_menu)
|
if (global_settings.talk_menu)
|
||||||
{ /* no voice possible here, but a beep */
|
{ /* no voice possible here, but a beep */
|
||||||
audio_beep(HZ/4); /* short beep on resume */
|
audio_beep(HZ/4); /* short beep on resume */
|
||||||
|
@ -446,7 +478,7 @@ bool recording_screen(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mpeg_pause_recording();
|
audio_pause_recording();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update_countdown = 1; /* Update immediately */
|
update_countdown = 1; /* Update immediately */
|
||||||
|
@ -535,7 +567,7 @@ bool recording_screen(void)
|
||||||
sound_min(SOUND_RIGHT_GAIN))
|
sound_min(SOUND_RIGHT_GAIN))
|
||||||
global_settings.rec_right_gain--;
|
global_settings.rec_right_gain--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
set_gain();
|
set_gain();
|
||||||
update_countdown = 1; /* Update immediately */
|
update_countdown = 1; /* Update immediately */
|
||||||
break;
|
break;
|
||||||
|
@ -557,12 +589,13 @@ bool recording_screen(void)
|
||||||
if (global_settings.rec_prerecord_time)
|
if (global_settings.rec_prerecord_time)
|
||||||
talk_buffer_steal(); /* will use the mp3 buffer */
|
talk_buffer_steal(); /* will use the mp3 buffer */
|
||||||
|
|
||||||
mpeg_set_recording_options(global_settings.rec_frequency,
|
audio_set_recording_options(global_settings.rec_frequency,
|
||||||
global_settings.rec_quality,
|
global_settings.rec_quality,
|
||||||
global_settings.rec_source,
|
global_settings.rec_source,
|
||||||
global_settings.rec_channels,
|
global_settings.rec_channels,
|
||||||
global_settings.rec_editable,
|
global_settings.rec_editable,
|
||||||
global_settings.rec_prerecord_time);
|
global_settings.rec_prerecord_time,
|
||||||
|
global_settings.rec_monitor);
|
||||||
|
|
||||||
set_gain();
|
set_gain();
|
||||||
update_countdown = 1; /* Update immediately */
|
update_countdown = 1; /* Update immediately */
|
||||||
|
@ -596,7 +629,7 @@ bool recording_screen(void)
|
||||||
case REC_F3:
|
case REC_F3:
|
||||||
if(audio_stat & AUDIO_STATUS_RECORD)
|
if(audio_stat & AUDIO_STATUS_RECORD)
|
||||||
{
|
{
|
||||||
mpeg_new_file(rec_create_filename(path_buffer));
|
audio_new_file(rec_create_filename(path_buffer));
|
||||||
last_seconds = 0;
|
last_seconds = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -638,8 +671,8 @@ bool recording_screen(void)
|
||||||
|
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
|
|
||||||
seconds = mpeg_recorded_time() / HZ;
|
seconds = audio_recorded_time() / HZ;
|
||||||
|
|
||||||
update_countdown--;
|
update_countdown--;
|
||||||
if(update_countdown == 0 || seconds > last_seconds)
|
if(update_countdown == 0 || seconds > last_seconds)
|
||||||
{
|
{
|
||||||
|
@ -660,7 +693,7 @@ bool recording_screen(void)
|
||||||
lcd_puts(0, 0, buf);
|
lcd_puts(0, 0, buf);
|
||||||
|
|
||||||
dseconds = rec_timesplit_seconds();
|
dseconds = rec_timesplit_seconds();
|
||||||
num_recorded_bytes = mpeg_num_recorded_bytes();
|
num_recorded_bytes = audio_num_recorded_bytes();
|
||||||
|
|
||||||
if(audio_stat & AUDIO_STATUS_PRERECORD)
|
if(audio_stat & AUDIO_STATUS_PRERECORD)
|
||||||
{
|
{
|
||||||
|
@ -699,7 +732,7 @@ bool recording_screen(void)
|
||||||
((global_settings.rec_timesplit && (seconds >= dseconds))
|
((global_settings.rec_timesplit && (seconds >= dseconds))
|
||||||
|| (num_recorded_bytes >= MAX_FILE_SIZE)))
|
|| (num_recorded_bytes >= MAX_FILE_SIZE)))
|
||||||
{
|
{
|
||||||
mpeg_new_file(rec_create_filename(path_buffer));
|
audio_new_file(rec_create_filename(path_buffer));
|
||||||
update_countdown = 1;
|
update_countdown = 1;
|
||||||
last_seconds = 0;
|
last_seconds = 0;
|
||||||
}
|
}
|
||||||
|
@ -784,7 +817,13 @@ bool recording_screen(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(audio_status() & AUDIO_STATUS_ERROR)
|
|
||||||
|
#if CONFIG_CODEC == SWCODEC
|
||||||
|
audio_stat = pcm_rec_status();
|
||||||
|
#else
|
||||||
|
audio_stat = audio_status();
|
||||||
|
#endif
|
||||||
|
if (audio_stat & AUDIO_STATUS_ERROR)
|
||||||
{
|
{
|
||||||
splash(0, true, str(LANG_DISK_FULL));
|
splash(0, true, str(LANG_DISK_FULL));
|
||||||
status_draw(true);
|
status_draw(true);
|
||||||
|
@ -799,7 +838,12 @@ bool recording_screen(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_CODEC == SWCODEC
|
||||||
|
audio_stop_recording();
|
||||||
|
audio_close_recording();
|
||||||
|
#else
|
||||||
audio_init_playback();
|
audio_init_playback();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* make sure the trigger is really turned off */
|
/* make sure the trigger is really turned off */
|
||||||
peak_meter_trigger(false);
|
peak_meter_trigger(false);
|
||||||
|
@ -924,12 +968,13 @@ bool f2_rec_screen(void)
|
||||||
if (global_settings.rec_prerecord_time)
|
if (global_settings.rec_prerecord_time)
|
||||||
talk_buffer_steal(); /* will use the mp3 buffer */
|
talk_buffer_steal(); /* will use the mp3 buffer */
|
||||||
|
|
||||||
mpeg_set_recording_options(global_settings.rec_frequency,
|
audio_set_recording_options(global_settings.rec_frequency,
|
||||||
global_settings.rec_quality,
|
global_settings.rec_quality,
|
||||||
global_settings.rec_source,
|
global_settings.rec_source,
|
||||||
global_settings.rec_channels,
|
global_settings.rec_channels,
|
||||||
global_settings.rec_editable,
|
global_settings.rec_editable,
|
||||||
global_settings.rec_prerecord_time);
|
global_settings.rec_prerecord_time,
|
||||||
|
global_settings.rec_monitor);
|
||||||
|
|
||||||
set_gain();
|
set_gain();
|
||||||
|
|
||||||
|
@ -1018,12 +1063,14 @@ bool f3_rec_screen(void)
|
||||||
if (global_settings.rec_prerecord_time)
|
if (global_settings.rec_prerecord_time)
|
||||||
talk_buffer_steal(); /* will use the mp3 buffer */
|
talk_buffer_steal(); /* will use the mp3 buffer */
|
||||||
|
|
||||||
mpeg_set_recording_options(global_settings.rec_frequency,
|
audio_set_recording_options(global_settings.rec_frequency,
|
||||||
global_settings.rec_quality,
|
global_settings.rec_quality,
|
||||||
global_settings.rec_source,
|
global_settings.rec_source,
|
||||||
global_settings.rec_channels,
|
global_settings.rec_channels,
|
||||||
global_settings.rec_editable,
|
global_settings.rec_editable,
|
||||||
global_settings.rec_prerecord_time);
|
global_settings.rec_prerecord_time,
|
||||||
|
global_settings.rec_monitor);
|
||||||
|
|
||||||
|
|
||||||
set_gain();
|
set_gain();
|
||||||
|
|
||||||
|
@ -1034,4 +1081,13 @@ bool f3_rec_screen(void)
|
||||||
}
|
}
|
||||||
#endif /* #ifdef REC_F3 */
|
#endif /* #ifdef REC_F3 */
|
||||||
|
|
||||||
|
#if CONFIG_CODEC == SWCODEC
|
||||||
|
void audio_beep(int duration)
|
||||||
|
{
|
||||||
|
/* dummy */
|
||||||
|
(void)duration;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* HAVE_RECORDING */
|
#endif /* HAVE_RECORDING */
|
||||||
|
|
|
@ -85,7 +85,7 @@ const char rec_base_directory[] = REC_BASE_DIR;
|
||||||
#include "dsp.h"
|
#include "dsp.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CONFIG_BLOCK_VERSION 29
|
#define CONFIG_BLOCK_VERSION 30
|
||||||
#define CONFIG_BLOCK_SIZE 512
|
#define CONFIG_BLOCK_SIZE 512
|
||||||
#define RTC_BLOCK_SIZE 44
|
#define RTC_BLOCK_SIZE 44
|
||||||
|
|
||||||
|
@ -407,6 +407,7 @@ static const struct bit_entry hd_bits[] =
|
||||||
|
|
||||||
#ifdef HAVE_RECORDING
|
#ifdef HAVE_RECORDING
|
||||||
{1, S_O(rec_startup), false, "rec screen on startup", off_on },
|
{1, S_O(rec_startup), false, "rec screen on startup", off_on },
|
||||||
|
{1, S_O(rec_monitor), true, "monitor recording", off_on },
|
||||||
|
|
||||||
/* values for the trigger */
|
/* values for the trigger */
|
||||||
{8 | SIGNED, S_O(rec_start_thres), -35, "trigger start threshold", NULL},
|
{8 | SIGNED, S_O(rec_start_thres), -35, "trigger start threshold", NULL},
|
||||||
|
@ -450,6 +451,26 @@ static const struct bit_entry hd_bits[] =
|
||||||
{22, S_O(dircache_size), 0, NULL, NULL },
|
{22, S_O(dircache_size), 0, NULL, NULL },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_UDA1380)
|
||||||
|
/* recording settings for iriver */
|
||||||
|
{4, S_O(rec_timesplit), 0, "rec timesplit", /* 0...15 */
|
||||||
|
"off,00:05,00:10,00:15,00:30,01:00,01:14,01:20,02:00,04:00,06:00,08:00,10:00,12:00,18:00,24:00" },
|
||||||
|
{1, S_O(rec_channels), 0, "rec channels", "stereo,mono" },
|
||||||
|
{4, S_O(rec_mic_gain), 4, "rec mic gain", NULL },
|
||||||
|
{1, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line" },
|
||||||
|
{3, S_O(rec_frequency), 0, /* 0=44.1kHz */
|
||||||
|
"rec frequency", "44,48,32,22,24,16" },
|
||||||
|
{4, S_O(rec_left_gain), 2, /* 0dB */
|
||||||
|
"rec left gain", NULL }, /* 0...15 */
|
||||||
|
{4, S_O(rec_right_gain), 2, /* 0dB */
|
||||||
|
"rec right gain", NULL }, /* 0...15 */
|
||||||
|
{5, S_O(rec_prerecord_time), 0, "prerecording time", NULL }, /* 0...30 */
|
||||||
|
{1, S_O(rec_directory), 0, /* rec_base_directory */
|
||||||
|
"rec directory", REC_BASE_DIR ",current" },
|
||||||
|
{8|SIGNED, S_O(rec_adc_left_gain), 0, /* 0dB */ "adc left gain", NULL }, /* -128...48 */
|
||||||
|
{8|SIGNED, S_O(rec_adc_right_gain), 0, /* 0dB */ "adc right gain", NULL }, /* -128...48 */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* If values are just added to the end, no need to bump the version. */
|
/* If values are just added to the end, no need to bump the version. */
|
||||||
/* new stuff to be added at the end */
|
/* new stuff to be added at the end */
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,12 @@ struct user_settings
|
||||||
int rec_mic_gain; /* 0-15 */
|
int rec_mic_gain; /* 0-15 */
|
||||||
int rec_left_gain; /* 0-15 */
|
int rec_left_gain; /* 0-15 */
|
||||||
int rec_right_gain; /* 0-15 */
|
int rec_right_gain; /* 0-15 */
|
||||||
|
#ifdef HAVE_UDA1380
|
||||||
|
int rec_adc_left_gain; /* -128 .. 48 */
|
||||||
|
int rec_adc_right_gain; /* -128 .. 48 */
|
||||||
|
#endif
|
||||||
bool rec_editable; /* true means that the bit reservoir is off */
|
bool rec_editable; /* true means that the bit reservoir is off */
|
||||||
|
bool rec_monitor; /* true means that one can listen to what is being recorded */
|
||||||
|
|
||||||
/* note: timesplit setting is not saved */
|
/* note: timesplit setting is not saved */
|
||||||
int rec_timesplit; /* 0 = off,
|
int rec_timesplit; /* 0 = off,
|
||||||
|
|
|
@ -228,6 +228,28 @@ static bool receditable(void)
|
||||||
&global_settings.rec_editable);
|
&global_settings.rec_editable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool recmonitor(void)
|
||||||
|
{
|
||||||
|
return set_bool(str(LANG_RECORDING_MONITOR),
|
||||||
|
&global_settings.rec_monitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_UDA1380
|
||||||
|
static bool recadcleft(void)
|
||||||
|
{
|
||||||
|
return set_sound(str(LANG_RECORDING_ADC_LEFT),
|
||||||
|
&global_settings.rec_adc_left_gain,
|
||||||
|
SOUND_ADC_LEFT_GAIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool recadcright(void)
|
||||||
|
{
|
||||||
|
return set_sound(str(LANG_RECORDING_ADC_RIGHT),
|
||||||
|
&global_settings.rec_adc_right_gain,
|
||||||
|
SOUND_ADC_RIGHT_GAIN);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool rectimesplit(void)
|
static bool rectimesplit(void)
|
||||||
{
|
{
|
||||||
static const struct opt_items names[] = {
|
static const struct opt_items names[] = {
|
||||||
|
@ -740,7 +762,7 @@ bool recording_menu(bool no_source)
|
||||||
{
|
{
|
||||||
int m;
|
int m;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
struct menu_item items[10];
|
struct menu_item items[13];
|
||||||
bool result;
|
bool result;
|
||||||
|
|
||||||
items[i].desc = ID2P(LANG_RECORDING_QUALITY);
|
items[i].desc = ID2P(LANG_RECORDING_QUALITY);
|
||||||
|
@ -753,6 +775,16 @@ bool recording_menu(bool no_source)
|
||||||
}
|
}
|
||||||
items[i].desc = ID2P(LANG_RECORDING_CHANNELS);
|
items[i].desc = ID2P(LANG_RECORDING_CHANNELS);
|
||||||
items[i++].function = recchannels;
|
items[i++].function = recchannels;
|
||||||
|
|
||||||
|
#ifdef HAVE_UDA1380
|
||||||
|
items[i].desc = ID2P(LANG_RECORDING_ADC_LEFT);
|
||||||
|
items[i++].function = recadcleft;
|
||||||
|
items[i].desc = ID2P(LANG_RECORDING_ADC_RIGHT);
|
||||||
|
items[i++].function = recadcright;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
items[i].desc = ID2P(LANG_RECORDING_MONITOR);
|
||||||
|
items[i++].function = recmonitor;
|
||||||
items[i].desc = ID2P(LANG_RECORDING_EDITABLE);
|
items[i].desc = ID2P(LANG_RECORDING_EDITABLE);
|
||||||
items[i++].function = receditable;
|
items[i++].function = receditable;
|
||||||
items[i].desc = ID2P(LANG_RECORD_TIMESPLIT);
|
items[i].desc = ID2P(LANG_RECORD_TIMESPLIT);
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
|
#include "audio.h"
|
||||||
|
|
||||||
#include "i2c-coldfire.h"
|
#include "i2c-coldfire.h"
|
||||||
#include "uda1380.h"
|
#include "uda1380.h"
|
||||||
|
@ -204,7 +205,7 @@ void uda1380_close(void)
|
||||||
* sound samples over the I2S bus, which is connected
|
* sound samples over the I2S bus, which is connected
|
||||||
* to the processor's IIS1 interface.
|
* to the processor's IIS1 interface.
|
||||||
*
|
*
|
||||||
* source_mic: true=record from microphone, false=record from line-in
|
* source_mic: true=record from microphone, false=record from line-in (or radio)
|
||||||
*/
|
*/
|
||||||
void uda1380_enable_recording(bool source_mic)
|
void uda1380_enable_recording(bool source_mic)
|
||||||
{
|
{
|
||||||
|
@ -246,17 +247,29 @@ void uda1380_disable_recording(void)
|
||||||
/**
|
/**
|
||||||
* Set recording gain and volume
|
* Set recording gain and volume
|
||||||
*
|
*
|
||||||
* mic_gain : range 0 .. 15 -> 0 .. 30 dB gain
|
* type: params: ranges:
|
||||||
* linein_gain : range 0 .. 15 -> 0 .. 24 dB gain
|
* AUDIO_GAIN_MIC left 0 .. 15 -> 0 .. 30 dB gain
|
||||||
*
|
* AUDIO_GAIN_LINEIN left & right 0 .. 8 -> 0 .. 24 dB gain
|
||||||
* adc_volume : range -127 .. 48 -> -63 .. 24 dB gain
|
* AUDIO_GAIN_ADC left & right -128 .. 48 -> -64 .. 24 dB gain
|
||||||
* note that 0 -> 0 dB gain..
|
*
|
||||||
|
* Note: For all types the value 0 gives 0 dB gain.
|
||||||
*/
|
*/
|
||||||
void uda1380_set_recvol(int mic_gain, int linein_gain, int adc_volume)
|
void uda1380_set_recvol(int left, int right, int type)
|
||||||
{
|
{
|
||||||
uda1380_write_reg(REG_DEC_VOL, DEC_VOLL(adc_volume) | DEC_VOLR(adc_volume));
|
switch (type)
|
||||||
uda1380_write_reg(REG_PGA, (uda1380_regs[REG_PGA] & ~PGA_GAIN_MASK) | PGA_GAINL(linein_gain) | PGA_GAINR(linein_gain));
|
{
|
||||||
uda1380_write_reg(REG_ADC, (uda1380_regs[REG_ADC] & ~VGA_GAIN_MASK) | VGA_GAIN(mic_gain));
|
case AUDIO_GAIN_MIC:
|
||||||
|
uda1380_write_reg(REG_ADC, (uda1380_regs[REG_ADC] & ~VGA_GAIN_MASK) | VGA_GAIN(left));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AUDIO_GAIN_LINEIN:
|
||||||
|
uda1380_write_reg(REG_PGA, (uda1380_regs[REG_PGA] & ~PGA_GAIN_MASK) | PGA_GAINL(left) | PGA_GAINR(right));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AUDIO_GAIN_ADC:
|
||||||
|
uda1380_write_reg(REG_DEC_VOL, DEC_VOLL(left) | DEC_VOLR(right));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,11 @@
|
||||||
|
|
||||||
#define AUDIOERR_DISK_FULL 1
|
#define AUDIOERR_DISK_FULL 1
|
||||||
|
|
||||||
|
#define AUDIO_GAIN_LINEIN 0
|
||||||
|
#define AUDIO_GAIN_MIC 1
|
||||||
|
#define AUDIO_GAIN_ADC 2 /* for UDA1380 */
|
||||||
|
|
||||||
|
|
||||||
struct audio_debug
|
struct audio_debug
|
||||||
{
|
{
|
||||||
int audiobuflen;
|
int audiobuflen;
|
||||||
|
@ -79,6 +84,24 @@ int audio_get_file_pos(void);
|
||||||
void audio_beep(int duration);
|
void audio_beep(int duration);
|
||||||
void audio_init_playback(void);
|
void audio_init_playback(void);
|
||||||
|
|
||||||
|
/* audio recording functions */
|
||||||
|
void audio_init_recording(void);
|
||||||
|
void audio_close_recording(void);
|
||||||
|
void audio_record(const char *filename);
|
||||||
|
void audio_stop_recording(void);
|
||||||
|
void audio_pause_recording(void);
|
||||||
|
void audio_resume_recording(void);
|
||||||
|
void audio_new_file(const char *filename);
|
||||||
|
void audio_set_recording_options(int frequency, int quality,
|
||||||
|
int source, int channel_mode,
|
||||||
|
bool editable, int prerecord_time,
|
||||||
|
bool monitor);
|
||||||
|
void audio_set_recording_gain(int left, int right, int type);
|
||||||
|
unsigned long audio_recorded_time(void);
|
||||||
|
unsigned long audio_num_recorded_bytes(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* audio event handling */
|
/* audio event handling */
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#define MODEL_NUMBER 0
|
#define MODEL_NUMBER 0
|
||||||
|
|
||||||
/* define this if you have recording possibility */
|
/* define this if you have recording possibility */
|
||||||
/*#define HAVE_RECORDING 1*/
|
#define HAVE_RECORDING 1
|
||||||
|
|
||||||
/* define this if you have a bitmap LCD display */
|
/* define this if you have a bitmap LCD display */
|
||||||
#define HAVE_LCD_BITMAP 1
|
#define HAVE_LCD_BITMAP 1
|
||||||
|
|
|
@ -44,20 +44,11 @@
|
||||||
#define MPEG_RESERVED_HEADER_SPACE (4096 + 576)
|
#define MPEG_RESERVED_HEADER_SPACE (4096 + 576)
|
||||||
|
|
||||||
#if (CONFIG_CODEC == MAS3587F) || defined(SIMULATOR)
|
#if (CONFIG_CODEC == MAS3587F) || defined(SIMULATOR)
|
||||||
void mpeg_init_recording(void);
|
|
||||||
void mpeg_record(const char *filename);
|
|
||||||
void mpeg_new_file(const char *filename);
|
|
||||||
void mpeg_set_recording_options(int frequency, int quality,
|
|
||||||
int source, int channel_mode,
|
|
||||||
bool editable, int prerecord_time);
|
|
||||||
void mpeg_set_recording_gain(int left, int right, bool use_mic);
|
|
||||||
#if CONFIG_TUNER & S1A0903X01
|
#if CONFIG_TUNER & S1A0903X01
|
||||||
int mpeg_get_mas_pllfreq(void);
|
int mpeg_get_mas_pllfreq(void);
|
||||||
#endif
|
#endif
|
||||||
unsigned long mpeg_recorded_time(void);
|
|
||||||
unsigned long mpeg_num_recorded_bytes(void);
|
|
||||||
void mpeg_pause_recording(void);
|
|
||||||
void mpeg_resume_recording(void);
|
|
||||||
#endif
|
#endif
|
||||||
unsigned long mpeg_get_last_header(void);
|
unsigned long mpeg_get_last_header(void);
|
||||||
|
|
||||||
|
|
|
@ -17,37 +17,13 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/*
|
|
||||||
* Function names are taken from apps/recorder/recording.c to
|
|
||||||
* make the integration later easier..
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PCM_RECORD_H
|
#ifndef PCM_RECORD_H
|
||||||
#define PCM_RECORD_H
|
#define PCM_RECORD_H
|
||||||
|
|
||||||
unsigned long pcm_status(void);
|
unsigned long pcm_rec_status(void);
|
||||||
|
void pcm_rec_init(void);
|
||||||
|
void pcm_rec_mux(int source);
|
||||||
|
|
||||||
void pcm_init_recording(void);
|
/* audio.h contains audio recording functions */
|
||||||
|
|
||||||
void pcm_open_recording(void);
|
|
||||||
void pcm_close_recording(void);
|
|
||||||
|
|
||||||
|
|
||||||
void pcm_set_recording_options(int source, bool enable_waveform);
|
|
||||||
void pcm_set_recording_gain(int gain, int volume);
|
|
||||||
|
|
||||||
void pcm_record(const char *filename);
|
|
||||||
void pcm_stop_recording(void);
|
|
||||||
|
|
||||||
//void pcm_new_file(const char *filename);
|
|
||||||
|
|
||||||
|
|
||||||
unsigned long pcm_recorded_time(void);
|
|
||||||
unsigned long pcm_num_recorded_bytes(void);
|
|
||||||
void pcm_pause_recording(void);
|
|
||||||
void pcm_resume_recording(void);
|
|
||||||
|
|
||||||
void pcmrec_set_mux(int source);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -36,11 +36,15 @@ enum {
|
||||||
SOUND_MDB_ENABLE,
|
SOUND_MDB_ENABLE,
|
||||||
SOUND_SUPERBASS,
|
SOUND_SUPERBASS,
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_CODEC == MAS3587F
|
#if CONFIG_CODEC == MAS3587F || defined(HAVE_UDA1380)
|
||||||
SOUND_LEFT_GAIN,
|
SOUND_LEFT_GAIN,
|
||||||
SOUND_RIGHT_GAIN,
|
SOUND_RIGHT_GAIN,
|
||||||
SOUND_MIC_GAIN,
|
SOUND_MIC_GAIN,
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAVE_UDA1380)
|
||||||
|
SOUND_ADC_LEFT_GAIN,
|
||||||
|
SOUND_ADC_RIGHT_GAIN,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -32,7 +32,7 @@ extern void uda1380_set_nsorder(int order);
|
||||||
|
|
||||||
extern void uda1380_enable_recording(bool source_mic);
|
extern void uda1380_enable_recording(bool source_mic);
|
||||||
extern void uda1380_disable_recording(void);
|
extern void uda1380_disable_recording(void);
|
||||||
extern void uda1380_set_recvol(int mic_gain, int linein_gain, int adc_volume);
|
extern void uda1380_set_recvol(int left, int right, int type);
|
||||||
extern void uda1380_set_monitor(int enable);
|
extern void uda1380_set_monitor(int enable);
|
||||||
|
|
||||||
#define UDA1380_ADDR 0x30
|
#define UDA1380_ADDR 0x30
|
||||||
|
|
|
@ -2115,7 +2115,7 @@ void audio_init_playback(void)
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Recording functions
|
* Recording functions
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void mpeg_init_recording(void)
|
void audio_init_recording(void)
|
||||||
{
|
{
|
||||||
init_recording_done = false;
|
init_recording_done = false;
|
||||||
queue_post(&mpeg_queue, MPEG_INIT_RECORDING, NULL);
|
queue_post(&mpeg_queue, MPEG_INIT_RECORDING, NULL);
|
||||||
|
@ -2224,7 +2224,7 @@ static void init_recording(void)
|
||||||
call mpeg_set_recording_options(). */
|
call mpeg_set_recording_options(). */
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_record(const char *filename)
|
void audio_record(const char *filename)
|
||||||
{
|
{
|
||||||
mpeg_errno = 0;
|
mpeg_errno = 0;
|
||||||
|
|
||||||
|
@ -2234,12 +2234,12 @@ void mpeg_record(const char *filename)
|
||||||
queue_post(&mpeg_queue, MPEG_RECORD, NULL);
|
queue_post(&mpeg_queue, MPEG_RECORD, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_pause_recording(void)
|
void audio_pause_recording(void)
|
||||||
{
|
{
|
||||||
queue_post(&mpeg_queue, MPEG_PAUSE_RECORDING, NULL);
|
queue_post(&mpeg_queue, MPEG_PAUSE_RECORDING, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_resume_recording(void)
|
void audio_resume_recording(void)
|
||||||
{
|
{
|
||||||
queue_post(&mpeg_queue, MPEG_RESUME_RECORDING, NULL);
|
queue_post(&mpeg_queue, MPEG_RESUME_RECORDING, NULL);
|
||||||
}
|
}
|
||||||
|
@ -2435,9 +2435,10 @@ static void stop_recording(void)
|
||||||
resume_recording();
|
resume_recording();
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_set_recording_options(int frequency, int quality,
|
void audio_set_recording_options(int frequency, int quality,
|
||||||
int source, int channel_mode,
|
int source, int channel_mode,
|
||||||
bool editable, int prerecord_time)
|
bool editable, int prerecord_time,
|
||||||
|
bool monitor)
|
||||||
{
|
{
|
||||||
bool is_mpeg1;
|
bool is_mpeg1;
|
||||||
|
|
||||||
|
@ -2461,7 +2462,7 @@ void mpeg_set_recording_options(int frequency, int quality,
|
||||||
|
|
||||||
DEBUGF("mas_writemem(MAS_BANK_D0, SOFT_MUTE, %x)\n", shadow_soft_mute);
|
DEBUGF("mas_writemem(MAS_BANK_D0, SOFT_MUTE, %x)\n", shadow_soft_mute);
|
||||||
|
|
||||||
shadow_io_control_main = ((1 << 10) | /* Monitoring ON */
|
shadow_io_control_main = ((monitor?(1 << 10):0) | /* Monitoring ON */
|
||||||
((source < 2)?1:2) << 8) | /* Input select */
|
((source < 2)?1:2) << 8) | /* Input select */
|
||||||
(1 << 5) | /* SDO strobe invert */
|
(1 << 5) | /* SDO strobe invert */
|
||||||
((is_mpeg1?0:1) << 3) |
|
((is_mpeg1?0:1) << 3) |
|
||||||
|
@ -2497,13 +2498,13 @@ void mpeg_set_recording_options(int frequency, int quality,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If use_mic is true, the left gain is used */
|
/* If use_mic is true, the left gain is used */
|
||||||
void mpeg_set_recording_gain(int left, int right, bool use_mic)
|
void audio_set_recording_gain(int left, int right, int type)
|
||||||
{
|
{
|
||||||
/* Enable both left and right A/D */
|
/* Enable both left and right A/D */
|
||||||
shadow_codec_reg0 = (left << 12) |
|
shadow_codec_reg0 = (left << 12) |
|
||||||
(right << 8) |
|
(right << 8) |
|
||||||
(left << 4) |
|
(left << 4) |
|
||||||
(use_mic?0x0008:0) | /* Connect left A/D to mic */
|
(type==AUDIO_GAIN_MIC?0x0008:0) | /* Connect left A/D to mic */
|
||||||
0x0007;
|
0x0007;
|
||||||
mas_codec_writereg(0x0, shadow_codec_reg0);
|
mas_codec_writereg(0x0, shadow_codec_reg0);
|
||||||
}
|
}
|
||||||
|
@ -2539,7 +2540,7 @@ void audio_beep(int duration)
|
||||||
while (current_tick - starttick < duration);
|
while (current_tick - starttick < duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_new_file(const char *filename)
|
void audio_new_file(const char *filename)
|
||||||
{
|
{
|
||||||
mpeg_errno = 0;
|
mpeg_errno = 0;
|
||||||
|
|
||||||
|
@ -2549,7 +2550,7 @@ void mpeg_new_file(const char *filename)
|
||||||
queue_post(&mpeg_queue, MPEG_NEW_FILE, NULL);
|
queue_post(&mpeg_queue, MPEG_NEW_FILE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long mpeg_recorded_time(void)
|
unsigned long audio_recorded_time(void)
|
||||||
{
|
{
|
||||||
if(is_prerecording)
|
if(is_prerecording)
|
||||||
return prerecord_count * HZ;
|
return prerecord_count * HZ;
|
||||||
|
@ -2565,7 +2566,7 @@ unsigned long mpeg_recorded_time(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long mpeg_num_recorded_bytes(void)
|
unsigned long audio_num_recorded_bytes(void)
|
||||||
{
|
{
|
||||||
int num_bytes;
|
int num_bytes;
|
||||||
int index;
|
int index;
|
||||||
|
@ -2599,7 +2600,7 @@ void audio_init_playback(void)
|
||||||
{
|
{
|
||||||
/* a dummy */
|
/* a dummy */
|
||||||
}
|
}
|
||||||
unsigned long mpeg_recorded_time(void)
|
unsigned long audio_recorded_time(void)
|
||||||
{
|
{
|
||||||
/* a dummy */
|
/* a dummy */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2609,42 +2610,42 @@ void audio_beep(int duration)
|
||||||
/* a dummy */
|
/* a dummy */
|
||||||
(void)duration;
|
(void)duration;
|
||||||
}
|
}
|
||||||
void mpeg_pause_recording(void)
|
void audio_pause_recording(void)
|
||||||
{
|
{
|
||||||
/* a dummy */
|
/* a dummy */
|
||||||
}
|
}
|
||||||
void mpeg_resume_recording(void)
|
void audio_resume_recording(void)
|
||||||
{
|
{
|
||||||
/* a dummy */
|
/* a dummy */
|
||||||
}
|
}
|
||||||
unsigned long mpeg_num_recorded_bytes(void)
|
unsigned long audio_num_recorded_bytes(void)
|
||||||
{
|
{
|
||||||
/* a dummy */
|
/* a dummy */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
void mpeg_record(const char *filename)
|
void audio_record(const char *filename)
|
||||||
{
|
{
|
||||||
/* a dummy */
|
/* a dummy */
|
||||||
(void)filename;
|
(void)filename;
|
||||||
}
|
}
|
||||||
void mpeg_new_file(const char *filename)
|
void audio_new_file(const char *filename)
|
||||||
{
|
{
|
||||||
/* a dummy */
|
/* a dummy */
|
||||||
(void)filename;
|
(void)filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mpeg_set_recording_gain(int left, int right, bool use_mic)
|
void audio_set_recording_gain(int left, int right, int type)
|
||||||
{
|
{
|
||||||
/* a dummy */
|
/* a dummy */
|
||||||
(void)left;
|
(void)left;
|
||||||
(void)right;
|
(void)right;
|
||||||
(void)use_mic;
|
(void)type;
|
||||||
}
|
}
|
||||||
void mpeg_init_recording(void)
|
void audio_init_recording(void)
|
||||||
{
|
{
|
||||||
/* a dummy */
|
/* a dummy */
|
||||||
}
|
}
|
||||||
void mpeg_set_recording_options(int frequency, int quality,
|
void audio_set_recording_options(int frequency, int quality,
|
||||||
int source, int channel_mode,
|
int source, int channel_mode,
|
||||||
bool editable, int prerecord_time)
|
bool editable, int prerecord_time)
|
||||||
{
|
{
|
||||||
|
@ -2710,6 +2711,12 @@ void audio_stop(void)
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* dummy */
|
||||||
|
void audio_stop_recording(void)
|
||||||
|
{
|
||||||
|
audio_stop();
|
||||||
|
}
|
||||||
|
|
||||||
void audio_pause(void)
|
void audio_pause(void)
|
||||||
{
|
{
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -84,6 +84,12 @@ static const struct sound_settings_info sound_settings_table[] = {
|
||||||
[SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 15, 8, NULL},
|
[SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 15, 8, NULL},
|
||||||
[SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 15, 8, NULL},
|
[SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 15, 8, NULL},
|
||||||
[SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 15, 2, NULL},
|
[SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 15, 2, NULL},
|
||||||
|
#elif defined(HAVE_UDA1380)
|
||||||
|
[SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 8, 8, NULL},
|
||||||
|
[SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 8, 8, NULL},
|
||||||
|
[SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 15, 2, NULL},
|
||||||
|
[SOUND_ADC_LEFT_GAIN] = {"dB", 1, 1,-128, 48, 0, NULL},
|
||||||
|
[SOUND_ADC_RIGHT_GAIN]= {"dB", 1, 1,-128, 48, 0, NULL},
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -668,6 +674,30 @@ int sound_val2phys(int setting, int value)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
#elif defined(HAVE_UDA1380)
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
switch(setting)
|
||||||
|
{
|
||||||
|
case SOUND_LEFT_GAIN:
|
||||||
|
case SOUND_RIGHT_GAIN:
|
||||||
|
result = value * 30; /* (24/8) *10 */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_MIC_GAIN:
|
||||||
|
result = value * 20; /* (30/15) *10 */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SOUND_ADC_LEFT_GAIN:
|
||||||
|
case SOUND_ADC_RIGHT_GAIN:
|
||||||
|
result = value * 5; /* (1/2) *10 */
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
result = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
#else
|
#else
|
||||||
(void)setting;
|
(void)setting;
|
||||||
return value;
|
return value;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue