12 #include "libao2/audio_out.h"
14 extern ao_functions_t
*audio_out
;
16 char * mixer_device
=NULL
;
22 void mixer_getvolume( float *l
,float *r
)
27 if(CONTROL_OK
!= audio_out
->control(AOCONTROL_GET_VOLUME
,&vol
))
34 void mixer_setvolume( float l
,float r
)
37 vol
.right
=r
; vol
.left
=l
;
39 if(CONTROL_OK
!= audio_out
->control(AOCONTROL_SET_VOLUME
,&vol
))
45 #define MIXER_CHANGE 3
47 void mixer_incvolume( void )
49 float mixer_l
, mixer_r
;
50 mixer_getvolume( &mixer_l
,&mixer_r
);
51 mixer_l
+= MIXER_CHANGE
;
52 if ( mixer_l
> 100 ) mixer_l
= 100;
53 mixer_r
+= MIXER_CHANGE
;
54 if ( mixer_r
> 100 ) mixer_r
= 100;
55 mixer_setvolume( mixer_l
,mixer_r
);
58 void mixer_decvolume( void )
60 float mixer_l
, mixer_r
;
61 mixer_getvolume( &mixer_l
,&mixer_r
);
62 mixer_l
-= MIXER_CHANGE
;
63 if ( mixer_l
< 0 ) mixer_l
= 0;
64 mixer_r
-= MIXER_CHANGE
;
65 if ( mixer_r
< 0 ) mixer_r
= 0;
66 mixer_setvolume( mixer_l
,mixer_r
);
69 float mixer_getbothvolume( void )
71 float mixer_l
, mixer_r
;
72 mixer_getvolume( &mixer_l
,&mixer_r
);
73 return ( mixer_l
+ mixer_r
) / 2;
76 void mixer_mute( void )
78 if ( muted
) mixer_setvolume( mute_l
,mute_r
);
81 mixer_getvolume( &mute_l
,&mute_r
);
82 mixer_setvolume( 0,0 );