I have to write a simple Silverlight app for WP7. If the phone is muted in system, the program must not play sounds, but if the phone is not muted the program must play sounds.
How to programmatically determine if Windows Phone is muted or not?
There is no need to do that, the system does not play any sounds when the phone is muted. The system setting overrides all other settings both in Silverlight and XNA (and in integrated Silverlight + XNA).
Related
I would like to know how to detect if current windows is playing any kind of media (video, music, etc) similar to what energy settings do to decide if the computer can enter sleep/hibernate mode?
I'm trying to detect how long the computer is idle. I'm currently using the GetLastInputInfo from user32.dll but it just take in consideration the user input, but not if there is any media playing which should not consider the computer idle.
I tried to find C# APIs or native invocations but can't find the information. I'm using latest version of .NET Framework.
Generally speaking, programs don't declare that they are playing media - instead they call SetThreadExecutionState to tell Windows that the computer should not sleep.
That said - Windows 10 recently added support for programs to declare to the OS that they are currently playing media so that they're integrated with Windows' media controls (like how on iOS any program playing video or audio can be controlled from the Control Center).
Here's what appears on my screen when I nudge my volume control:
...however Chrome is being buggy here because I'm not actually playing any media in Chrome but it's telling Windows that it is.
I don't know what Windows API is used to set this - or which API is used to check it - but it isn't very widely used - even Windows' built-in Windows Media Player 12 doesn't use it.
I am using the following:
MyProfileSettings.TrySetWallpaperImageAsync(myStorageFile);
To change the Wallpaper on both Windows 10 PC, and Windows 10 Mobile successfully However, when I debug the app on my Xbox One, it doesn't seem to change the Wallpaper. Is programmatically changing the wallpaper on XBox one supported?
The feature is not yet supported on Xbox but should at some point (no date available)
You can find the list of the not-yet supported features here : https://msdn.microsoft.com/library/windows/apps/mt693377
I'm making a simple 2d game using WPF where the game objects need to emit a sound when they hit the walls of the screen, but I can't find anything that lets me play a sound effect in Windows Phone 8.1.
In Windows Phone 8 I was using the SoundEffect class from XNA, but I don't think XNA is supported in 8.1 any longer. Is there any equivalent class I can use?
Use a <MediaElement> with MediaElement.AudioCategory set to ForegroundOnlyMedia
If you want more controlled sound playback, you'll need to use DirectX.
If I have an app that plays sounds. It seems like a good idea to indicate why the user isn't hearing the sounds. Is there a way to detect system volume or MUTE?
Yes.
MediaControl.SoundLevel for Windows 8
SystemMediaTransportControls.SoundLevel for Windows 8.1 and later
Music and media capture apps should monitor the SoundLevel to determine whether the audio streams on the app have been Muted.
I think you can use Windows.Media namespace. Also these is SoundLevel enum.
Also
ISimpleAudioVolume interface
Are there any code samples (C#) how to pick up and handle microphone sounds under Win Phone 7+ ?
You can't, windows phone as a number of APIs that can't be used on background agents, microphone is one of them.