// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0 > or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT >, at your option.
// All files in the project carrying such notice may not be copied, modified, or distributed
// except according to those terms.
//! The DeviceTopology API gives clients control over a variety of internal functions of audio
//! adapters that they cannot access through the MMDevice API, WASAPI, or the EndpointVolume API.
use ctypes::{c_float, c_void};
use shared::guiddef::{GUID, LPCGUID, REFGUID, REFIID};
use shared::minwindef::{BOOL, DWORD, UCHAR, UINT, ULONG, WORD};
use shared::windef::COLORREF;
use shared::wtypes::VARTYPE;
use um::unknwnbase::{IUnknown, IUnknownVtbl};
use um::winnt::{HRESULT, LONG, LONGLONG, LPWSTR, WCHAR};
DEFINE_GUID!{EVENTCONTEXT_VOLUMESLIDER,
0 xe2c2e9de,
0 x09b1,
0 x4b04,
0 x84,
0 xe5,
0 x07,
0 x93,
0 x12,
0 x25,
0 xee,
0 x04}
STRUCT !{
struct KSDATAFORMAT {
FormatSize: ULONG,
Flags: ULONG,
SampleSize: ULONG,
Reserved: ULONG,
MajorFormat: GUID,
SubFormat: GUID,
Specifier: GUID,
}}
pub type PKSDATAFORMAT = *
mut KSDATAFORMAT;
STRUCT !{
struct KSIDENTIFIER_s {
Set: GUID,
Id: ULONG,
Flags: ULONG,
}}
UNION!{union KSIDENTIFIER {
[u64;
3 ],
s s_mut: KSIDENTIFIER_s,
Alignment Alignment_mut: LONGLONG,
}}
pub type KSPROPERTY = KSIDENTIFIER;
pub type PKSPROPERTY = *
mut KSIDENTIFIER;
pub type KSMETHOD = KSIDENTIFIER;
pub type PKSMETHOD = *
mut KSIDENTIFIER;
pub type KSEVENT = KSIDENTIFIER;
pub type PKSEVENT = *
mut KSIDENTIFIER;
ENUM !{
enum EPcxConnectionType {
eConnTypeUnknown =
0 ,
eConnType3Point5mm =
1 ,
eConnTypeQuarter =
2 ,
eConnTypeAtapiInternal =
3 ,
eConnTypeRCA =
4 ,
eConnTypeOptical =
5 ,
eConnTypeOtherDigital =
6 ,
eConnTypeOtherAnalog =
7 ,
eConnTypeMultichannelAnalogDIN =
8 ,
eConnTypeXlrProfessional =
9 ,
eConnTypeRJ11Modem =
10 ,
eConnTypeCombination =
11 ,
}}
ENUM !{
enum EPcxGeoLocation {
eGeoLocRear =
1 ,
eGeoLocFront =
2 ,
eGeoLocLeft =
3 ,
eGeoLocRight =
4 ,
eGeoLocTop =
5 ,
eGeoLocBottom =
6 ,
eGeoLocRearPanel =
7 ,
eGeoLocRiser =
8 ,
eGeoLocInsideMobileLid =
9 ,
eGeoLocDrivebay =
10 ,
eGeoLocHDMI =
11 ,
eGeoLocOutsideMobileLid =
12 ,
eGeoLocATAPI =
13 ,
eGeoLocNotApplicable =
14 ,
eGeoLocReserved6 =
15 ,
}}
ENUM !{
enum EPcxGenLocation {
eGenLocPrimaryBox =
0 ,
eGenLocInternal =
1 ,
eGenLocSeparate =
2 ,
eGenLocOther =
3 ,
}}
ENUM !{
enum EPxcPortConnection {
ePortConnJack =
0 ,
ePortConnIntegratedDevice =
1 ,
ePortConnBothIntegratedAndJack =
2 ,
ePortConnUnknown =
3 ,
}}
STRUCT !{
struct KSJACK_DESCRIPTION {
ChannelMapping: DWORD,
Color: COLORREF,
ConnectionType: EPcxConnectionType,
GeoLocation: EPcxGeoLocation,
GenLocation: EPcxGenLocation,
PortConnection: EPxcPortConnection,
IsConnected: BOOL,
}}
pub type PKSJACK_DESCRIPTION = *
mut KSJACK_DESCRIPTION;
STRUCT !{
struct LUID {
LowPart: DWORD,
HighPart: LONG,
}}
pub type PLUID = *
mut LUID;
ENUM !{
enum KSJACK_SINK_CONNECTIONTYPE {
KSJACK_SINK_CONNECTIONTYPE_HDMI =
0 ,
KSJACK_SINK_CONNECTIONTYPE_DISPLAYPORT =
1 ,
}}
STRUCT !{
struct KSJACK_SINK_INFORMATION {
ConnType: KSJACK_SINK_CONNECTIONTYPE,
ManufacturerId: WORD,
ProductId: WORD,
AudioLatency: WORD,
HDCPCapable: BOOL,
AICapable: BOOL,
SinkDescriptionLength: UCHAR,
SinkDescription: [WCHAR;
32 ],
PortId: LUID,
}}
STRUCT !{
struct KSJACK_DESCRIPTION2 {
DeviceStateInfo: DWORD,
JackCapabilities: DWORD,
}}
pub type PKSJACK_DESCRIPTION2 = *
mut KSJACK_DESCRIPTION2;
ENUM !{
enum DataFlow {
In =
0 ,
Out =
1 ,
}}
ENUM !{
enum PartType {
Connector =
0 ,
Subunit =
1 ,
}}
ENUM !{
enum ConnectorType {
Unknown_Connector =
0 ,
Physical_Internal =
1 ,
Physical_External =
2 ,
Software_IO =
3 ,
Software_Fixed =
4 ,
Network =
5 ,
}}
RIDL!{
#[ uuid(
0 x28f54685,
0 x06fd,
0 x11d2,
0 xb2,
0 x7a,
0 x00,
0 xa0,
0 xc9,
0 x22,
0 x31,
0 x96)]
interface IKsControl(IKsControlVtbl): IUnknown(IUnknownVtbl) {
fn KsProperty(
Property: PKSPROPERTY,
PropertyLength: ULONG,
PropertyData: *
mut c_void,
DataLength: ULONG,
BytesReturned: *
mut ULONG,
) -> HRESULT,
fn KsMethod(
Method: PKSMETHOD,
MethodLength: ULONG,
MethodData: *
mut c_void,
DataLength: ULONG,
BytesReturned: *
mut ULONG,
) -> HRESULT,
fn KsEvent(
Event: PKSEVENT,
EventLength: ULONG,
EventData: *
mut c_void,
DataLength: ULONG,
BytesReturned: *
mut ULONG,
) -> HRESULT,
}}
RIDL!{
#[ uuid(
0 xc2f8e001,
0 xf205,
0 x4bc9,
0 x99,
0 xbc,
0 xc1,
0 x3b,
0 x1e,
0 x04,
0 x8c,
0 xcb)]
interface IPerChannelDbLevel(IPerChannelDbLevelVtbl): IUnknown(IUnknownVtbl) {
fn GetChannelCount(
pcChannels: *
mut UINT,
) -> HRESULT,
fn GetLevelRange(
nChannel: UINT,
pfMinLevelDB: *
mut c_float,
pfMaxLevelDB: *
mut c_float,
pfStepping: *
mut c_float,
) -> HRESULT,
fn GetLevel(
nChannel: UINT,
pfLevelDB: *
mut c_float,
) -> HRESULT,
fn SetLevel(
nChannel: UINT,
fLevelDB: c_float,
pguidEventContext: LPCGUID,
) -> HRESULT,
fn SetLevelUniform(
fLevelDB: c_float,
pguidEventContext: LPCGUID,
) -> HRESULT,
fn SetLevelAllChannels(
aLevelsDB: *
mut c_float,
cChannels: ULONG,
pguidEventContext: LPCGUID,
) -> HRESULT,
}}
RIDL!{
#[ uuid(
0 x7fb7b48f,
0 x531d,
0 x44a2,
0 xbc,
0 xb3,
0 x5a,
0 xd5,
0 xa1,
0 x34,
0 xb3,
0 xdc)]
interface IAudioVolumeLevel(IAudioVolumeLevelVtbl): IPerChannelDbLevel(IPerChannel
DbLevelVtbl) {}}
RIDL!{#[ uuid(0 xbb11c46f, 0 xec28, 0 x493c, 0 xb8, 0 x8a, 0 x5d, 0 xb8, 0 x80, 0 x62, 0 xce, 0 x98)]
interface IAudioChannelConfig(IAudioChannelConfigVtbl): IUnknown(IUnknownVtbl) {
fn SetChannelConfig(
dwConfig: DWORD,
pguidEventContext: LPCGUID,
) -> HRESULT,
fn GetChannelConfig(
pdwConfig: *mut DWORD,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 x7d8b1437, 0 xdd53, 0 x4350, 0 x9c, 0 x1b, 0 x1e, 0 xe2, 0 x89, 0 x0b, 0 xd9, 0 x38)]
interface IAudioLoudness(IAudioLoudnessVtbl): IUnknown(IUnknownVtbl) {
fn GetEnabled(
pbEnabled: *mut BOOL,
) -> HRESULT,
fn SetEnabled(
bEnable: BOOL,
pguidEventContext: LPCGUID,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 x4f03dc02, 0 x5e6e, 0 x4653, 0 x8f, 0 x72, 0 xa0, 0 x30, 0 xc1, 0 x23, 0 xd5, 0 x98)]
interface IAudioInputSelector(IAudioInputSelectorVtbl): IUnknown(IUnknownVtbl) {
fn GetSelection(
pnIdSelected: *mut UINT,
) -> HRESULT,
fn SetSelection(
nIdSelect: UINT,
pguidEventContext: LPCGUID,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 xbb515f69, 0 x94a7, 0 x429e, 0 x8b, 0 x9c, 0 x27, 0 x1b, 0 x3f, 0 x11, 0 xa3, 0 xab)]
interface IAudioOutputSelector(IAudioOutputSelectorVtbl): IUnknown(IUnknownVtbl) {
fn GetSelection(
pnIdSelected: *mut UINT,
) -> HRESULT,
fn SetSelection(
nIdSelect: UINT,
pguidEventContext: LPCGUID,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 xdf45aeea, 0 xb74a, 0 x4b6b, 0 xaf, 0 xad, 0 x23, 0 x66, 0 xb6, 0 xaa, 0 x01, 0 x2e)]
interface IAudioMute(IAudioMuteVtbl): IUnknown(IUnknownVtbl) {
fn SetMute(
bMuted: BOOL,
pguidEventContext: LPCGUID,
) -> HRESULT,
fn GetMute(
pbMuted: *mut BOOL,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 xa2b1a1d9, 0 x4db3, 0 x425d, 0 xa2, 0 xb2, 0 xbd, 0 x33, 0 x5c, 0 xb3, 0 xe2, 0 xe5)]
interface IAudioBass(IAudioBassVtbl): IPerChannelDbLevel(IPerChannelDbLevelVtbl) {}}
RIDL!{#[ uuid(0 x5e54b6d7, 0 xb44b, 0 x40d9, 0 x9a, 0 x9e, 0 xe6, 0 x91, 0 xd9, 0 xce, 0 x6e, 0 xdf)]
interface IAudioMidrange(IAudioMidrangeVtbl): IPerChannelDbLevel(IPerChannelDbLevelVtbl) {}}
RIDL!{#[ uuid(0 x0a717812, 0 x694e, 0 x4907, 0 xb7, 0 x4b, 0 xba, 0 xfa, 0 x5c, 0 xfd, 0 xca, 0 x7b)]
interface IAudioTreble(IAudioTrebleVtbl): IPerChannelDbLevel(IPerChannelDbLevelVtbl) {}}
RIDL!{#[ uuid(0 x85401fd4, 0 x6de4, 0 x4b9d, 0 x98, 0 x69, 0 x2d, 0 x67, 0 x53, 0 xa8, 0 x2f, 0 x3c)]
interface IAudioAutoGainControl(IAudioAutoGainControlVtbl): IUnknown(IUnknownVtbl) {
fn GetEnabled(
pbEnabled: *mut BOOL,
) -> HRESULT,
fn SetEnabled(
bEnable: BOOL,
pguidEventContext: LPCGUID,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 xdd79923c, 0 x0599, 0 x45e0, 0 xb8, 0 xb6, 0 xc8, 0 xdf, 0 x7d, 0 xb6, 0 xe7, 0 x96)]
interface IAudioPeakMeter(IAudioPeakMeterVtbl): IUnknown(IUnknownVtbl) {
fn GetChannelCount(
pcChannels: *mut UINT,
) -> HRESULT,
fn GetLevel(
nChannel: UINT,
pfLevel: *mut c_float,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 x3b22bcbf, 0 x2586, 0 x4af0, 0 x85, 0 x83, 0 x20, 0 x5d, 0 x39, 0 x1b, 0 x80, 0 x7c)]
interface IDeviceSpecificProperty(IDeviceSpecificPropertyVtbl): IUnknown(IUnknownVtbl) {
fn GetType(
pVType: *mut VARTYPE,
) -> HRESULT,
fn GetValue(
pvValue: *mut c_void,
pcbValue: *mut DWORD,
) -> HRESULT,
fn SetValue(
pvValue: *mut c_void,
cbValue: DWORD,
pguidEventContext: LPCGUID,
) -> HRESULT,
fn Get4BRange(
plMin: *mut LONG,
plMax: *mut LONG,
plStepping: *mut LONG,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 x3cb4a69d, 0 xbb6f, 0 x4d2b, 0 x95, 0 xb7, 0 x45, 0 x2d, 0 x2c, 0 x15, 0 x5d, 0 xb5)]
interface IKsFormatSupport(IKsFormatSupportVtbl): IUnknown(IUnknownVtbl) {
fn IsFormatSupported(
pKsFormat: PKSDATAFORMAT,
cbFormat: DWORD,
pbSupported: *mut BOOL,
) -> HRESULT,
fn GetDevicePreferredFormat(
ppKsFormat: *mut PKSDATAFORMAT,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 x4509f757, 0 x2d46, 0 x4637, 0 x8e, 0 x62, 0 xce, 0 x7d, 0 xb9, 0 x44, 0 xf5, 0 x7b)]
interface IKsJackDescription(IKsJackDescriptionVtbl): IUnknown(IUnknownVtbl) {
fn GetJackCount(
pcJacks: *mut UINT,
) -> HRESULT,
fn GetJackDescription(
nJack: UINT,
pDescription: *mut KSJACK_DESCRIPTION,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 x478f3a9b, 0 xe0c9, 0 x4827, 0 x92, 0 x28, 0 x6f, 0 x55, 0 x05, 0 xff, 0 xe7, 0 x6a)]
interface IKsJackDescription2(IKsJackDescription2Vtbl): IUnknown(IUnknownVtbl) {
fn GetJackCount(
pcJacks: *mut UINT,
) -> HRESULT,
fn GetJackDescription2(
nJack: UINT,
pDescription2: *mut KSJACK_DESCRIPTION2,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 xd9bd72ed, 0 x290f, 0 x4581, 0 x9f, 0 xf3, 0 x61, 0 x02, 0 x7a, 0 x8f, 0 xe5, 0 x32)]
interface IKsJackSinkInformation(IKsJackSinkInformationVtbl): IUnknown(IUnknownVtbl) {
fn GetJackSinkInformation(
pJackSinkInformation: *mut KSJACK_SINK_INFORMATION,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 xc99af463, 0 xd629, 0 x4ec4, 0 x8c, 0 x00, 0 xe5, 0 x4d, 0 x68, 0 x15, 0 x42, 0 x48)]
interface IKsJackContainerId(IKsJackContainerIdVtbl): IUnknown(IUnknownVtbl) {
fn GetJackContainerId(
pJackContainerId: *mut GUID,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 x6daa848c, 0 x5eb0, 0 x45cc, 0 xae, 0 xa5, 0 x99, 0 x8a, 0 x2c, 0 xda, 0 x1f, 0 xfb)]
interface IPartsList(IPartsListVtbl): IUnknown(IUnknownVtbl) {
fn GetCount(
pCount: *mut UINT,
) -> HRESULT,
fn GetPart(
nIndex: UINT,
ppPart: *mut *mut IPart,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 xae2de0e4, 0 x5bca, 0 x4f2d, 0 xaa, 0 x46, 0 x5d, 0 x13, 0 xf8, 0 xfd, 0 xb3, 0 xa9)]
interface IPart(IPartVtbl): IUnknown(IUnknownVtbl) {
fn GetName(
ppwstrName: *mut LPWSTR,
) -> HRESULT,
fn GetLocalId(
pnId: *mut UINT,
) -> HRESULT,
fn GetGlobalId(
ppwstrGlobalId: *mut LPWSTR,
) -> HRESULT,
fn GetPartType(
pPartType: *mut PartType,
) -> HRESULT,
fn GetSubType(
pSubType: *mut GUID,
) -> HRESULT,
fn GetControlInterfaceCount(
pCount: *mut UINT,
) -> HRESULT,
fn GetControlInterface(
nIndex: UINT,
ppInterfaceDesc: *mut *mut IControlInterface,
) -> HRESULT,
fn EnumPartsIncoming(
ppParts: *mut *mut IPartsList,
) -> HRESULT,
fn EnumPartsOutgoing(
ppParts: *mut *mut IPartsList,
) -> HRESULT,
fn GetTopologyObject(
ppTopology: *mut *mut IDeviceTopology,
) -> HRESULT,
fn Activate(
dwClsContext: DWORD,
refiid: REFIID,
ppvObject: *mut *mut c_void,
) -> HRESULT,
fn RegisterControlChangeCallback(
riid: REFGUID,
pNotify: *mut IControlChangeNotify,
) -> HRESULT,
fn UnregisterControlChangeCallback(
pNotify: *mut IControlChangeNotify,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 x9c2c4058, 0 x23f5, 0 x41de, 0 x87, 0 x7a, 0 xdf, 0 x3a, 0 xf2, 0 x36, 0 xa0, 0 x9e)]
interface IConnector(IConnectorVtbl): IUnknown(IUnknownVtbl) {
fn GetType(
pType: *mut ConnectorType,
) -> HRESULT,
fn GetDataFlow(
pFlow: *mut DataFlow,
) -> HRESULT,
fn ConnectTo(
pConnectTo: *mut IConnector,
) -> HRESULT,
fn Disconnect() -> HRESULT,
fn IsConnected(
pbConnected: *mut BOOL,
) -> HRESULT,
fn GetConnectedTo(
ppConTo: *mut *mut IConnector,
) -> HRESULT,
fn GetConnectorIdConnectedTo(
ppwstrConnectorId: *mut LPWSTR,
) -> HRESULT,
fn GetDeviceIdConnectedTo(
ppwstrDeviceId: *mut LPWSTR,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 x82149a85, 0 xdba6, 0 x4487, 0 x86, 0 xbb, 0 xea, 0 x8f, 0 x7f, 0 xef, 0 xcc, 0 x71)]
interface ISubunit(ISubunitVtbl): IUnknown(IUnknownVtbl) {}}
RIDL!{#[ uuid(0 x45d37c3f, 0 x5140, 0 x444a, 0 xae, 0 x24, 0 x40, 0 x07, 0 x89, 0 xf3, 0 xcb, 0 xf3)]
interface IControlInterface(IControlInterfaceVtbl): IUnknown(IUnknownVtbl) {
fn GetName(
ppwstrName: *mut LPWSTR,
) -> HRESULT,
fn GetIID(
pIID: *mut GUID,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 xa09513ed, 0 xc709, 0 x4d21, 0 xbd, 0 x7b, 0 x5f, 0 x34, 0 xc4, 0 x7f, 0 x39, 0 x47)]
interface IControlChangeNotify(IControlChangeNotifyVtbl): IUnknown(IUnknownVtbl) {
fn OnNotify(
dwSenderProcessId: DWORD,
pguidEventContext: LPCGUID,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 x2a07407e, 0 x6497, 0 x4a18, 0 x97, 0 x87, 0 x32, 0 xf7, 0 x9b, 0 xd0, 0 xd9, 0 x8f)]
interface IDeviceTopology(IDeviceTopologyVtbl): IUnknown(IUnknownVtbl) {
fn GetConnectorCount(
pCount: *mut UINT,
) -> HRESULT,
fn GetConnector(
nIndex: UINT,
ppConnector: *mut *mut IConnector,
) -> HRESULT,
fn GetSubunitCount(
pCount: *mut UINT,
) -> HRESULT,
fn GetSubunit(
nIndex: UINT,
ppSubunit: *mut *mut ISubunit,
) -> HRESULT,
fn GetPartById(
nId: UINT,
ppPart: *mut *mut IPart,
) -> HRESULT,
fn GetDeviceId(
ppwstrDeviceId: *mut LPWSTR,
) -> HRESULT,
fn GetSignalPath(
pIPartFrom: *mut IPart,
pIPartTo: *mut IPart,
bRejectMixedPaths: BOOL,
ppParts: *mut *mut IPartsList,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 x1df639d0, 0 x5ec1, 0 x47aa, 0 x93, 0 x79, 0 x82, 0 x8d, 0 xc1, 0 xaa, 0 x8c, 0 x59)]
class DeviceTopology;}
Messung V0.5 in Prozent C=89 H=93 G=90
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-06-23)
¤
*© Formatika GbR, Deutschland