Opened 12 years ago

Closed 8 years ago

#10695 closed defect (obsolete)

[PATCH] OSS Audio driver uses wrong volume for recording, making recording in guest practically impossible if it is used

Reported by: Y.K. Owned by:
Component: audio Version: VirtualBox 4.1.16
Keywords: audio oss recording Cc:
Guest type: all Host type: other

Description (last modified by Frank Mehnert)

When recording in guest while OSS audio driver is used, nothing is recieved. This affects the FreeBSD and Solaris hosts, and also Linux hosts under certain configurations.

src/VBox/Devices/Audio/ossaudio.c includes the following:

#ifndef VBOX

hw->conv (hw->conv_buf + bufs[i].add, p, nread >> hwshift,



hw->conv (hw->conv_buf + bufs[i].add, p, nread >> hwshift,



VBox is usually defined when compiling, so pcm_in_volume is used. But pcm_in_volume is almost never set (it's set by the AUD_set_volume() method which is almost never called - only the SB16 driver calls it [The ICH driver also has it, but under an #ifdef which is not usually defined]). So pcm_in_volume is zero, and programs on the guest recieve nothing at all...

The suggested fix is to do like most other audio drivers (ALSA and Pulse's drivers come to mind) and use nominal_volume exclusively. The patch below has been tested and fixes the problem on my end and for another user. Note that some other drivers use pcm_in_volume (solaudio.c and dsoundaudio.c) and may require this change as well.

--- ossaudio.c.old	2012-06-22 23:29:17.854555530 +0300
+++ ossaudio.c	2012-06-22 23:38:53.797799295 +0300
@@ -795,13 +795,8 @@
                            hw->info.align + 1);
                 read_samples += nread >> hwshift;
-#ifndef VBOX
                 hw->conv (hw->conv_buf + bufs[i].add, p, nread >> hwshift,
-                hw->conv (hw->conv_buf + bufs[i].add, p, nread >> hwshift,
-                          &pcm_in_volume);
             if (bufs[i].len - nread) {

Attachments (1)

ossaudio.diff (573 bytes ) - added by Y.K. 12 years ago.
Recording fix patch for ossaudio.c

Download all attachments as: .zip

Change History (3)

by Y.K., 12 years ago

Attachment: ossaudio.diff added

Recording fix patch for ossaudio.c

comment:1 by Frank Mehnert, 12 years ago

Description: modified (diff)

Your observation is partly correct. It is true that other backends use the nominal_volume rather than the pcm_in_volume. But it is not true that pcm_in_volume is not changed. It is set in DevIchAc97 using set_volume(s, index, AUD_MIXER_LINE_IN, u32) and this just corresponds to the line-in mixer of the guest. The current behavior is that with OSS, the line-in mixer has to be set accordingly to get a proper recording volume. This is not necessary with other backends. I have to think what's the correct solution here.

comment:2 by aeichner, 8 years ago

Resolution: obsolete
Status: newclosed

Please reopen if still relevant with a recent VirtualBox release.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use