设置音量的程序
#include
#include
#include
#include
#define ARM
int main(int argc, char *argv[])
{
int volume_read,volume_write,mixerfd;
if(argc != 3){
printf("usage: %s volume_write volume_read\n", argv[0]);
printf("example: %s 30 50\n",argv[0]);
exit(-1);
}
volume_write = atoi(argv[1]);
volume_read = atoi(argv[2]);
if(volume_write <0 || volume_write > 100)
volume_write = 30;
if(volume_read < 0 || volume_read >100)
volume_read = 30;
#ifdef ARM
mixerfd = open("/dev/mixer", O_RDWR);
#else
mixerfd = open("/dev/mixer", O_RDWR);
#endif
if(mixerfd < 0){
perror("Mixer open error !");
exit(-1);
}
ioctl(mixerfd,SOUND_MIXER_WRITE_VOLUME,&volume_write);
ioctl(mixerfd,SOUND_MIXER_READ_VOLUME,&volume_read);
close(mixerfd);
return
}
参考文献
阅读(1806) | 评论(0) | 转发(0) |