From c583f3c8d1bbed4a1f432bd22f15c126a95d63bb Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Mon, 19 Nov 2007 15:50:52 +0000 Subject: [PATCH] introduce general audiohw api for recording git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15687 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/audio/as3514.c | 2 +- firmware/drivers/audio/uda1380.c | 2 +- firmware/drivers/audio/wm8731.c | 4 ++-- firmware/drivers/audio/wm8758.c | 2 +- firmware/drivers/audio/wm8975.c | 2 +- firmware/export/as3514.h | 5 ----- firmware/export/audiohw.h | 32 +++++++++++++++++++++++++++++++- firmware/export/tlv320.h | 4 ---- firmware/export/uda1380.h | 4 ---- firmware/export/wm8731.h | 5 ----- firmware/export/wm8758.h | 5 ----- firmware/export/wm8975.h | 5 ----- 12 files changed, 37 insertions(+), 35 deletions(-) diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c index 5d7c700ac1..f88cafe25c 100644 --- a/firmware/drivers/audio/as3514.c +++ b/firmware/drivers/audio/as3514.c @@ -394,7 +394,7 @@ void audiohw_set_recvol(int left, int right, int type) * Enable line in 1 analog monitoring * */ -void audiohw_set_monitor(int enable) +void audiohw_set_monitor(bool enable) { /* LI1R_Mute_on - default */ unsigned int line_in1_r = as3514.regs[LINE_IN1_R] & ~(1 << 5); diff --git a/firmware/drivers/audio/uda1380.c b/firmware/drivers/audio/uda1380.c index 7ff34e7745..f5b637eaa4 100644 --- a/firmware/drivers/audio/uda1380.c +++ b/firmware/drivers/audio/uda1380.c @@ -451,7 +451,7 @@ void audiohw_set_recvol(int left, int right, int type) * Enable or disable recording monitor (so one can listen to the recording) * */ -void audiohw_set_monitor(int enable) +void audiohw_set_monitor(bool enable) { if (enable) /* enable channel 2 */ uda1380_write_reg(REG_MUTE, uda1380_regs[REG_MUTE] & ~MUTE_CH2); diff --git a/firmware/drivers/audio/wm8731.c b/firmware/drivers/audio/wm8731.c index 66eb1e859a..e051fc4bb7 100644 --- a/firmware/drivers/audio/wm8731.c +++ b/firmware/drivers/audio/wm8731.c @@ -177,7 +177,7 @@ void audiohw_postinit(void) { sleep(HZ); - /* 4) Set the ‘Active’ bit in register 12h. */ + /* 4) Set the �Active� bit in register 12h. */ codec_set_active(true); audiohw_mute(false); @@ -316,7 +316,7 @@ void audiohw_set_recvol(int left, int right, int type) } } -void audiohw_set_monitor(int enable) +void audiohw_set_monitor(bool enable) { if(enable) { diff --git a/firmware/drivers/audio/wm8758.c b/firmware/drivers/audio/wm8758.c index 4a01836776..30740d5fed 100644 --- a/firmware/drivers/audio/wm8758.c +++ b/firmware/drivers/audio/wm8758.c @@ -268,7 +268,7 @@ void audiohw_set_recvol(int left, int right, int type) { (void)type; } -void audiohw_set_monitor(int enable) { +void audiohw_set_monitor(bool enable) { (void)enable; } diff --git a/firmware/drivers/audio/wm8975.c b/firmware/drivers/audio/wm8975.c index 65a5f0349d..a069d159e5 100644 --- a/firmware/drivers/audio/wm8975.c +++ b/firmware/drivers/audio/wm8975.c @@ -311,7 +311,7 @@ void audiohw_set_recvol(int left, int right, int type) { (void)type; } -void audiohw_set_monitor(int enable) { +void audiohw_set_monitor(bool enable) { (void)enable; } diff --git a/firmware/export/as3514.h b/firmware/export/as3514.h index 955019f0b1..82be135f98 100644 --- a/firmware/export/as3514.h +++ b/firmware/export/as3514.h @@ -30,11 +30,6 @@ extern int audiohw_set_master_vol(int vol_l, int vol_r); extern int audiohw_set_lineout_vol(int vol_l, int vol_r); extern void audiohw_set_sample_rate(int sampling_control); -extern void audiohw_enable_recording(bool source_mic); -extern void audiohw_disable_recording(void); -extern void audiohw_set_recvol(int left, int right, int type); -extern void audiohw_set_monitor(int enable); - /* Register Descriptions */ #define LINE_OUT_R 0x00 #define LINE_OUT_L 0x01 diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h index 9da1a3875f..c5093a151a 100644 --- a/firmware/export/audiohw.h +++ b/firmware/export/audiohw.h @@ -109,8 +109,38 @@ void audiohw_close(void); /** * Mute or enable sound. - * @param mute true or false + * @param mute true or false. */ void audiohw_mute(bool mute); +#ifdef HAVE_RECORDING + +/** + * Enable recording. + * @param source_mic if this is true, we want to record from microphone, + * else we want to record FM/LineIn. + */ +void audiohw_enable_recording(bool source_mic); + +/** + * Disable recording. + */ +void audiohw_disable_recording(void); + +/** + * Set gain of recording source. + * @param left gain value. + * @param right will not be used if recording from micophone (mono). + * @param type AUDIO_GAIN_MIC, AUDIO_GAIN_LINEIN. + */ +void audiohw_set_recvol(int left, int right, int type); + +/** + * Enable or disable recording monitor. + * @param enable ture or false. + */ +void audiohw_set_monitor(bool enable); + +#endif /*HAVE_RECORDING*/ + #endif /* _AUDIOHW_H_ */ diff --git a/firmware/export/tlv320.h b/firmware/export/tlv320.h index af9b36262f..94c51aaf76 100644 --- a/firmware/export/tlv320.h +++ b/firmware/export/tlv320.h @@ -40,10 +40,6 @@ extern void audiohw_reset(void); extern void audiohw_set_frequency(unsigned fsel); extern void audiohw_enable_output(bool enable); extern void audiohw_set_headphone_vol(int vol_l, int vol_r); -extern void audiohw_set_recvol(int left, int right, int type); -extern void audiohw_enable_recording(bool source_mic); -extern void audiohw_disable_recording(void); -extern void audiohw_set_monitor(bool enable); #define HEADPHONE_MUTE 0x30 /* 0110000 = -73db */ diff --git a/firmware/export/uda1380.h b/firmware/export/uda1380.h index b4b83d1ee9..2f35b29325 100644 --- a/firmware/export/uda1380.h +++ b/firmware/export/uda1380.h @@ -45,10 +45,6 @@ extern void audiohw_set_treble(int value); * 88200: 3 = 50 to 100 SCLK, LRCK: Audio Clk / 2 */ extern void audiohw_set_frequency(unsigned fsel); -extern void audiohw_enable_recording(bool source_mic); -extern void audiohw_disable_recording(void); -extern void audiohw_set_recvol(int left, int right, int type); -extern void audiohw_set_monitor(int enable); #define UDA1380_ADDR 0x30 diff --git a/firmware/export/wm8731.h b/firmware/export/wm8731.h index 5e94a4e9a6..3dc82b6d76 100644 --- a/firmware/export/wm8731.h +++ b/firmware/export/wm8731.h @@ -34,11 +34,6 @@ extern int audiohw_set_master_vol(int vol_l, int vol_r); extern void audiohw_set_nsorder(int order); extern void audiohw_set_sample_rate(int sampling_control); -extern void audiohw_enable_recording(bool source_mic); -extern void audiohw_disable_recording(void); -extern void audiohw_set_recvol(int left, int right, int type); -extern void audiohw_set_monitor(int enable); - /* Register addresses and bits */ #define LINVOL 0x00 #define LINVOL_MASK 0x1f diff --git a/firmware/export/wm8758.h b/firmware/export/wm8758.h index 8a3c61910c..62fb04a7e0 100644 --- a/firmware/export/wm8758.h +++ b/firmware/export/wm8758.h @@ -37,11 +37,6 @@ extern void audiohw_set_treble(int value); extern void audiohw_set_nsorder(int order); extern void audiohw_set_sample_rate(int sampling_control); -extern void audiohw_enable_recording(bool source_mic); -extern void audiohw_disable_recording(void); -extern void audiohw_set_recvol(int left, int right, int type); -extern void audiohw_set_monitor(int enable); - extern void audiohw_set_equalizer_band(int band, int freq, int bw, int gain); #define RESET 0x00 diff --git a/firmware/export/wm8975.h b/firmware/export/wm8975.h index e97497ee02..ab162fcab6 100644 --- a/firmware/export/wm8975.h +++ b/firmware/export/wm8975.h @@ -37,11 +37,6 @@ extern void audiohw_set_treble(int value); extern void audiohw_set_nsorder(int order); extern void audiohw_set_sample_rate(int sampling_control); -extern void audiohw_enable_recording(bool source_mic); -extern void audiohw_disable_recording(void); -extern void audiohw_set_recvol(int left, int right, int type); -extern void audiohw_set_monitor(int enable); - /* Register addresses */ #define LOUT1VOL 0x02 #define ROUT1VOL 0x03