Mercurial > mplayer.hg
annotate mixer.c @ 5503:a531a579f005
#include cleanup
author | arpi |
---|---|
date | Sat, 06 Apr 2002 19:09:06 +0000 |
parents | d678ce495a75 |
children | da2dda48b7ec |
rev | line source |
---|---|
441 | 1 |
2 #include <string.h> | |
3 #include <sys/ioctl.h> | |
4 #include <fcntl.h> | |
5 #include <stdio.h> | |
605 | 6 #include <unistd.h> |
441 | 7 |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
8 #include "config.h" |
441 | 9 #include "mixer.h" |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
10 #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
|
11 |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
12 extern ao_functions_t *audio_out; |
1061 | 13 |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
14 char * mixer_device=NULL; |
441 | 15 |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
16 void mixer_getvolume( float *l,float *r ) |
441 | 17 { |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
18 ao_control_vol_t vol; |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
19 *l=0; *r=0; |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
20 if(audio_out){ |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
21 if(CONTROL_OK != audio_out->control(AOCONTROL_GET_VOLUME,(int)&vol)) |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
22 return; |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
23 *r=vol.right; |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
24 *l=vol.left; |
441 | 25 } |
26 } | |
27 | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
28 void mixer_setvolume( float l,float r ) |
441 | 29 { |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
30 ao_control_vol_t vol; |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
31 vol.right=r; vol.left=l; |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
32 if(audio_out){ |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
33 if(CONTROL_OK != audio_out->control(AOCONTROL_SET_VOLUME,(int)&vol)) |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
34 return; |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
35 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
36 } |
1061 | 37 |
1881
d75b24bda7ce
Applied fix for mixercontrol w/alsa ossemu by Christian Ohm.
atmos4
parents:
1061
diff
changeset
|
38 #define MIXER_CHANGE 3 |
441 | 39 |
40 void mixer_incvolume( void ) | |
41 { | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
42 float mixer_l, mixer_r; |
441 | 43 mixer_getvolume( &mixer_l,&mixer_r ); |
1881
d75b24bda7ce
Applied fix for mixercontrol w/alsa ossemu by Christian Ohm.
atmos4
parents:
1061
diff
changeset
|
44 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
|
45 if ( mixer_l > 100 ) mixer_l = 100; |
1881
d75b24bda7ce
Applied fix for mixercontrol w/alsa ossemu by Christian Ohm.
atmos4
parents:
1061
diff
changeset
|
46 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
|
47 if ( mixer_r > 100 ) mixer_r = 100; |
441 | 48 mixer_setvolume( mixer_l,mixer_r ); |
49 } | |
50 | |
51 void mixer_decvolume( void ) | |
52 { | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
53 float mixer_l, mixer_r; |
441 | 54 mixer_getvolume( &mixer_l,&mixer_r ); |
1881
d75b24bda7ce
Applied fix for mixercontrol w/alsa ossemu by Christian Ohm.
atmos4
parents:
1061
diff
changeset
|
55 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
|
56 if ( mixer_l < 0 ) mixer_l = 0; |
1881
d75b24bda7ce
Applied fix for mixercontrol w/alsa ossemu by Christian Ohm.
atmos4
parents:
1061
diff
changeset
|
57 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
|
58 if ( mixer_r < 0 ) mixer_r = 0; |
441 | 59 mixer_setvolume( mixer_l,mixer_r ); |
60 } | |
61 | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
62 float mixer_getbothvolume( void ) |
441 | 63 { |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
64 float mixer_l, mixer_r; |
441 | 65 mixer_getvolume( &mixer_l,&mixer_r ); |
66 return ( mixer_l + mixer_r ) / 2; | |
67 } | |
4788
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
68 |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
69 |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
70 |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
71 |
d678ce495a75
Moved HW dependent mixer stuff to libao and removed master switch
anders
parents:
4749
diff
changeset
|
72 |