summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Courtier-Dutton <jcdutton@users.sourceforge.net>2003-12-31 23:29:06 +0000
committerJames Courtier-Dutton <jcdutton@users.sourceforge.net>2003-12-31 23:29:06 +0000
commit124884bacd4a6cf07c1f09169c12755d85683ece (patch)
tree936478ca3ff4f5fb39adfbad5d6767ff1dfc937b
parent0ecb9732a0a50ea49bcfb8346438dbcf835544ff (diff)
downloadxine-lib-124884bacd4a6cf07c1f09169c12755d85683ece.tar.gz
xine-lib-124884bacd4a6cf07c1f09169c12755d85683ece.tar.bz2
Add a mute feature to the software amp.
CVS patchset: 5967 CVS date: 2003/12/31 23:29:06
-rw-r--r--include/xine.h.in3
-rw-r--r--src/xine-engine/audio_out.c18
-rw-r--r--src/xine-engine/audio_out.h3
-rw-r--r--src/xine-engine/xine_interface.c12
4 files changed, 31 insertions, 5 deletions
diff --git a/include/xine.h.in b/include/xine.h.in
index 04dbe621a..622016346 100644
--- a/include/xine.h.in
+++ b/include/xine.h.in
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine.h.in,v 1.112 2003/12/26 16:13:22 mroi Exp $
+ * $Id: xine.h.in,v 1.113 2003/12/31 23:29:06 jcdutton Exp $
*
* public xine-lib (libxine) interface and documentation
*
@@ -324,6 +324,7 @@ int xine_get_param (xine_stream_t *stream, int param);
#define XINE_PARAM_EQ_8000HZ 26 /* equalizer gains -100..100 */
#define XINE_PARAM_EQ_16000HZ 27 /* equalizer gains -100..100 */
#define XINE_PARAM_AUDIO_CLOSE_DEVICE 28 /* force closing audio device */
+#define XINE_PARAM_AUDIO_AMP_MUTE 29 /* 1=>mute, 0=>unmute */
/* speed values */
#define XINE_SPEED_PAUSE 0
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index 530a677c4..ccf3b7be8 100644
--- a/src/xine-engine/audio_out.c
+++ b/src/xine-engine/audio_out.c
@@ -17,7 +17,7 @@
* along with self program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_out.c,v 1.159 2003/12/24 13:06:12 mroi Exp $
+ * $Id: audio_out.c,v 1.160 2003/12/31 23:29:06 jcdutton Exp $
*
* 22-8-2001 James imported some useful AC3 sections from the previous alsa driver.
* (c) 2001 Andy Lo A Foe <andy@alsaplayer.org>
@@ -253,6 +253,7 @@ typedef struct {
double compression_factor; /* current compression */
double compression_factor_max; /* user limit on compression */
int do_amp;
+ int amp_mute;
double amp_factor;
/* 10-band equalizer */
@@ -537,13 +538,17 @@ static void audio_filter_amp (aos_t *this, int16_t *mem, int num_frames) {
int i;
int num_channels;
+ double amp_factor;
num_channels = _x_ao_mode2channels (this->input.mode);
if (!num_channels)
return;
+ amp_factor=this->amp_factor;
+ if (this->amp_mute) amp_factor=0.0;
+
for (i=0; i<num_frames*num_channels; i++) {
- mem[i] = mem[i] * this->amp_factor;
+ mem[i] = mem[i] * amp_factor;
}
}
@@ -1530,6 +1535,10 @@ static int ao_get_property (xine_audio_port_t *this_gen, int property) {
ret = this->amp_factor*100;
break;
+ case AO_PROP_AMP_MUTE:
+ ret = this->amp_mute;
+ break;
+
case AO_PROP_EQ_30HZ:
case AO_PROP_EQ_60HZ:
case AO_PROP_EQ_125HZ:
@@ -1584,6 +1593,10 @@ static int ao_set_property (xine_audio_port_t *this_gen, int property, int value
ret = this->amp_factor*100;
break;
+ case AO_PROP_AMP_MUTE:
+ this->amp_mute = value;
+ break;
+
case AO_PROP_EQ_30HZ:
case AO_PROP_EQ_60HZ:
case AO_PROP_EQ_125HZ:
@@ -1849,6 +1862,7 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver,
this->do_compress = 0;
this->amp_factor = 1.0;
this->do_amp = 0;
+ this->amp_mute = 0;
this->do_equ = 0;
this->eq_gain[0] = 0;
diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h
index f3558e17b..bef0bd409 100644
--- a/src/xine-engine/audio_out.h
+++ b/src/xine-engine/audio_out.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_out.h,v 1.64 2003/12/14 22:13:26 siggi Exp $
+ * $Id: audio_out.h,v 1.65 2003/12/31 23:29:06 jcdutton Exp $
*/
#ifndef HAVE_AUDIO_OUT_H
#define HAVE_AUDIO_OUT_H
@@ -314,6 +314,7 @@ int _x_ao_mode2channels( int mode );
#define AO_PROP_EQ_8000HZ 15 /* equalizer */
#define AO_PROP_EQ_16000HZ 16 /* equalizer */
#define AO_PROP_CLOSE_DEVICE 17 /* force closing audio device */
+#define AO_PROP_AMP_MUTE 18 /* amplifier mute */
/* audio device control ops */
#define AO_CTRL_PLAY_PAUSE 0
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index 22d707082..63d4297eb 100644
--- a/src/xine-engine/xine_interface.c
+++ b/src/xine-engine/xine_interface.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_interface.c,v 1.74 2003/12/14 00:28:02 f1rmb Exp $
+ * $Id: xine_interface.c,v 1.75 2003/12/31 23:29:06 jcdutton Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -380,6 +380,11 @@ void xine_set_param (xine_stream_t *stream, int param, int value) {
stream->audio_out->set_property (stream->audio_out, AO_PROP_AMP, value);
break;
+ case XINE_PARAM_AUDIO_AMP_MUTE:
+ if (stream->audio_out)
+ stream->audio_out->set_property (stream->audio_out, AO_PROP_AMP_MUTE, value);
+ break;
+
case XINE_PARAM_AUDIO_CLOSE_DEVICE:
if (stream->audio_out)
stream->audio_out->set_property (stream->audio_out, AO_PROP_CLOSE_DEVICE, value);
@@ -488,6 +493,11 @@ int xine_get_param (xine_stream_t *stream, int param) {
return -1;
return stream->audio_out->get_property (stream->audio_out, AO_PROP_AMP);
+ case XINE_PARAM_AUDIO_AMP_MUTE:
+ if (!stream->audio_out)
+ return -1;
+ return stream->audio_out->get_property (stream->audio_out, AO_PROP_AMP_MUTE);
+
case XINE_PARAM_EQ_30HZ:
case XINE_PARAM_EQ_60HZ:
case XINE_PARAM_EQ_125HZ: