linux创建虚拟声卡,修改服务器版linux系统上的dummy虚拟声卡最大声道数
最近在一個項目中需要使用到服務器上的聲卡,當然也不是需要真的物理聲卡(真有物理聲卡,服務器在機房中播放音樂,放電影?)。我們需要的是虛擬語音聲卡,能處理客戶端到服務器的語音流,不需要真正的播放。
我們需要的這個虛擬聲卡,在linux中作為一個內核模塊存在、運行,snd-dummy。
默認的snd-dummy模塊的聲道數是8,遠少于項目需要的聲道數,現在試著將其改到128.
這個模塊現在已經包含在內核模塊中,但它是從alsa-driver包中提取出來的,與其同步,與其重新編譯內核,不如使用alsa-driver包編譯這個模塊。
下載解壓alsa-driver-1.0.23.tar.bz2,轉到alsa-driver-1.0.23/alsa-kernel/drivers,修改dummy.c源文件,第66行,將賦值的8改為128,
static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128};
轉到源碼根目錄,cd alsa-driver-1.0.23,執行configure腳本,
./configure --with-cards=dummy,usb-audio,hda-intel,hrtimer,rtctimer --with-card-options=all
make
find -name *.ko
./pci/hda/snd-hda-codec-intelhdmi.ko
./pci/hda/snd-hda-codec-nvhdmi.ko
./pci/hda/snd-hda-codec-realtek.ko
./pci/hda/snd-hda-codec-idt.ko
./pci/hda/snd-hda-intel.ko
./pci/hda/snd-hda-codec-ca0110.ko
./pci/hda/snd-hda-codec-via.ko
./pci/hda/snd-hda-codec-atihdmi.ko
./pci/hda/snd-hda-codec-conexant.ko
./pci/hda/snd-hda-codec.ko
./pci/hda/snd-hda-codec-cirrus.ko
./pci/hda/snd-hda-codec-si3054.ko
./pci/hda/snd-hda-codec-analog.ko
./pci/hda/snd-hda-codec-cmedia.ko
./usb/snd-usb-audio.ko
./usb/snd-usbmidi-lib.ko
./acore/oss/snd-mixer-oss.ko
./acore/oss/snd-pcm-oss.ko
./acore/seq/oss/snd-seq-oss.ko
./acore/seq/snd-seq-midi.ko
./acore/seq/snd-seq-midi-event.ko
./acore/seq/snd-seq.ko
./acore/seq/snd-seq-device.ko
./acore/snd-hwdep.ko
./acore/snd-page-alloc.ko
./acore/snd-rawmidi.ko
./acore/snd-timer.ko
./acore/snd.ko
./acore/snd-pcm.ko
./drivers/snd-dummy.ko
./modules/snd-hda-codec-intelhdmi.ko
./modules/snd-seq-oss.ko
./modules/snd-hda-codec-nvhdmi.ko
./modules/snd-hwdep.ko
./modules/snd-seq-midi.ko
./modules/snd-hda-codec-realtek.ko
./modules/snd-seq-midi-event.ko
./modules/snd-page-alloc.ko
./modules/snd-hda-codec-idt.ko
./modules/snd-hda-intel.ko
./modules/snd-hda-codec-ca0110.ko
./modules/snd-rawmidi.ko
./modules/snd-usb-audio.ko
./modules/snd-hda-codec-via.ko
./modules/snd-hda-codec-atihdmi.ko
./modules/snd-timer.ko
./modules/snd-mixer-oss.ko
./modules/snd-dummy.ko
./modules/snd-hda-codec-conexant.ko
./modules/snd-hda-codec.ko
./modules/snd-usbmidi-lib.ko
./modules/snd-hda-codec-cirrus.ko
./modules/snd-hda-codec-si3054.ko
./modules/snd.ko
./modules/snd-pcm-oss.ko
./modules/snd-pcm.ko
./modules/snd-seq.ko
./modules/snd-seq-device.ko
./modules/snd-hda-codec-analog.ko
./modules/snd-hda-codec-cmedia.ko
snd-dummy.ko已經編譯好了,首先卸載該內核模塊,
rmmod snd-dummy
把modules/snd-dummy.ko拷貝到/lib/modules/`uname -r`/kernel/sound/drivers/目錄,
加載內核模塊,insmod snd-dummy。
不過這個過程可能需要同時更新其他的模塊,按照相應的目錄存儲結構覆蓋舊版本內核模塊。
直到能正常加載snd-dummy模塊,
最后使用aplay -L, aplay -l命令檢測最新的dummy虛擬聲卡及聲道狀態,
debian118:~/alsa-driver-1.0.23# aplay -L
default:CARD=Dummy
Dummy, Dummy PCM
Default Audio Device
null
Discard all samples (playback) or generate zero samples (capture)
debian118:~/alsa-driver-1.0.23# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Dummy [Dummy], device 0: Dummy PCM [Dummy PCM]
Subdevices: 128/128
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
Subdevice #8: subdevice #8
Subdevice #9: subdevice #9
Subdevice #10: subdevice #10
Subdevice #11: subdevice #11
Subdevice #12: subdevice #12
Subdevice #13: subdevice #13
Subdevice #14: subdevice #14
Subdevice #15: subdevice #15
Subdevice #16: subdevice #16
Subdevice #17: subdevice #17
Subdevice #18: subdevice #18
Subdevice #19: subdevice #19
Subdevice #20: subdevice #20
Subdevice #21: subdevice #21
Subdevice #22: subdevice #22
Subdevice #23: subdevice #23
Subdevice #24: subdevice #24
Subdevice #25: subdevice #25
Subdevice #26: subdevice #26
Subdevice #27: subdevice #27
Subdevice #28: subdevice #28
Subdevice #29: subdevice #29
Subdevice #30: subdevice #30
Subdevice #31: subdevice #31
Subdevice #32: subdevice #32
Subdevice #33: subdevice #33
Subdevice #34: subdevice #34
Subdevice #35: subdevice #35
Subdevice #36: subdevice #36
Subdevice #37: subdevice #37
Subdevice #38: subdevice #38
Subdevice #39: subdevice #39
Subdevice #40: subdevice #40
Subdevice #41: subdevice #41
Subdevice #42: subdevice #42
Subdevice #43: subdevice #43
Subdevice #44: subdevice #44
Subdevice #45: subdevice #45
Subdevice #46: subdevice #46
Subdevice #47: subdevice #47
Subdevice #48: subdevice #48
Subdevice #49: subdevice #49
Subdevice #50: subdevice #50
Subdevice #51: subdevice #51
Subdevice #52: subdevice #52
Subdevice #53: subdevice #53
Subdevice #54: subdevice #54
Subdevice #55: subdevice #55
Subdevice #56: subdevice #56
Subdevice #57: subdevice #57
Subdevice #58: subdevice #58
Subdevice #59: subdevice #59
Subdevice #60: subdevice #60
Subdevice #61: subdevice #61
Subdevice #62: subdevice #62
Subdevice #63: subdevice #63
Subdevice #64: subdevice #64
Subdevice #65: subdevice #65
Subdevice #66: subdevice #66
Subdevice #67: subdevice #67
Subdevice #68: subdevice #68
Subdevice #69: subdevice #69
Subdevice #70: subdevice #70
Subdevice #71: subdevice #71
Subdevice #72: subdevice #72
Subdevice #73: subdevice #73
Subdevice #74: subdevice #74
Subdevice #75: subdevice #75
Subdevice #76: subdevice #76
Subdevice #77: subdevice #77
Subdevice #78: subdevice #78
Subdevice #79: subdevice #79
Subdevice #80: subdevice #80
Subdevice #81: subdevice #81
Subdevice #82: subdevice #82
Subdevice #83: subdevice #83
Subdevice #84: subdevice #84
Subdevice #85: subdevice #85
Subdevice #86: subdevice #86
Subdevice #87: subdevice #87
Subdevice #88: subdevice #88
Subdevice #89: subdevice #89
Subdevice #90: subdevice #90
Subdevice #91: subdevice #91
Subdevice #92: subdevice #92
Subdevice #93: subdevice #93
Subdevice #94: subdevice #94
Subdevice #95: subdevice #95
Subdevice #96: subdevice #96
Subdevice #97: subdevice #97
Subdevice #98: subdevice #98
Subdevice #99: subdevice #99
Subdevice #100: subdevice #100
Subdevice #101: subdevice #101
Subdevice #102: subdevice #102
Subdevice #103: subdevice #103
Subdevice #104: subdevice #104
Subdevice #105: subdevice #105
Subdevice #106: subdevice #106
Subdevice #107: subdevice #107
Subdevice #108: subdevice #108
Subdevice #109: subdevice #109
Subdevice #110: subdevice #110
Subdevice #111: subdevice #111
Subdevice #112: subdevice #112
Subdevice #113: subdevice #113
Subdevice #114: subdevice #114
Subdevice #115: subdevice #115
Subdevice #116: subdevice #116
Subdevice #117: subdevice #117
Subdevice #118: subdevice #118
Subdevice #119: subdevice #119
Subdevice #120: subdevice #120
Subdevice #121: subdevice #121
Subdevice #122: subdevice #122
Subdevice #123: subdevice #123
Subdevice #124: subdevice #124
Subdevice #125: subdevice #125
Subdevice #126: subdevice #126
Subdevice #127: subdevice #127
這時看到系統識別了一個dummy聲卡,走道數為128,完全實現了聲道數修改。
總結
以上是生活随笔為你收集整理的linux创建虚拟声卡,修改服务器版linux系统上的dummy虚拟声卡最大声道数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于笔记本双显卡状态下独立显卡的配置问题
- 下一篇: 虚拟节点dummy