introduce general audiohw api for recording
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15687 a1c6a512-1295-4272-9138-f99709370657
diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c
index 5d7c700..f88cafe 100644
--- a/firmware/drivers/audio/as3514.c
+++ b/firmware/drivers/audio/as3514.c
@@ -394,7 +394,7 @@
* 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 7ff34e7..f5b637e 100644
--- a/firmware/drivers/audio/uda1380.c
+++ b/firmware/drivers/audio/uda1380.c
@@ -451,7 +451,7 @@
* 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 66eb1e8..e051fc4 100644
--- a/firmware/drivers/audio/wm8731.c
+++ b/firmware/drivers/audio/wm8731.c
@@ -177,7 +177,7 @@
{
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_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 4a01836..30740d5 100644
--- a/firmware/drivers/audio/wm8758.c
+++ b/firmware/drivers/audio/wm8758.c
@@ -268,7 +268,7 @@
(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 65a5f03..a069d15 100644
--- a/firmware/drivers/audio/wm8975.c
+++ b/firmware/drivers/audio/wm8975.c
@@ -311,7 +311,7 @@
(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 955019f..82be135 100644
--- a/firmware/export/as3514.h
+++ b/firmware/export/as3514.h
@@ -30,11 +30,6 @@
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 9da1a38..c5093a1 100644
--- a/firmware/export/audiohw.h
+++ b/firmware/export/audiohw.h
@@ -109,8 +109,38 @@
/**
* 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 af9b362..94c51aa 100644
--- a/firmware/export/tlv320.h
+++ b/firmware/export/tlv320.h
@@ -40,10 +40,6 @@
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 b4b83d1..2f35b29 100644
--- a/firmware/export/uda1380.h
+++ b/firmware/export/uda1380.h
@@ -45,10 +45,6 @@
* 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 5e94a4e..3dc82b6 100644
--- a/firmware/export/wm8731.h
+++ b/firmware/export/wm8731.h
@@ -34,11 +34,6 @@
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 8a3c619..62fb04a 100644
--- a/firmware/export/wm8758.h
+++ b/firmware/export/wm8758.h
@@ -37,11 +37,6 @@
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 e97497e..ab162fc 100644
--- a/firmware/export/wm8975.h
+++ b/firmware/export/wm8975.h
@@ -37,11 +37,6 @@
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