#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int iRightVol = 0;
char ucCmdBuf[128] = {0};
int iLeftVol = 0;
iLeftVol = atoi(argv[1]);
iRightVol = atoi(argv[2]);
printf("########## iRightVol is %d , iLeft is %d #########\n", iRightVol, iLeftVol);
system("i2cset -f -y 1 0x18 0x5d 0x99 b");
system("i2cset -f -y 1 0x18 0x5b 0x99 b");
sprintf(ucCmdBuf, "amixer cset numid=2 '%d,%d'", iLeftVol, iRightVol);
printf("######## %s #############\n", ucCmdBuf);
system(ucCmdBuf);
system("i2cget -f -y 1 0x18 0x5d b");
system("i2cget -f -y 1 0x18 0x5b b");
return 0;
}
amixer 左右通道音量设置
最新推荐文章于 2023-07-28 10:18:33 发布
本文展示了一个使用C语言编写的简单程序,该程序通过解析命令行参数来调整音量。程序利用了i2cset和amixer命令来实现对左右声道音量的设置,并通过system函数执行这些命令。
3012

被折叠的 条评论
为什么被折叠?



