Mercurial > mplayer.hg
annotate mixer.c @ 12252:ab8c13d3fca1
wording
author | diego |
---|---|
date | Thu, 22 Apr 2004 12:19:55 +0000 |
parents | 4e8f8efb6906 |
children | 9709ce101949 |
rev | line source |
---|---|
441 | 1 |
2 #include <string.h> | |
9772 | 3 #ifndef __MINGW32__ |
441 | 4 #include <sys/ioctl.h> |
9772 | 5 #endif |
441 | 6 #include <fcntl.h> |
7 #include <stdio.h> | |
605 | 8 #include <unistd.h> |
441 | 9 |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
10 #include "config.h" |
441 | 11 #include "mixer.h" |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
12 #include "libao2/audio_out.h" |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
13 |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
14 extern ao_functions_t *audio_out; |
1061 | 15 |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
16 char * mixer_device=NULL; |
11837 | 17 char * mixer_channel=NULL; |
441 | 18 |
6311
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
4788
diff
changeset
|
19 int muted = 0; |
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
4788
diff
changeset
|
20 float mute_l = 0.0f; |
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
4788
diff
changeset
|
21 float mute_r = 0.0f; |
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
4788
diff
changeset
|
22 |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
23 void mixer_getvolume( float *l,float *r ) |
441 | 24 { |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
25 ao_control_vol_t vol; |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
26 *l=0; *r=0; |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
27 if(audio_out){ |
9633
12b1790038b0
64bit libao2 fix by Jens Axboe <mplayer-dev@kernel.dk>
alex
parents:
6311
diff
changeset
|
28 if(CONTROL_OK != audio_out->control(AOCONTROL_GET_VOLUME,&vol)) |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
29 return; |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
30 *r=vol.right; |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
31 *l=vol.left; |
441 | 32 } |
33 } | |
34 | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
35 void mixer_setvolume( float l,float r ) |
441 | 36 { |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
37 ao_control_vol_t vol; |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
38 vol.right=r; vol.left=l; |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
39 if(audio_out){ |
9633
12b1790038b0
64bit libao2 fix by Jens Axboe <mplayer-dev@kernel.dk>
alex
parents:
6311
diff
changeset
|
40 if(CONTROL_OK != audio_out->control(AOCONTROL_SET_VOLUME,&vol)) |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
41 return; |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
42 } |
6311
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
4788
diff
changeset
|
43 muted=0; |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
44 } |
1061 | 45 |
1881
d75b24bda7ce
Applied fix for mixercontrol w/alsa ossemu by Christian Ohm.
atmos4
parents:
1061
diff
changeset
|
46 #define MIXER_CHANGE 3 |
441 | 47 |
48 void mixer_incvolume( void ) | |
49 { | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
50 float mixer_l, mixer_r; |
441 | 51 mixer_getvolume( &mixer_l,&mixer_r ); |
1881
d75b24bda7ce
Applied fix for mixercontrol w/alsa ossemu by Christian Ohm.
atmos4
parents:
1061
diff
changeset
|
52 mixer_l += MIXER_CHANGE; |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
53 if ( mixer_l > 100 ) mixer_l = 100; |
1881
d75b24bda7ce
Applied fix for mixercontrol w/alsa ossemu by Christian Ohm.
atmos4
parents:
1061
diff
changeset
|
54 mixer_r += MIXER_CHANGE; |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
55 if ( mixer_r > 100 ) mixer_r = 100; |
441 | 56 mixer_setvolume( mixer_l,mixer_r ); |
57 } | |
58 | |
59 void mixer_decvolume( void ) | |
60 { | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
61 float mixer_l, mixer_r; |
441 | 62 mixer_getvolume( &mixer_l,&mixer_r ); |
1881
d75b24bda7ce
Applied fix for mixercontrol w/alsa ossemu by Christian Ohm.
atmos4
parents:
1061
diff
changeset
|
63 mixer_l -= MIXER_CHANGE; |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
64 if ( mixer_l < 0 ) mixer_l = 0; |
1881
d75b24bda7ce
Applied fix for mixercontrol w/alsa ossemu by Christian Ohm.
atmos4
parents:
1061
diff
changeset
|
65 mixer_r -= MIXER_CHANGE; |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
66 if ( mixer_r < 0 ) mixer_r = 0; |
441 | 67 mixer_setvolume( mixer_l,mixer_r ); |
68 } | |
69 | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
70 float mixer_getbothvolume( void ) |
441 | 71 { |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
72 float mixer_l, mixer_r; |
441 | 73 mixer_getvolume( &mixer_l,&mixer_r ); |
74 return ( mixer_l + mixer_r ) / 2; | |
75 } | |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
76 |
6311
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
4788
diff
changeset
|
77 void mixer_mute( void ) |
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
4788
diff
changeset
|
78 { |
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
4788
diff
changeset
|
79 if ( muted ) mixer_setvolume( mute_l,mute_r ); |
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
4788
diff
changeset
|
80 else |
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
4788
diff
changeset
|
81 { |
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
4788
diff
changeset
|
82 mixer_getvolume( &mute_l,&mute_r ); |
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
4788
diff
changeset
|
83 mixer_setvolume( 0,0 ); |
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
4788
diff
changeset
|
84 muted=1; |
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
4788
diff
changeset
|
85 } |
da2dda48b7ec
add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents:
4788
diff
changeset
|
86 } |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
87 |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
88 |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
89 |