[SOLVED] using ALSA with dmix plugin (no audio in WnXP host)

Discussions related to using VirtualBox on Linux hosts.
Post Reply
m27315
Posts: 9
Joined: 17. Jun 2009, 15:38
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Windows XP SP3
Contact:

[SOLVED] using ALSA with dmix plugin (no audio in WnXP host)

Post by m27315 »

Hi,

I am using VBox 2.2.4 on a Gentoo host with a Windows XP SP3 host. Most everything is working great, except audio and copy/paste. I found this ticket, which explained the first part of audio problem:

http://www.virtualbox.org/ticket/1908

My sound card (EchoAudio Mia) does not have an integrated mixer, so I have to run all sound through dmix. My .asoundrc file looks like:

Code: Select all

pcm.!default {
    type plug
    slave.pcm "dmix"
}
pcm.mia0 {
    type hw
    card 0
    device 0
    subdevice 0
}
ctl.mia0 {
    type hw
    card 0
    device 0
    subdevice 0
}
pcm.mia2 {
    type hw
    card 0
    device 0
    subdevice 2
}
ctl.mia2 {
    type hw
    card 0
    device 0
    subdevice 2
}
pcm.mias0 {
    type plug
    slave.pcm "hw:0,0,0"
}
pcm.mias2 {
    type plug
    slave.pcm "hw:0,0,2"
}
ctl.mias2 {
    type plug
    slave.pcm "hw:0,0,2"
}
This works fine for most situations, allowing me to simultaneously play sound from multiple applications. However, based on the above ticket, it appears that VBox may want some exclusive lock, such that the ALSA dmix plug-in is not a suitable sound sink. I have tried using various settings for VBOX_ALSA_ADC_DEV and VBOX_ALSA_ADC_DEV with varying results. This one looks the most promising:

Code: Select all

$ export VBOX_ALSA_ADC_DEV="hw:0,0" ; export VBOX_ALSA_DAC_DEV="hw:0,0,2" ; VBoxManage startvm "Windows XP SP2"; sleep 3 ; grep -Pi '(alsa|audio)' VBox.log

