Opened 12 years ago
Last modified 8 years ago
#10695 closed defect
[PATCH] OSS Audio driver uses wrong volume for recording, making recording in guest practically impossible if it is used — at Initial Version
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
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,
&nominal_volume);
#else
hw->conv (hw->conv_buf + bufs[i].add, p, nread >> hwshift,
&pcm_in_volume);
#endif
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,
&nominal_volume);
-#else
- hw->conv (hw->conv_buf + bufs[i].add, p, nread >> hwshift,
- &pcm_in_volume);
-#endif
}
if (bufs[i].len - nread) {
Recording fix patch for ossaudio.c