How to keep audio playing when switching users in Windows? - winapi

It seems that Windows automatically stops my audio play when switching to another user. Is there any way where I can keep audio playing when windows switch to another user?

Related

is there a way to access desktop audio on windows

im working on a windows app that needs to "hear" the desktop's audio, so the user runs it in the background and plays a game for example, the application would receive the sounds of that game, kind of like a screen recorder, but for audio only

How to mute the audio of a application in ubuntu?

i'm working on a project which produces sound alerts whenever a condition is met. But the problem is if the video player is running the alert sound get mixed with the sound of the video. Is there any way to mute the audio of the running application only using terminal so that the warning can be heard.
My operating system is Ubuntu.

WP7 background audio resources are no longer available

I'm using BackgroundAudioPlayer for my Windows Phone 7 music & video application. After I play some music, I play video using MediaPlayerLauncher, then press Back to return to my app. There whenever I use BackgroundAudioPlayer.Instance. I receive error "The background audio resources are no longer available".
Someone on MSDN suggests using try/catch, but this is not a good idea, and can slow down the app.
Other suggests call BackgroundAudioPlayer.Instance.Close() before launch MediaPlayer. However, when I play music, the agent load .dll again, which takes very much time.
How to fix this ?
If you play a video after your audio the OS will definitely "terminate" your Background Audio Player. From your question it seems this is reproducible 100% of the time which would confirm this. Your only option is to restart the background audio player again after you have called BackgroundAudioPlayer.Instance.Close(), and then played your video. Which as you said will require reloading your player DLL when you start the BAP.
Update following up from comments
If you aren't implementing a streaming audio agent but only an AudioPlayer agent there isn't a process for you to kill anyway. The OS spins up a process as and when it needs to get you to process an action (e.g.: user action, track ended, shutdown).
BackgroundAudioPlayer.Instance.Close() just makes sure that the OS releases those resources cleanly in a scenario such as the OP has.
To restart background audio, just call BackgroundAudioPlayer.Instance.Play() again.

Expensify WP7 test framework

Can we use the Expensify Frame work to test Voice Commands on Emulator/Device..
The feels like this should be possible, but isn't something that I've already coded.
To achieve it, you'd have to setup some sort of playback system to create the audio voice commands. This could be done, for example, by using audio playback triggered from C# SpecFlow steps on the PC - e.g. using something like DirectShow/quartz - http://csharp-slackers.blogspot.co.uk/2008/10/playing-wav-or-mp3.html
This audio would then be played out and captured back into the emulator through the speakers and microphone on the host PC - just make sure they are positioned appropriately.

When/how is an application added to the Windows 7 Volume Mixer window?

I'm trying to get an application which ran okay on XP to run properly on Windows 7 (this is not something I wrote - I'm helping a friend.)
It was able to play audio on XP but cannot on Windows 7 - nothing is heard. Have exhausted a search and check of all settings in Windows 7 as regards audio (have spent many hours searching and reading.)
There is no entry in the Windows 7 Volume Mixer for the application at any time while it is running.
By playing with some other applications I've found that it seems that an application is not added to the Mixer until it actually creates a sound but I've found at least one program which is added to the Mixer right when the program starts and before it has played any sounds.
Is there an API which allows an application to "register" itself with the Windows 7 Volume Mixer so that an entry for it appears in the Mixer even though it has not yet produced any sounds?
According to this blog post, the audio subsystem keeps track of PIDs that play audio and the volume mixer is able to access this list. It is possible to change the name displayed in SndVol with IAudioSessionControl, so maybe that alone is enough for it to be "registered"
An app slider is added to the mixer when an audio session is created. There are two things that can cause an audio session to be created: First off, when an audio stream created by the app transitions to the "start" state. The other case is when an application manipulates the audio volume using the IAudioSessionControl interface.

Resources