VirtualBox

Opened 14 years ago

Closed 13 years ago

#5578 closed defect (fixed)

Sound shuts off when VM out of focus

Reported by: AlanK Owned by:
Component: audio Version: VirtualBox 3.2.8
Keywords: Cc:
Guest type: Windows Host type: Windows

Description

When playing a video or something in the VM, then click on a window outside the VM, sound shuts off in the VM. Sometimes clicking on the VM will restore the sound but sometimes not.

Change History (8)

in reply to:  description comment:1 by pgeek, 14 years ago

This behaviour also occurs for Linux guests running under a Windows 7 host with 3.1.2.

Only some focus changes halt the VM sound, though: games, foobar2000, Steam. As soon as the offending application is shut, the VM sound returns without further action needed.

comment:2 by pgeek, 14 years ago

Some of these issues could probably be solved by changing the flags used to create the sound buffer in the DirectSound audio driver code.

Adding the DSBCAPS_GLOBALFOCUS flag should be enough:

--- src/VBox/Devices/Audio/dsoundaudio.c.orig	2009-12-17 14:27:41.000000000 +0000
+++ src/VBox/Devices/Audio/dsoundaudio.c	2009-12-24 13:07:20.431769153 +0000
@@ -568,7 +568,7 @@
 
     memset (&dsbd, 0, sizeof (dsbd));
     dsbd.dwSize = sizeof (dsbd);
-    dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER;
+    dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_GLOBALFOCUS;
     dsbd.dwBufferBytes = 0;
     dsbd.lpwfxFormat = NULL;
 

comment:3 by Frank Mehnert, 14 years ago

Component: otheraudio
priority: criticalmajor

The question is if this behavior is a bug or a feature ... Surely this isn't critical.

comment:4 by michaln, 14 years ago

This is not so much a bug as the default DirectSound behavior. It is not true that switching focus to another window automatically stops the VM sound. It is true that switching to another application which uses DirectSound will stop the VM sound; that is because VirtualBox currently uses the DSBCAPS_STICKYFOCUS setting for its sound buffer. For example on my system, switching focus to a command prompt or to Acrobat Reader does not stop the VM from playing, but switching to Firefox does.

Giving focus to the VM again does restore the audio, unless of course there is another application using the write-primary DirectSound cooperative level.

comment:5 by pgeek, 14 years ago

As for being either a feature or bug, the fact that the issue has been reported could be an indication of a reasonable expectation - from some users at least - that if you are using the VM to play sound it should not depend on it having focus or on the applications running on the host. Hence the suggestion to depart from the default DirectSound behaviour.

comment:6 by Frank Mehnert, 14 years ago

Version: VirtualBox 3.0.8VirtualBox 3.2.8

Sure but the experience shows that changing such behavior is appreciated by some users and heavily disliked by others. Though we will change this behavior in the next major release as this is the standard behavior on other hosts (Linux, Mac OS X) as well.

comment:7 by pgeek, 14 years ago

Agreed. You can also try to please everyone by making it configurable, although at a much higher development cost. Glad to know about the planned behaviour change anyway.

comment:8 by Frank Mehnert, 13 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use