- Fix building of cmidriver
[reactos.git] / reactos / drivers / wdm / audio / drivers / CMIDriver / mintopo.hpp
1 /*
2 Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
7 are met:
8 1. Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 3. The name of the author may not be used to endorse or promote products
14 derived from this software without specific prior written permission.
15
16 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 #ifndef _MINTOPO_HPP_
29 #define _MINTOPO_HPP_
30
31 #include "common.hpp"
32 #include "property.h"
33
34 class CCMITopology : public ICMITopology
35 {
36 private:
37 PCMIADAPTER CMIAdapter; // Adapter common object.
38 CMI8738Info *cm;
39 UInt8 auxVolumeRegister, micVolumeRegister, mixer1Register, mixer4Register;
40 UInt32 functrl1Register, chformatRegister, legacyRegister, miscctrlRegister;
41 UInt32 NodeCache[2*KSNODE_TOPO_INVALID];
42 UInt32 masterMuteDummy;
43 BOOLEAN settingsLoaded; // workaround for the fucking XP mixer
44
45 NTSTATUS ProcessResources(PRESOURCELIST ResourceList);
46 public:
47 STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
48 STDMETHODIMP_(ULONG) AddRef()
49 {
50 InterlockedIncrement(&m_Ref);
51 return m_Ref;
52 }
53 STDMETHODIMP_(ULONG) Release()
54 {
55 InterlockedDecrement(&m_Ref);
56
57 if (!m_Ref)
58 {
59 delete this;
60 return 0;
61 }
62 return m_Ref;
63 }
64 CCMITopology(IUnknown * OuterUnknown){}
65 ~CCMITopology();
66 STDMETHODIMP_(NTSTATUS) loadMixerSettingsFromRegistry();
67 STDMETHODIMP_(NTSTATUS) storeMixerSettingsToRegistry();
68
69 STDMETHODIMP_(NTSTATUS) loadMixerSettingsFromMemory();
70 STDMETHODIMP_(NTSTATUS) storeMixerSettingsToMemory();
71
72 STDMETHODIMP_(NTSTATUS) GetDescription
73 (
74 OUT PPCFILTER_DESCRIPTOR * OutFilterDescriptor
75 );
76 STDMETHODIMP_(NTSTATUS) DataRangeIntersection
77 (
78 IN ULONG PinId,
79 IN PKSDATARANGE DataRange,
80 IN PKSDATARANGE MatchingDataRange,
81 IN ULONG OutputBufferLength,
82 OUT PVOID ResultantFormat OPTIONAL,
83 OUT PULONG ResultantFormatLength
84 )
85 {
86 return STATUS_NOT_IMPLEMENTED;
87 }
88
89 // public methods
90 STDMETHODIMP_(NTSTATUS) Init
91 (
92 IN PUNKNOWN UnknownAdapter,
93 IN PRESOURCELIST ResourceList,
94 IN PPORTTOPOLOGY Port
95 );
96
97 //friends
98 friend NTSTATUS NTAPI PropertyHandler_OnOff(PPCPROPERTY_REQUEST PropertyRequest);
99 friend NTSTATUS NTAPI PropertyHandler_Level(PPCPROPERTY_REQUEST PropertyRequest);
100 friend NTSTATUS NTAPI PropertyHandler_CpuResources(PPCPROPERTY_REQUEST PropertyRequest);
101 friend NTSTATUS NTAPI PropertyHandler_ComponentId(PPCPROPERTY_REQUEST PropertyRequest);
102 friend NTSTATUS NTAPI PropertyHandler_Private(PPCPROPERTY_REQUEST PropertyRequest);
103 friend NTSTATUS NTAPI PropertyHandler_Mux(PPCPROPERTY_REQUEST PropertyRequest);
104
105 static NTSTATUS NTAPI EventHandler(PPCEVENT_REQUEST EventRequest);
106
107 LONG m_Ref;
108 };
109
110 #endif //_MINTOPO_HPP_