Chinaunix首页 | 论坛 | 博客
  • 博客访问: 9149933
  • 博文数量: 1727
  • 博客积分: 12961
  • 博客等级: 上将
  • 技术积分: 19860
  • 用 户 组: 普通用户
  • 注册时间: 2009-01-09 11:25
个人简介

偷得浮生半桶水(半日闲), 好记性不如抄下来(烂笔头). 信息爆炸的时代, 学习是一项持续的工作.

文章分类

全部博文(1727)

文章存档

2024年(2)

2023年(26)

2022年(112)

2021年(217)

2020年(157)

2019年(192)

2018年(81)

2017年(78)

2016年(70)

2015年(52)

2014年(40)

2013年(51)

2012年(85)

2011年(45)

2010年(231)

2009年(287)

分类: 其他平台

2018-02-06 11:18:40

命令行 amixer -D hw:1 scontents  show所有的混音控制装置以及其具体内容
Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 87
  Mono: Playback 34 [39%] [-39.75dB] [on]
Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 0 [0%] [-65.25dB] [off]
  Front Right: Playback 0 [0%] [-65.25dB] [off]
Simple mixer control 'PCM',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 255 [100%] [0.00dB]
  Front Right: Playback 255 [100%] [0.00dB]
Simple mixer control 'Front',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 87 [100%] [0.00dB] [on]
  Front Right: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'Front Mic',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Front Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
Simple mixer control 'Surround',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 87 [100%] [0.00dB] [on]
  Front Right: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'Center',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 87
  Mono: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'LFE',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 87
  Mono: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'Line',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Line Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
Simple mixer control 'IEC958',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'IEC958 Default PCM',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Beep',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 63
  Front Left: Capture 38 [60%] [11.25dB] [on]
  Front Right: Capture 38 [60%] [11.25dB] [on]
Simple mixer control 'Capture',1
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 63
  Front Left: Capture 0 [0%] [-17.25dB] [off]
  Front Right: Capture 0 [0%] [-17.25dB] [off]
Simple mixer control 'Auto-Mute Mode',0
  Capabilities: enum
  Items: 'Disabled' 'Enabled'
  Item0: 'Enabled'
Simple mixer control 'Input Source',0
  Capabilities: cenum
  Items: 'Front Mic' 'Rear Mic' 'Line'
  Item0: 'Rear Mic'
Simple mixer control 'Input Source',1
  Capabilities: cenum
  Items: 'Front Mic' 'Rear Mic' 'Line'
  Item0: 'Front Mic'
Simple mixer control 'Loopback Mixing',0
  Capabilities: enum
  Items: 'Disabled' 'Enabled'
  Item0: 'Disabled'
Simple mixer control 'Rear Mic',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Rear Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]


代码 card = "hw:1"
snd_mixer_t *handle;
snd_mixer_open(&handle, 0)
snd_mixer_attach(handle, card)
snd_mixer_selem_register(handle, NULL, NULL)
snd_mixer_load(handle);
##########################################
snd_mixer_elem_t *elem;
snd_mixer_selem_id_t *sid;
snd_mixer_selem_id_alloca(&sid);
for (elem = snd_mixer_first_elem(handle); elem; elem = snd_mixer_elem_next(elem)) {
snd_mixer_selem_get_id(elem, sid);
printf("Simple mixer control '%s',%i\n", snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid));
##########################################
//Capabilities能力部分
if (snd_mixer_selem_has_common_volume(elem) && snd_mixer_selem_has_playback_volume_joined(elem)) printf("音量调节");
if (snd_mixer_selem_has_playback_volume(elem) && snd_mixer_selem_has_playback_volume_joined(elem)) printf("回放音量");
if (snd_mixer_selem_has_capture_volume(elem) && snd_mixer_selem_has_capture_volume_joined(elem)) printf("录音音量");
----------------------------------------------------------------------------------------------------------------
snd_mixer_selem_has_common_switch(elem) && snd_mixer_selem_has_playback_switch_joined(elem) printf("开关"); snd_mixer_selem_has_playback_switch(elem) && snd_mixer_selem_has_playback_switch_joined(elem) printf("功放开关"); snd_mixer_selem_has_capture_switch(elem) && snd_mixer_selem_has_capture_switch_joined(elem) printf("录音开关");


----------------------------------------------------------------------------------------------------------------
snd_mixer_selem_is_enum_playback(elem) 枚举功放选项
snd_mixer_selem_is_enum_capture(elem) 枚举录音选项
snd_mixer_selem_is_enumerated(elem) 普通枚举选项
----------------------------------------------------------------------------------------------------------------
列出枚举选项
char itemname[64];
if (snd_mixer_selem_is_enumerated(elem)) { 
items_cnt = snd_mixer_selem_get_enum_items(elem);
printf("  Items:");
for (i = 0; i < items_cnt; i++) {
snd_mixer_selem_get_enum_item_name(elem, i, sizeof(itemname) - 1, itemname);
printf(" '%s'", itemname);
}
printf("\n");


for (i = 0; !snd_mixer_selem_get_enum_item(elem, i/*channel_id*/, &idx/*the index of selected item*/); i++) {
snd_mixer_selem_get_enum_item_name(elem, idx, sizeof(itemname) - 1, itemname);
printf("  Item%d: '%s'\n", i, itemname);
}
----------------------------------------------------------------------------------------------------------------
//功放 playback/capture channels
if (snd_mixer_selem_has_playback_volume(elem) ||  snd_mixer_selem_has_playback_switch(elem))
printf("Playback channels:");
if (snd_mixer_selem_is_playback_mono(elem)) {
printf(" Mono");
} else {
//扫描所有channel
for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++){
if (!snd_mixer_selem_has_playback_channel(elem, chn))
continue;
printf(" %s - ", snd_mixer_selem_channel_name(chn));
}
}
}
----------------------------------------------------------------------------------------------------------------
//音量
printf("Limits:");
snd_mixer_selem_get_playback_volume_range(elem, &pmin, &pmax);
snd_mixer_selem_get_capture_volume_range(elem, &cmin, &cmax);
printf("Playback %li - %li", pmin, pmax);
printf("Capture  %li - %li", cmin, cmax);

----------------------------------------------------------------------------------------------------------------
功率
    snd_mixer_selem_get_playback_dB_range,
   snd_mixer_selem_get_playback_dB,
    snd_mixer_selem_get_capture_dB( snd_mixer_elem_t * elem,
                        snd_mixer_selem_channel_id_t channel,
                        long * value 
                        )

----------------------------------------------------------------------------------------------------------------
开关
    snd_mixer_selem_get_capture_switch(elem, chn, &csw /*0/1 -> off/on*/);
    
}

阅读(1920) | 评论(0) | 转发(0) |
0

上一篇:amixer (二)

下一篇:amixer (三)

给主人留下些什么吧!~~