From 460fac74621a6de84f8a66c1dbb164049c9c498b Mon Sep 17 00:00:00 2001 From: arpi_esp Date: Tue, 5 Jun 2001 02:26:56 +0000 Subject: Solaris 8 support - patch by Marcus Comstedt git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1021 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mixer.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'mixer.c') diff --git a/mixer.c b/mixer.c index 74250de9f2..2340179ec0 100644 --- a/mixer.c +++ b/mixer.c @@ -1,14 +1,22 @@ #include #include +#ifdef __sun +#include +#else #include +#endif #include #include #include #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 ); } } -- cgit v1.2.3