summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/audio_out/audio_alsa_out.c35
-rw-r--r--src/audio_out/audio_oss_out.c19
-rw-r--r--src/xine-engine/audio_out.c46
3 files changed, 45 insertions, 55 deletions
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c
index 67931e77b..86309986c 100644
--- a/src/audio_out/audio_alsa_out.c
+++ b/src/audio_out/audio_alsa_out.c
@@ -26,7 +26,7 @@
* (c) 2001 James Courtier-Dutton <James@superbug.demon.co.uk>
*
*
- * $Id: audio_alsa_out.c,v 1.53 2002/06/03 07:53:11 f1rmb Exp $
+ * $Id: audio_alsa_out.c,v 1.54 2002/06/03 09:45:12 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -505,18 +505,6 @@ static void ao_alsa_exit(ao_driver_t *this_gen)
alsa_driver_t *this = (alsa_driver_t *) this_gen;
void *p;
- config_values_t *config = this->config;
-
- if(this->mixer.remember_volume) {
- config->update_num (config, "audio.alsa_mixer_volume",
- (((ao_alsa_get_percent_from_volume(this->mixer.left_vol,
- this->mixer.min, this->mixer.max)) +
- (ao_alsa_get_percent_from_volume(this->mixer.right_vol,
- this->mixer.min, this->mixer.max))) /2));
- }
-
- config->save(config);
-
pthread_mutex_destroy(&this->mixer.mutex);
/*
* Destroy the mixer thread and cleanup the mixer, so that
@@ -1050,27 +1038,6 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) {
pthread_mutex_init(&this->mixer.mutex, NULL);
ao_alsa_mixer_init(&this->ao_driver);
- /* Restore volume from last used level */
- if((this->mixer.remember_volume =
- config->register_bool (config, "audio.remember_volume", 0,
- "restore volume level at startup",
- "if this not set, xine will not touch any mixer settings at startup",
- NULL, NULL)) == 1) {
- int vol;
- int prop;
-
- vol = config->register_range (config, "audio.alsa_mixer_volume",
- 50, 0, 100, "Audio volume",
- NULL, NULL, NULL);
-
- if(this->capabilities |= AO_CAP_MIXER_VOL)
- prop = AO_PROP_MIXER_VOL;
- else if(this->capabilities |= AO_CAP_PCM_VOL)
- prop = AO_PROP_PCM_VOL;
-
- (void) ao_alsa_set_property(&this->ao_driver, prop, vol);
- }
-
this->ao_driver.get_capabilities = ao_alsa_get_capabilities;
this->ao_driver.get_property = ao_alsa_get_property;
this->ao_driver.set_property = ao_alsa_set_property;
diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c
index f3b41b916..9d26a6cd3 100644
--- a/src/audio_out/audio_oss_out.c
+++ b/src/audio_out/audio_oss_out.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: audio_oss_out.c,v 1.65 2002/05/28 10:40:16 heikos Exp $
+ * $Id: audio_oss_out.c,v 1.66 2002/06/03 09:45:12 f1rmb Exp $
*
* 20-8-2001 First implementation of Audio sync and Audio driver separation.
* Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk
@@ -446,10 +446,6 @@ static uint32_t ao_oss_get_capabilities (ao_driver_t *this_gen) {
static void ao_oss_exit(ao_driver_t *this_gen) {
oss_driver_t *this = (oss_driver_t *) this_gen;
- config_values_t *config = this->config;
-
-
- config->update_num (config, "audio.mixer_volume", this->mixer.volume);
if (this->audio_fd != -1)
close(this->audio_fd);
@@ -875,18 +871,7 @@ ao_driver_t *init_audio_out_plugin (config_values_t *config) {
this->mixer.mute = 0;
this->mixer.volume = ao_oss_get_property (&this->ao_driver, this->mixer.prop);
- if (config->register_bool (config, "audio.remember_volume", 0,
- "restore volume level at startup",
- "if this not set, xine will not touch any mixer settings at startup",
- NULL, NULL)) {
- this->mixer.volume = config->register_range (config,
- "audio.oss_mixer_volume",
- 50, 0, 100, "Audio volume",
- NULL, NULL, NULL);
- (void) ao_oss_set_property(&this->ao_driver,
- this->mixer.prop, this->mixer.volume);
-
- }
+
}
close (audio_fd);
diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c
index c5a966420..b3a62646a 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.55 2002/05/24 12:23:58 miguelfreitas Exp $
+ * $Id: audio_out.c,v 1.56 2002/06/03 09:45:12 f1rmb Exp $
*
* 22-8-2001 James imported some useful AC3 sections from the previous alsa driver.
* (c) 2001 Andy Lo A Foe <andy@alsaplayer.org>
@@ -588,10 +588,24 @@ static void ao_close(ao_instance_t *this) {
}
static void ao_exit(ao_instance_t *this) {
-
+ int vol;
+ int prop = 0;
+
audio_buffer_t *buf, *next;
-
+
pthread_mutex_lock( &this->driver_lock );
+
+ if((this->driver->get_capabilities(this->driver)) & AO_CAP_MIXER_VOL)
+ prop = AO_PROP_MIXER_VOL;
+ else if((this->driver->get_capabilities(this->driver)) & AO_CAP_PCM_VOL)
+ prop = AO_PROP_PCM_VOL;
+
+ vol = this->driver->get_property(this->driver, prop);
+ this->xine->config->update_num(this->xine->config, "audio.mixer_volume", vol);
+
+ /* Save config is needed, otherwise value change will be lost */
+ this->xine->config->save(this->xine->config);
+
this->driver->exit(this->driver);
pthread_mutex_unlock( &this->driver_lock );
@@ -728,6 +742,30 @@ ao_instance_t *ao_new_instance (ao_driver_t *driver, xine_t *xine) {
fifo_append (this->free_fifo, buf);
}
-
+ /*
+ * Set audio volume to latest used one ?
+ */
+ if(this->driver){
+ int vol;
+
+ vol = config->register_range (config, "audio.mixer_volume",
+ 50, 0, 100, "Audio volume",
+ NULL, NULL, NULL);
+
+ if(config->register_bool (config, "audio.remember_volume", 0,
+ "restore volume level at startup",
+ "if this not set, xine will not touch any mixer settings at startup",
+ NULL, NULL)) {
+ int prop = 0;
+
+ if((ao_get_capabilities(this)) & AO_CAP_MIXER_VOL)
+ prop = AO_PROP_MIXER_VOL;
+ else if((ao_get_capabilities(this)) & AO_CAP_PCM_VOL)
+ prop = AO_PROP_PCM_VOL;
+
+ ao_set_property(this, prop, vol);
+ }
+ }
+
return this;
}