summaryrefslogtreecommitdiffstats
path: root/libao2/ao_sun.c
diff options
context:
space:
mode:
authoranders <anders@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-21 16:02:26 +0000
committeranders <anders@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-21 16:02:26 +0000
commitee2ed8567e3401469fcf13eb96e42d79c4b32714 (patch)
tree90bb902bb5f99813bba6b2bd07ff6620a0d39e0a /libao2/ao_sun.c
parentea1d75800931055c8a04cf76e8b6c914c2ed3e23 (diff)
downloadmpv-ee2ed8567e3401469fcf13eb96e42d79c4b32714.tar.bz2
mpv-ee2ed8567e3401469fcf13eb96e42d79c4b32714.tar.xz
Moved HW dependent mixer stuff to libao and removed master switch
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4789 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2/ao_sun.c')
-rw-r--r--libao2/ao_sun.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/libao2/ao_sun.c b/libao2/ao_sun.c
index 8de1e6bdf0..874a0db6d6 100644
--- a/libao2/ao_sun.c
+++ b/libao2/ao_sun.c
@@ -15,6 +15,7 @@
#endif
#include "../config.h"
+#include "../mixer.h"
#include "audio_out.h"
#include "audio_out_internal.h"
@@ -42,6 +43,7 @@ LIBAO_EXTERN(sun)
#endif
+static char *sun_mixer_device="/dev/audioctl";
static char *audio_dev = NULL;
static int queued_bursts = 0;
static int queued_samples = 0;
@@ -214,6 +216,37 @@ static int control(int cmd,int arg){
return CONTROL_OK;
case AOCONTROL_QUERY_FORMAT:
return CONTROL_TRUE;
+ case AOCONTROL_GET_VOLUME:
+ {
+ int fd,v,cmd,devs;
+
+ fd=open( sun_mixer_device,O_RDONLY );
+ if ( fd != -1 )
+ {
+ struct audio_info info;
+ ioctl( fd,AUDIO_GETINFO,&info);
+ ((ao_control_vol_t*)(arg))->left=info.play.gain * 100. / AUDIO_MAX_GAIN;
+ ((ao_control_vol_t*)(arg))->=info.play.gain * 100. / AUDIO_MAX_GAIN;
+ close( fd );
+ return CONTROL_OK;
+ }
+ return CONTROL_ERROR;
+ }
+ case AOCONTROL_SET_VOLUME:
+ {
+ int fd,v,cmd,devs;
+
+ fd=open( sun_mixer_device,O_RDONLY );
+ if ( fd != -1 )
+ {
+ struct audio_info info;
+ AUDIO_INITINFO(&info);
+ info.play.gain = (r+l) * AUDIO_MAX_GAIN / 100 / 2;
+ ioctl( fd,AUDIO_SETINFO,&info );
+ close( fd );
+ return CONTROL_OK;
+ }
+ return CONTROL_ERROR;
}
return CONTROL_UNKNOWN;
}
@@ -225,6 +258,9 @@ static int init(int rate,int channels,int format,int flags){
audio_info_t info;
int ok;
+ if(mixer_device)
+ sun_mixer_device=mixer_device;
+
if (audio_dev == NULL) {
if ((audio_dev = getenv("AUDIODEV")) == NULL)
audio_dev = "/dev/audio";