Mercurial > mplayer.hg
comparison mixer.c @ 6311:da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
author | pontscho |
---|---|
date | Thu, 06 Jun 2002 07:13:57 +0000 |
parents | d678ce495a75 |
children | 12b1790038b0 |
comparison
equal
deleted
inserted
replaced
6310:eda1e909a3bf | 6311:da2dda48b7ec |
---|---|
10 #include "libao2/audio_out.h" | 10 #include "libao2/audio_out.h" |
11 | 11 |
12 extern ao_functions_t *audio_out; | 12 extern ao_functions_t *audio_out; |
13 | 13 |
14 char * mixer_device=NULL; | 14 char * mixer_device=NULL; |
15 | |
16 int muted = 0; | |
17 float mute_l = 0.0f; | |
18 float mute_r = 0.0f; | |
15 | 19 |
16 void mixer_getvolume( float *l,float *r ) | 20 void mixer_getvolume( float *l,float *r ) |
17 { | 21 { |
18 ao_control_vol_t vol; | 22 ao_control_vol_t vol; |
19 *l=0; *r=0; | 23 *l=0; *r=0; |
31 vol.right=r; vol.left=l; | 35 vol.right=r; vol.left=l; |
32 if(audio_out){ | 36 if(audio_out){ |
33 if(CONTROL_OK != audio_out->control(AOCONTROL_SET_VOLUME,(int)&vol)) | 37 if(CONTROL_OK != audio_out->control(AOCONTROL_SET_VOLUME,(int)&vol)) |
34 return; | 38 return; |
35 } | 39 } |
40 muted=0; | |
36 } | 41 } |
37 | 42 |
38 #define MIXER_CHANGE 3 | 43 #define MIXER_CHANGE 3 |
39 | 44 |
40 void mixer_incvolume( void ) | 45 void mixer_incvolume( void ) |
64 float mixer_l, mixer_r; | 69 float mixer_l, mixer_r; |
65 mixer_getvolume( &mixer_l,&mixer_r ); | 70 mixer_getvolume( &mixer_l,&mixer_r ); |
66 return ( mixer_l + mixer_r ) / 2; | 71 return ( mixer_l + mixer_r ) / 2; |
67 } | 72 } |
68 | 73 |
74 void mixer_mute( void ) | |
75 { | |
76 if ( muted ) mixer_setvolume( mute_l,mute_r ); | |
77 else | |
78 { | |
79 mixer_getvolume( &mute_l,&mute_r ); | |
80 mixer_setvolume( 0,0 ); | |
81 muted=1; | |
82 } | |
83 } | |
69 | 84 |
70 | 85 |
71 | 86 |
72 |