2

我刚刚开始研究 android,我正在尝试了解 android 音频子系统 (alsa) 的工作原理。我在 windows-7(64 位)上运行的虚拟框中运行 android 映像。

我正在摆弄 alsa-utils 来录制声音。我试过 alsa_aplay -C -f S16_LE -c 2 -r 44100 -d 5 foo.wav 它说的是: Recording WAVE foo.wav : Signed 16 bit little endian, rate 44100, stereo

但是,创建的输出文件似乎是空白的(在 wav 文件头之后)。

od -x foo.wav

0000000 4952 4646 7574 000d 4157 4556 6d66 2074
0000020 0010 0000 0001 0002 ac44 0000 b110 0002
0000040 0004 0010 6164 6174 7550 000d 0000 0000
0000060 0000 0000 0000 0000 0000 0000 0000 0000
*
3272560 0000 0000 0000 0000 0000 0000
3272574

我还发现这alsa_amixer是段错误。

Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined penum
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
Segmentation fault

alsa_ctlinit 也会引发错误,但会继续执行一些默认配置

Unknown hardware: "ICH" "Sigmatel STAC9700,83,84" "AC97a:83847600" "0x8086" "0x0000"
Hardware is initalized using a guess method

当我检查 alsa 使用的当前配置时,alsa_ctl store -f cur_config.txt 它有capture switch: true并且capture volume: value.0 = 8 & value.1 = 8

的输出alsa_amixer scontrols

Simple mixer control 'Master',0
Simple mixer control 'Master Mono',0
Simple mixer control '3D Control - Switch',0
Simple mixer control '3D Control Sigmatel - Depth',0
Simple mixer control 'PCM',0
Simple mixer control 'PCM Out Path & Mute',0
Simple mixer control 'Surround Phase Inversion',0
Simple mixer control 'Line',0
Simple mixer control 'CD',0
Simple mixer control 'Mic',0
Simple mixer control 'Mic Boost (+20dB)',0
Simple mixer control 'Mic Select',0
Simple mixer control 'Video',0
Simple mixer control 'Phone',0
Simple mixer control 'Beep',0
Simple mixer control 'Aux',0
Simple mixer control 'Mono Output Select',0
Simple mixer control 'Capture',0
Simple mixer control 'Mix',0
Simple mixer control 'Mix Mono',0
Simple mixer control 'External Amplifier',0
Simple mixer control 'Sigmatel 4-Speaker Stereo',0
Simple mixer control 'Sigmatel ADC 6dB Attenuate',0
Simple mixer control 'Sigmatel DAC 6dB Attenuate',0

知道为什么我无法录制吗?

[更新]

vbox 中的默认音频控制器是ICH AC 97. 我将其更改为Intel HD Audio并尝试了相同的操作,并且有效。现在我可以录制声音了。两种情况下的lsmod | grep snd输出都是:

**`ICH AC 97`**
snd_intel8x0 19446 3 - Live 0xf80e9000
snd_ac97_codec 76811 1 snd_intel8x0, Live 0xf80bf000
ac97_bus 730 1 snd_ac97_codec, Live 0xf809a000
snd_pcm 47290 3 snd_intel8x0,snd_ac97_codec, Live 0xf8080000
snd_timer 12553 1 snd_pcm, Live 0xf805f000
snd_page_alloc 4893 2 snd_intel8x0,snd_pcm, Live 0xf804f000

**`Intel HD Audio`**
snd_hda_codec_idt 37680 1 - Live 0xf8108000
snd_hda_intel 16006 3 - Live 0xf80de000
snd_hda_codec 49045 2 snd_hda_codec_idt,snd_hda_intel, Live 0xf80ba000
snd_hwdep 3844 1 snd_hda_codec, Live 0xf809c000
snd_pcm 47290 3 snd_hda_intel,snd_hda_codec, Live 0xf8080000
snd_timer 12553 1 snd_pcm, Live 0xf805f000
snd_page_alloc 4893 2 snd_hda_intel,snd_pcm, Live 0xf804f000

的输出ls /dev/snd也不同:

**ICH AC 97**
controlC0
pcmC0D0c
pcmC0D0p
pcmC0D1c
timer

**Intel HD**
controlC0
hwC0D0
pcmC0D0c
pcmC0D0p
pcmC0D1c
pcmC0D1p
timer

我尝试比较strace -f alsa_aplay -C foo.wav,但在那里找不到任何有用的东西。唯一的区别是,在 ioctl 调用之后,“0000”以第一种情况写入(使用 ICH AC 97),其中一些有意义的数据是用“英特尔高清音频”写入的

这可能是因为某些驱动程序问题吗?

[更新结束]

4

0 回答 0