Sound in remote desktop does not work after a disconnect/reconnect,
Members - Reputation: 102
Posted 21 August 2012 - 04:35 PM
This is more of a feedback/general question than any kind of specific problem... kind of. A while ago I wrote a sound engine with SlimDX. While writing it, it was pointed out to me that I was creating a new XAudio2 device and mastering voice for each sound I was creating and that this probably wasn't the best approach. It was fine to use a single static instance of these and I created a static manager class to initialize and shut down the sound engine, that is, to create and destroy my XAudio2 device and mastering voice. Everything worked great and no problems!
Until now that is... through a rather random incident during testing, it turns out that when a remote desktop session is disconnected, after reconnecting sound won't work. I did some digging around and my guess is that the Windows playback device, Remote Audio, goes away when the session closes and a new one is created when the new session connects. I would then have to guess that the XAudio2 device that was created is no longer valid. Unfortunately there appears to be no exception or error to indicate this... as far as SlimDX/XAudio2 is concerned, there are no problems at all. It continues to play sounds, it's just that nothing happens.
I created a test application and modified my code so that each sound would create/destroy it's own device and mastering voice. Doing this, sounds created before the session disconnect no longer work; however, sounds created after reconnecting do play correctly.
So I have two questions:
1. Is it reasonable to have each sound create/maintain it's own XAudio2 device and mastering voice? The advice I was given, which makes a lot of sense, was that this is wasteful; however, being unable to create sounds after losing the remote session is a bit of a problem for us.
2. Is this something anybody else has encountered? Does anyone have any thoughts on how to overcome this problem?
I appreciate any help anyone can give. Thank you!