ReactOS  0.4.14-dev-342-gdc047f9
filter.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Kernel Streaming
4  * FILE: lib/drivers/sound/mmixer/filter.c
5  * PURPOSE: Mixer Filter Functions
6  * PROGRAMMER: Johannes Anderwald
7  */
8 
9 #include "precomp.h"
10 
11 #define YDEBUG
12 #include <debug.h>
13 
14 ULONG
18 {
21  ULONG NumPins, BytesReturned;
22 
23  /* setup property request */
25  Pin.Set = KSPROPSETID_Pin;
27 
28  /* query pin count */
30 
31  /* check for success */
33  return 0;
34 
35  return NumPins;
36 }
37 
43  OUT PKSMULTIPLE_ITEM * OutMultipleItem)
44 {
46  PKSMULTIPLE_ITEM MultipleItem;
49 
50  /* setup property request */
51  Property.Id = PropertyId;
54 
55  /* query for the size */
57 
59  return Status;
60 
61  /* sanity check */
63 
64  /* allocate an result buffer */
66 
67  if (!MultipleItem)
68  {
69  /* not enough memory */
70  return MM_STATUS_NO_MEMORY;
71  }
72 
73  /* query again with allocated buffer */
75 
77  {
78  /* failed */
79  MixerContext->Free((PVOID)MultipleItem);
80  return Status;
81  }
82 
83  /* store result */
84  *OutMultipleItem = MultipleItem;
85 
86  /* done */
87  return Status;
88 }
89 
94  IN ULONG PinId,
95  OUT PKSPIN_PHYSICALCONNECTION *OutConnection)
96 {
97  KSP_PIN Pin;
100  PKSPIN_PHYSICALCONNECTION Connection;
101 
102  /* setup the request */
103  Pin.Property.Flags = KSPROPERTY_TYPE_GET;
105  Pin.Property.Set = KSPROPSETID_Pin;
106  Pin.PinId = PinId;
107 
108  /* query the pin for the physical connection */
110 
112  {
113  /* pin does not have a physical connection */
114  return Status;
115  }
116  DPRINT("Status %u BytesReturned %lu\n", Status, BytesReturned);
118  if (!Connection)
119  {
120  /* not enough memory */
121  return MM_STATUS_NO_MEMORY;
122  }
123 
124  /* query the pin for the physical connection */
126  if (Status != MM_STATUS_SUCCESS)
127  {
128  /* failed to query the physical connection */
129  MixerContext->Free(Connection);
130  return Status;
131  }
132 
133  // store connection
134  *OutConnection = Connection;
135  return Status;
136 }
137 
138 ULONG
141 {
143  {
144  /* automatic gain control */
146  }
148  {
149  /* loudness control */
151  }
153  {
154  /* mute control */
156  }
158  {
159  /* tone control
160  * FIXME
161  * MIXERCONTROL_CONTROLTYPE_ONOFF if KSPROPERTY_AUDIO_BASS_BOOST is supported
162  * MIXERCONTROL_CONTROLTYPE_BASS if KSPROPERTY_AUDIO_BASS is supported
163  * MIXERCONTROL_CONTROLTYPE_TREBLE if KSPROPERTY_AUDIO_TREBLE is supported
164  */
167  }
169  {
170  /* volume control */
172  }
174  {
175  /* peakmeter control */
177  }
179  {
180  /* mux control */
182  }
184  {
185  /* mux control */
187  }
189  {
190  /* stero wide control */
192  }
194  {
195  /* chorus control */
197  }
199  {
200  /* reverb control */
202  }
204  {
205  /* supermix control
206  * MIXERCONTROL_CONTROLTYPE_MUTE if KSPROPERTY_AUDIO_MUTE is supported
207  */
210  }
211  /* TODO
212  * check for other supported node types
213  */
214  //UNIMPLEMENTED;
215  return 0;
216 }
217 
221  IN HANDLE hMixer,
222  IN ULONG NodeId,
223  IN ULONG bSet,
225  IN ULONG Channel,
226  IN PLONG InputValue)
227 {
230  LONG Value;
232 
233  if (bSet)
234  Value = *InputValue;
235 
236  /* setup the request */
238 
239  Property.NodeProperty.NodeId = NodeId;
240  Property.NodeProperty.Property.Id = PropertyId;
241  Property.NodeProperty.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY;
242  Property.NodeProperty.Property.Set = KSPROPSETID_Audio;
243  Property.Channel = Channel;
244  Property.Reserved = 0;
245 
246  if (bSet)
247  Property.NodeProperty.Property.Flags |= KSPROPERTY_TYPE_SET;
248  else
249  Property.NodeProperty.Property.Flags |= KSPROPERTY_TYPE_GET;
250 
251  /* send the request */
253 
254  if (!bSet && Status == MM_STATUS_SUCCESS)
255  {
256  *InputValue = Value;
257  }
258 
259  DPRINT("Status %x bSet %u NodeId %u Value %d PropertyId %u\n", Status, bSet, NodeId, Value, PropertyId);
260  return Status;
261 }
262 
263 ULONG
266  HANDLE hFilter,
267  ULONG PinId)
268 {
269  KSP_PIN PinRequest;
270  KSPIN_CINSTANCES PinInstances;
273 
274  /* query the instance count */
275  PinRequest.Reserved = 0;
276  PinRequest.PinId = PinId;
277  PinRequest.Property.Set = KSPROPSETID_Pin;
278  PinRequest.Property.Flags = KSPROPERTY_TYPE_GET;
280 
281  Status = MixerContext->Control(hFilter, IOCTL_KS_PROPERTY, (PVOID)&PinRequest, sizeof(KSP_PIN), (PVOID)&PinInstances, sizeof(KSPIN_CINSTANCES), &BytesReturned);
283  return PinInstances.CurrentCount;
284 }
#define MIXERCONTROL_CONTROLTYPE_MUX
Definition: mmsystem.h:403
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
const GUID KSNODETYPE_TONE
Definition: sup.c:20
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
#define IN
Definition: typedefs.h:38
const GUID KSNODETYPE_PEAKMETER
Definition: sup.c:22
struct KSPIN_PHYSICALCONNECTION * PKSPIN_PHYSICALCONNECTION
ULONG MMixerGetPinInstanceCount(PMIXER_CONTEXT MixerContext, HANDLE hFilter, ULONG PinId)
Definition: filter.c:264
_In_ PSTORAGE_PROPERTY_ID PropertyId
Definition: classpnp.h:966
#define KSPROPSETID_Audio
Definition: ksmedia.h:951
const GUID KSNODETYPE_MUTE
Definition: sup.c:19
MIXER_STATUS MMixerGetFilterTopologyProperty(IN PMIXER_CONTEXT MixerContext, IN HANDLE hMixer, IN ULONG PropertyId, OUT PKSMULTIPLE_ITEM *OutMultipleItem)
Definition: filter.c:39
const GUID KSNODETYPE_VOLUME
Definition: sup.c:21
const GUID KSNODETYPE_MUX
Definition: sup.c:23
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
GUID Set
Definition: dmksctrl.h:76
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:233
const GUID KSNODETYPE_LOUDNESS
Definition: sup.c:18
const GUID KSNODETYPE_SUPERMIX
Definition: sup.c:27
const GUID KSNODETYPE_STEREO_WIDE
Definition: sup.c:24
MIXER_CONTEXT MixerContext
Definition: mmixer.c:46
PMIXER_DEVICE_CONTROL Control
Definition: mmixer.h:95
long LONG
Definition: pedump.c:60
HMIXER hMixer
Definition: test.c:10
KSPROPERTY Property
Definition: ks.h:643
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
NodeType
Definition: Node.h:5
const GUID KSPROPSETID_Pin
Definition: filter.c:47
ULONG PinId
Definition: ks.h:644
ULONG MMixerGetFilterPinCount(IN PMIXER_CONTEXT MixerContext, IN HANDLE hMixer)
Definition: filter.c:15
Definition: ks.h:642
#define MIXERCONTROL_CONTROLTYPE_LOUDNESS
Definition: mmsystem.h:386
PMIXER_FREE Free
Definition: mmixer.h:96
ULONG Id
Definition: dmksctrl.h:77
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:415
const GUID KSNODETYPE_AGC
Definition: sup.c:17
const GUID KSNODETYPE_REVERB
Definition: sup.c:26
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG Flags
Definition: ntfs.h:532
ULONG Flags
Definition: dmksctrl.h:78
MIXER_STATUS MMixerSetGetControlDetails(IN PMIXER_CONTEXT MixerContext, IN HANDLE hMixer, IN ULONG NodeId, IN ULONG bSet, IN ULONG PropertyId, IN ULONG Channel, IN PLONG InputValue)
Definition: filter.c:219
ULONG Reserved
Definition: ks.h:645
struct KSMULTIPLE_ITEM * PKSMULTIPLE_ITEM
PMIXER_ALLOC Alloc
Definition: mmixer.h:94
ULONG MMixerGetControlTypeFromTopologyNode(IN LPGUID NodeType)
Definition: filter.c:139
const GUID KSPROPSETID_Topology
Definition: filter.c:46
Status
Definition: gdiplustypes.h:24
_In_ DWORD Property
Definition: setupapi.h:1545
#define MIXERCONTROL_CONTROLTYPE_VOLUME
Definition: mmsystem.h:398
#define MIXERCONTROL_CONTROLTYPE_FADER
Definition: mmsystem.h:397
#define MIXERCONTROL_CONTROLTYPE_MUTE
Definition: mmsystem.h:384
MIXER_STATUS
Definition: mmixer.h:3
_In_ FILTER_INFORMATION_CLASS _In_ ULONG _Out_ PULONG BytesReturned
Definition: fltkernel.h:1716
MIXER_STATUS MMixerGetPhysicalConnection(IN PMIXER_CONTEXT MixerContext, IN HANDLE hMixer, IN ULONG PinId, OUT PKSPIN_PHYSICALCONNECTION *OutConnection)
Definition: filter.c:91
unsigned int * PULONG
Definition: retypes.h:1
const GUID KSNODETYPE_CHORUS
Definition: sup.c:25
#define MIXERCONTROL_CONTROLTYPE_ONOFF
Definition: mmsystem.h:383
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
#define UNIMPLEMENTED
Definition: debug.h:114
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define KSPROPERTY_TYPE_TOPOLOGY
Definition: dmksctrl.h:53
signed int * PLONG
Definition: retypes.h:5
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
Property(long _type, long _tag, INREAL _value)
Definition: reader.h:125
#define MIXERCONTROL_CONTROLTYPE_PEAKMETER
Definition: mmsystem.h:380