VirtualBox Command Line Management Interface Version 2.2.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Waiting for the remote session to open...
Remote session has been successfully opened.
00:00:00.789 [/Devices/AudioSniffer/] (level 2)
00:00:00.789 [/Devices/AudioSniffer/0/] (level 3)
00:00:00.790 [/Devices/AudioSniffer/0/Config/] (level 4)
00:00:00.790 [/Devices/AudioSniffer/0/LUN#0/] (level 4)
00:00:00.790   Driver <string>  = "MainAudioSniffer" (cch=17)
00:00:00.790 [/Devices/AudioSniffer/0/LUN#0/Config/] (level 5)
00:00:00.790   Driver <string>  = "AUDIO" (cch=6)
00:00:00.790   AudioDriver <string>  = "alsa" (cch=5)
00:00:01.074 Audio: Trying driver 'alsa'.
00:00:01.074 Audio: set_record_source ars=0 als=0 (not implemented)
00:00:01.076 ALSA: ADC frequency 44100Hz, period size 0, buffer size 140248307574777
00:00:01.076 ALSA: DAC frequency 44100Hz, period size 0, buffer size 140248302193152
However, the sound produced by the WinXP guest is garbled, because the frequency is set to 44.1kHz and the Mia is a 96kHz card.

Does anyone know how to tell VBox & ALSA to use 96 kHz for the ADC and DAC?

I have tried using slave devices, where I could set the rate, but that completely fails (ultimately uses NULL - no sound):

Code: Select all

export VBOX_ALSA_ADC_DEV="hw:0,0" ; export VBOX_ALSA_DAC_DEV="plug:mias2" ; VBoxManage startvm "Windows XP SP2"; sleep 3 ; grep -Pi '(alsa|audio)' VBox.log

VirtualBox Command Line Management Interface Version 2.2.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Waiting for the remote session to open...
Remote session has been successfully opened.
00:00:00.756 [/Devices/AudioSniffer/] (level 2)
00:00:00.756 [/Devices/AudioSniffer/0/] (level 3)
00:00:00.756 [/Devices/AudioSniffer/0/Config/] (level 4)
00:00:00.756 [/Devices/AudioSniffer/0/LUN#0/] (level 4)
00:00:00.756   Driver <string>  = "MainAudioSniffer" (cch=17)
00:00:00.756 [/Devices/AudioSniffer/0/LUN#0/Config/] (level 5)
00:00:00.756   Driver <string>  = "AUDIO" (cch=6)
00:00:00.756   AudioDriver <string>  = "alsa" (cch=5)
00:00:01.033 Audio: Trying driver 'alsa'.
00:00:01.033 Audio: set_record_source ars=0 als=0 (not implemented)
00:00:01.035 ALSA: ADC frequency 44100Hz, period size 0, buffer size 140593281116153
00:00:01.035 ALSA: ADC frequency 44100Hz, period size 25769803776, buffer size 140593070080000
00:00:01.043 ALSA: Failed to apply audio parameters
00:00:01.051 ALSA: Failed to apply audio parameters
00:00:01.051 ALSA: ADC frequency 44100Hz, period size 0, buffer size 256
00:00:01.051 VM: Raising runtime error 'HostAudioNotResponding' (fFlags=0x0)
00:00:01.051 Console: VM runtime error: fatal=false, errorID=HostAudioNotResponding message="Some audio devices (PCM_in, PCM_out) could not be opened. Guest applications generating audio output or depending on audio input may hang. Make sure your host audio device is working properly. Check the logfile for error messages of the audio subsystem"
Any suggestions? I am almost there - just need a little help on setting the rate correctly via the .asoundrc file or global variables, I think. :)

Thanks!
Last edited by m27315 on 17. Jun 2009, 19:05, edited 1 time in total.
m27315
Posts: 9
Joined: 17. Jun 2009, 15:38
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Windows XP SP3
Contact:

blame it on the Enlightened Sound Daemon (ESD)

Post by m27315 »

Apparently the problem was that I had too many sound daemons installed, which was confusing lbsdl. I disabled the "esd" USE flag for Gentoo and updated (emerge -uDN world). See the tip here:

http://forums.gentoo.org/viewtopic-p-57 ... ml#5714588

Also, I misunderstood the dmix complication. Using dmix as the default playback device is fine. The only problem occurs for capture, hence the need to set only the ADC (capture/input: Analog to Digital Converter) versus the DAC (playback/outpu: Digital to Analog Converter). After updating libsdl, I was able to playback and record audio using the following start-up:

Code: Select all

$ unset VBOX_ALSA_DAC_DEV ; export VBOX_ALSA_ADC_DEV="hw:0,0" ; VBoxManage startvm "Windows XP SP2"; sleep 3 ; grep -Pi '(alsa|audio)' VBox.log

VirtualBox Command Line Management Interface Version 2.2.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Waiting for the remote session to open...
Remote session has been successfully opened.
00:00:00.795 [/Devices/AudioSniffer/] (level 2)
00:00:00.795 [/Devices/AudioSniffer/0/] (level 3)
00:00:00.795 [/Devices/AudioSniffer/0/Config/] (level 4)
00:00:00.795 [/Devices/AudioSniffer/0/LUN#0/] (level 4)
00:00:00.795   Driver <string>  = "MainAudioSniffer" (cch=17)
00:00:00.795 [/Devices/AudioSniffer/0/LUN#0/Config/] (level 5)
00:00:00.795   Driver <string>  = "AUDIO" (cch=6)
00:00:00.795   AudioDriver <string>  = "alsa" (cch=5)
00:00:01.078 Audio: Trying driver 'alsa'.
00:00:01.081 Audio: set_record_source ars=0 als=0 (not implemented)
00:00:01.083 ALSA: ADC frequency 44100Hz, period size 1024, buffer size 4096
00:00:01.086 ALSA: DAC frequency 44100Hz, period size 940, buffer size 3763
My .asoundrc file is much simpler now too!

Code: Select all

pcm.!default {
    type plug
    slave.pcm "dmix"
}
pcm.dsp0 {
    type plug
    slave.pcm "dmix"
}
ctl.mixer0 {
    type hw
    card 0
}
Hope this helps someone else!
Post Reply