How to retrieve the current audio device state in metro app?
-
quinta-feira, 10 de maio de 2012 09:14
Hi,
IMMDevice::GetState method can retrieve the current audio device state in desktop app, but this method only applies to desktop apps, metro app can not use this method, so how to retrieve the current audio device state in metro app?
Any help will be appreciated!- Tipo Alterado happyrabbit quarta-feira, 23 de maio de 2012 03:29 no preferred answer
Todas as Respostas
-
quinta-feira, 10 de maio de 2012 23:14Moderador
Hello HappyRabbit,
Try using this property: "System.Devices.Connected"
How to retrieve additional properties for a device or PnP object
http://msdn.microsoft.com/en-us/library/windows/apps/hh464997.aspxI hope this helps,
James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
- Sugerido como Resposta James Dailey - MSFTMicrosoft Employee, Moderator quinta-feira, 10 de maio de 2012 23:14
-
sexta-feira, 11 de maio de 2012 01:25
Thanks James Dailey.
But the property "System.Devices.Connected" is container property , if you retrieve device interface property "System.Devices.Connected" or device property "System.Devices.Connected", it returns nothing.
And the container property "System.Devices.Connected" is not correspond to the audio device state. Using audio container may find many audio device, for example, Speaker, S/PDIF or Microphone and so on.
I had a test: if I disable 5-High Definiton Audio Device - Speaker, it's container property "System.Devices.Connected" retrieve False, if I enable the Speaker device, the property "System.Devices.Connected" retrieve True. But some plugged-in USB audio devices always retrieve True if I use the same operation.
If I use the AQS filter string "System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#False", it retrieves all interface disable devices include disconnected devices.
I can not get the audio device state by the canonical properties in metro app. please help me! thanks in advance.
Best Regards,
HappyRabbit.
-
sexta-feira, 11 de maio de 2012 09:56
Hi, James Dailey,
I try the test again, the result is normal. Whether I disable or enable the Speaker device, the conatiner property "System.Devices.Connected" always retrieves True. so it may be a bug in win8 beta version.
http://msdn.microsoft.com/zh-cn/library/ms679040(v=VS.85).aspx
pdwState
[out] Pointer to a DWORD variable into which the method writes the current state of the device. The device-state value is one of the following DEVICE_STATE_XXX constants:
DEVICE_STATE_ACTIVE
DEVICE_STATE_DISABLED
DEVICE_STATE_NOTPRESENT
DEVICE_STATE_UNPLUGGED
Can I get the DEVICE_STATE_UNPLUGGED audio device state in metro app? and how to get it?
best regards.
HappyRabbit.
- Editado Eric Hanson-MSFTMicrosoft Employee, Moderator sexta-feira, 11 de maio de 2012 15:50 remove refrence to non-CP builds
- Editado Eric Hanson-MSFTMicrosoft Employee, Moderator sexta-feira, 11 de maio de 2012 15:51 remove reference to non-CP build
-
sexta-feira, 11 de maio de 2012 21:24Moderador
Hello HappyRabbit,
Are you disabling the device or removing the device from the system. If the device is still connected to the system but disabled I would expect the behavior that you are seeing. Try removing the device from the system (unplug it) and try the test again. Can you please confirm.
-James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
-
segunda-feira, 14 de maio de 2012 01:13
Hello James.
Whether the DEVICE_STATE_UNPLUGGED audio device state can be got in metro app when a headset is plugged in? if can, how to get it?
Best regards,
HappyRabbit.
- Editado James Dailey - MSFTMicrosoft Employee, Moderator segunda-feira, 14 de maio de 2012 20:43 talks about future builds
-
segunda-feira, 14 de maio de 2012 20:48Moderador
Hello HappyRabbit,
Are you talking about jack-presence detection: when a plug is inserted into or removed from a jack?
-James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
-
quarta-feira, 16 de maio de 2012 02:13
Hello, James,
I am not talking about jack-presence detection.
In win8 desktop mode, Look in the lower right hand corner next to the clock. You should see a white speaker icon. Right click it, and select "playback devices."
You should be brought to a menu with speakers, digital audio, etc...
Right click anywhere in the menu, and make sure "Show disabled devices" and "show disconnected devices" are checked.Then you can see that the audio device (for example speakers, digital audio, etc...) have the device state (for example, not plugged in, ready, disable, etc...).
So my question is as followings about win8 metro style mode:
Can I get the audio plalyback or recording devices state in metro app?Can I get all disabled audio devices in metro app? if can, how to do it?
Best regards,
HappyRabbit.
-
quinta-feira, 17 de maio de 2012 00:37Moderador
Hello HappyRabbit,
Thank you very much for your patience. I think that I finally understand exactly what information you are trying to query from the system. I honestly don't know if this information is available. I will talk with some of the other audio developers on the team and see if they know specifically if this information is available. I do need to let you know that it may take a couple of weeks for me to respond so please be patient. If you don't hear from me by June 4th please bump this post.
Thanks,
James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
-
sexta-feira, 18 de maio de 2012 00:15Moderador
Hello HappyRabbit,
Only 'active' endpoints have software audio devices created for them. So 'Unplugged' and 'Not Present' audio devices should not show up when enumerating audio devices in WinRT. What is the reason that you are using "System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#False” to attempt to get the disabled and unplugged devices?
Just to be clear this is not a scenario we expected developers to need to cover so we did not add an equivelant of the IMMDevice::GetState method.
Thanks,
James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
- Marcado como Resposta James Dailey - MSFTMicrosoft Employee, Moderator sexta-feira, 18 de maio de 2012 00:15
-
sexta-feira, 18 de maio de 2012 02:52
Hello James,
we are ready to develop a custom Metro style device app for USB audio device. So I need to get the audio device state information and list all disabled devices to control or show them like Desktop app. Can I do it? How to do it?
Best regards,
HappyRabbit.
-
sexta-feira, 18 de maio de 2012 21:41Moderador
I'm sorry HappyRabbit but at this time you cannot get the device state like you can in a desktop app.
-James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
- Marcado como Resposta James Dailey - MSFTMicrosoft Employee, Moderator segunda-feira, 11 de junho de 2012 23:49
-
segunda-feira, 21 de maio de 2012 02:12
Hello James,
If we can not emulate the disable audio endpoints in metro style mode, when the custom Metro style device app launches, we can not enable the disable audio endpoints. Please tell us how to find a way to enable the disable audio endpoint?
Another problem, if EQ APO effect is enable ,and we can not get/set APO effect, it may result in APO effect overlapping problem. For example, if EQ APO effect is enable in metro style mode , because we can not get/set APO effect, a custom Metro style device app may also contain EQ effect, then the EQ effect is overlapping, Please tell us how to solve this problem?
Best regards,
HappyRabbit.
- Editado happyrabbit segunda-feira, 21 de maio de 2012 08:04
- Marcado como Resposta happyrabbit quarta-feira, 23 de maio de 2012 01:35
- Não Marcado como Resposta happyrabbit quarta-feira, 23 de maio de 2012 01:45
-
quarta-feira, 23 de maio de 2012 03:23
Hello James,
If we can not emulate the disable audio endpoints in metro style mode, when the custom Metro style device app launches, we can not enable the disable audio endpoints. Please tell us how to find a way to enable the disable audio endpoint?
Another problem, if EQ APO effect is enable ,and we can not get/set APO effect, it may result in APO effect overlapping problem. For example, if EQ APO effect is enable in metro style mode , because we can not get/set APO effect, a custom Metro style device app may also contain EQ effect, then the EQ effect is overlapping, Please tell us how to solve this problem?
Best regards,
HappyRabbit.
Hello,
As for the above problems, someone can help me?
Any answer is greatly appreciated.
- HappyRabbit.
-
terça-feira, 5 de junho de 2012 03:44ModeradorHave you looked into XAudio2?
-
quarta-feira, 6 de junho de 2012 03:24
Hello Eric,
http://msdn.microsoft.com/en-us/library/windows/hardware/ff536376
A GFX sAPO is an sAPO(System Effects Audio Processing Objects) whose processing algorithm globally affects the audio streams from all the applications that channel their audio data through the audio engine.
http://msdn.microsoft.com/en-us/library/windows/apps/ee415735.aspx
XAPOs are used in XAudio2 by attaching them to voices. Each XAudio2 voice has an effect chain containing zero or more audio effects.
As mentioned above, XAudio2 uses XAPOs by attaching them to voices, it cannot create custom GFX sAPO.
http://msdn.microsoft.com/en-us/library/windows/apps/Hh700365.aspx
Be aware that custom extensions are only accessible to the application they are created and registered in. They are not accessible to other applications.Using media extensions also cannot create custom GFX sAPO in metro style mode.
So in metro style mode, is there any way to control custom GFX sAPO for my USB sound card like sound effect manager(CPL) in desktop mode? if there is, how to do it?
HappyRabbit.
- Editado happyrabbit quinta-feira, 7 de junho de 2012 00:54
- Editado happyrabbit quinta-feira, 7 de junho de 2012 00:58
- Editado happyrabbit quinta-feira, 7 de junho de 2012 00:59
- Editado happyrabbit quinta-feira, 7 de junho de 2012 01:02
- Editado happyrabbit quinta-feira, 7 de junho de 2012 01:18
- Editado happyrabbit quinta-feira, 7 de junho de 2012 01:22
- Editado happyrabbit quinta-feira, 7 de junho de 2012 01:35
- Editado happyrabbit sexta-feira, 8 de junho de 2012 01:47
-
sexta-feira, 8 de junho de 2012 01:40
Hi,
Any update for this question? Any answer is greatly appreciated.
Best wishes - HappyRabbit
-
segunda-feira, 11 de junho de 2012 23:49Moderador
Hello HappyRabbit,
There is no mechanism built into the WinRT API to allow a developer to directly control APOs instantiated in the global audio pipeline. This is by design. Applications should not have access to these resources. These resources should only be enabled and disabled by the user.
I hope this helps,
James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
- Marcado como Resposta James Dailey - MSFTMicrosoft Employee, Moderator segunda-feira, 11 de junho de 2012 23:49

