summaryrefslogtreecommitdiff
path: root/audio/sysvad/PhoneAudioSample/FMTopo.h
blob: ae279bf1469dfb46aea5e369589d1a208ade1d95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152

/*++

Copyright (c) Microsoft Corporation All Rights Reserved

Module Name:

    FMtopo.h

Abstract:

    Declaration of topology miniport for the fm endpoint.

--*/

#ifndef _SYSVAD_FMTOPO_H_
#define _SYSVAD_FMTOPO_H_

#include "basetopo.h"

// make sure all of these names matches with KSNAME_* in the inf's [Strings] section
#define SPEAKER_TOPONAME L"TopologySpeaker"
#define SPEAKER_HEADSET_TOPONAME L"TopologySpeakerHeadset"

// Special routing endpoint
#define HOSTRENDER_TOPONAME L"HostRender"
#define HOSTRENDER_PIN 0

// FM Volume Stepping information
#define FMRX_VOLUME_MAXIMUM 0                  //   0 dB
#define FMRX_VOLUME_MINIMUM (-96 * 0x10000)    // -96 dB
#define FMRX_VOLUME_STEPPING (0x8000)          // 0.5 dB steps


//=============================================================================
// Defines
//=============================================================================
// {949F42F1-A5F5-4FBD-B4BB-C543ACC24AE0}
DEFINE_GUID(IID_IFmTopology,
    0x949f42f1, 0xa5f5, 0x4fbd, 0xb4, 0xbb, 0xc5, 0x43, 0xac, 0xc2, 0x4a, 0xe0);


//=============================================================================
// Interfaces
//=============================================================================

///////////////////////////////////////////////////////////////////////////////
// IFmTopology
//
DECLARE_INTERFACE_(IFmTopology, IMiniportTopology)
{
    STDMETHOD_(NTSTATUS, UpdateTopologyJackState)
    (
        THIS_
        _In_ BOOL NewState
    ) PURE;
};

typedef IFmTopology *PFMTOPOLOGY;

//=============================================================================
// Classes
//=============================================================================

///////////////////////////////////////////////////////////////////////////////
// CFmMiniportTopology 
//   

class CFmMiniportTopology : 
    public CMiniportTopologySYSVAD,
    public IFmTopology,
    public CUnknown
{
  private:
    KSTOPOLOGY_ENDPOINTID m_FmRxTargetEndpoint;
    KSTOPOLOGY_ENDPOINTID m_FmRxAntennaEndpoint;
    ULONG m_FmRxVolume;

  public:
    DECLARE_STD_UNKNOWN();
    CFmMiniportTopology
    (
        _In_opt_    PUNKNOWN                UnknownOuter,
        _In_        PCFILTER_DESCRIPTOR    *FilterDesc,
        _In_        USHORT                  DeviceMaxChannels
    );

    ~CFmMiniportTopology();

    IMP_IMiniportTopology;

    NTSTATUS PropertyHandlerJackSinkInfo
    (
        _In_ PPCPROPERTY_REQUEST  PropertyRequest
    );
    
    NTSTATUS PropertyHandlerJackDescription
    (
        _In_ PPCPROPERTY_REQUEST  PropertyRequest
    );

    NTSTATUS PropertyHandlerJackDescription2
    (
        _In_ PPCPROPERTY_REQUEST  PropertyRequest
    );

    NTSTATUS PropertyHandlerFmRxEndpointId
    (
        _In_ PPCPROPERTY_REQUEST  PropertyRequest
    );

    NTSTATUS PropertyHandlerFmRxVolume
    (
        _In_ PPCPROPERTY_REQUEST PropertyRequest
    );

    NTSTATUS PropertyHandlerFmRxAntennaEndpointId
    (
        _In_ PPCPROPERTY_REQUEST PropertyRequest
    );

    NTSTATUS EventHandler_JackState
    (
        _In_ PPCEVENT_REQUEST _pEventRequest
    );

    STDMETHODIMP_(NTSTATUS) UpdateTopologyJackState
    (
        _In_ BOOL NewState
    );
};
    
typedef CFmMiniportTopology *PCFmMiniportTopology;

NTSTATUS
CreateFmMiniportTopology( 
    _Out_           PUNKNOWN                              * Unknown,
    _In_            REFCLSID,
    _In_opt_        PUNKNOWN                                UnknownOuter,
    _When_((PoolType & NonPagedPoolMustSucceed) != 0,
       __drv_reportError("Must succeed pool allocations are forbidden. "
             "Allocation failures cause a system crash"))
    _In_            POOL_TYPE                               PoolType,
    _In_            PUNKNOWN                                UnknownAdapter,
    _In_opt_        PVOID                                   DeviceContext,
    _In_            PENDPOINT_MINIPAIR                      MiniportPair
    );

NTSTATUS PropertyHandler_FmRxTopoFilter(_In_ PPCPROPERTY_REQUEST PropertyRequest);

#endif // _SYSVAD_FMTOPO_H_