summaryrefslogtreecommitdiffstats
path: root/mixer.c
diff options
context:
space:
mode:
authorarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-06-05 02:26:56 +0000
committerarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-06-05 02:26:56 +0000
commit460fac74621a6de84f8a66c1dbb164049c9c498b (patch)
treed079ba1b222de14ed0b4d590e13ae5719c3ff898 /mixer.c
parent72cfe9c77c1b0c5b26e941fdc33c2dfa9ce33129 (diff)
downloadmpv-460fac74621a6de84f8a66c1dbb164049c9c498b.tar.bz2
mpv-460fac74621a6de84f8a66c1dbb164049c9c498b.tar.xz
Solaris 8 support - patch by Marcus Comstedt <marcus@idonex.se>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1021 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mixer.c')
-rw-r--r--mixer.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/mixer.c b/mixer.c
index 74250de9f2..2340179ec0 100644
--- a/mixer.c
+++ b/mixer.c
@@ -1,14 +1,22 @@
#include <string.h>
#include <sys/ioctl.h>
+#ifdef __sun
+#include <sys/audioio.h>
+#else
#include <sys/soundcard.h>
+#endif
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include "mixer.h"
+#ifdef __sun
+char * mixer_device="/dev/audioctl";
+#else
char * mixer_device="/dev/mixer";
+#endif
int mixer_usemaster=0;
void mixer_getvolume( int *l,int *r )
@@ -18,6 +26,11 @@ void mixer_getvolume( int *l,int *r )
fd=open( mixer_device,O_RDONLY );
if ( fd != -1 )
{
+#ifdef __sun
+ audio_info_t info;
+ ioctl( fd,AUDIO_GETINFO,&info );
+ *r=*l=(info.play.gain * 100 + (AUDIO_MAX_GAIN-1))/AUDIO_MAX_GAIN;
+#else
ioctl( fd,SOUND_MIXER_READ_DEVMASK,&devs );
if ( ( devs & SOUND_MASK_PCM ) && ( mixer_usemaster==0 ) ) cmd=SOUND_MIXER_READ_PCM;
else
@@ -30,6 +43,7 @@ void mixer_getvolume( int *l,int *r )
ioctl( fd,cmd,&v );
*r=( v & 0xFF00 ) >> 8;
*l=( v & 0x00FF );
+#endif
close( fd );
}
}
@@ -41,6 +55,12 @@ void mixer_setvolume( int l,int r )
fd=open( mixer_device,O_RDONLY );
if ( fd != -1 )
{
+#ifdef __sun
+ audio_info_t info;
+ ioctl( fd,AUDIO_GETINFO,&info );
+ info.play.gain = ((l+r)*AUDIO_MAX_GAIN+199)/200;
+ ioctl( fd,AUDIO_SETINFO,&info );
+#else
ioctl( fd,SOUND_MIXER_READ_DEVMASK,&devs );
if ( ( devs & SOUND_MASK_PCM ) && ( mixer_usemaster==0 ) ) cmd=SOUND_MIXER_WRITE_PCM;
else
@@ -52,6 +72,7 @@ void mixer_setvolume( int l,int r )
}
v=( r << 8 ) | l;
ioctl( fd,cmd,&v );
+#endif
close( fd );
}
}