ReactOS 0.4.15-dev-8119-g4fb2fdb
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 NDEBUG
12#include <debug.h>
13
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 */
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 */
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{
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 */
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
138ULONG
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 /* stero wide control */
187 }
189 {
190 /* chorus control */
192 }
194 {
195 /* reverb control */
197 }
199 {
200 /* supermix control
201 * MIXERCONTROL_CONTROLTYPE_MUTE if KSPROPERTY_AUDIO_MUTE is supported
202 */
205 }
206 /* TODO
207 * check for other supported node types
208 */
209 //UNIMPLEMENTED;
210 return 0;
211}
212
217 IN ULONG NodeId,
218 IN ULONG bSet,
220 IN ULONG Channel,
221 IN PLONG InputValue)
222{
225 LONG Value;
227
228 if (bSet)
229 Value = *InputValue;
230
231 /* setup the request */
233
234 Property.NodeProperty.NodeId = NodeId;
235 Property.NodeProperty.Property.Id = PropertyId;
236 Property.NodeProperty.Property.Flags = KSPROPERTY_TYPE_TOPOLOGY;
237 Property.NodeProperty.Property.Set = KSPROPSETID_Audio;
238 Property.Channel = Channel;
239 Property.Reserved = 0;
240
241 if (bSet)
242 Property.NodeProperty.Property.Flags |= KSPROPERTY_TYPE_SET;
243 else
244 Property.NodeProperty.Property.Flags |= KSPROPERTY_TYPE_GET;
245
246 /* send the request */
248
249 if (!bSet && Status == MM_STATUS_SUCCESS)
250 {
251 *InputValue = Value;
252 }
253
254 DPRINT("Status %x bSet %u NodeId %u Value %d PropertyId %u\n", Status, bSet, NodeId, Value, PropertyId);
255 return Status;
256}
257
258ULONG
261 HANDLE hFilter,
262 ULONG PinId)
263{
264 KSP_PIN PinRequest;
265 KSPIN_CINSTANCES PinInstances;
268
269 /* query the instance count */
270 PinRequest.Reserved = 0;
271 PinRequest.PinId = PinId;
272 PinRequest.Property.Set = KSPROPSETID_Pin;
275
276 Status = MixerContext->Control(hFilter, IOCTL_KS_PROPERTY, (PVOID)&PinRequest, sizeof(KSP_PIN), (PVOID)&PinInstances, sizeof(KSPIN_CINSTANCES), &BytesReturned);
278 return PinInstances.CurrentCount;
279}
NodeType
Definition: Node.h:6
#define UNIMPLEMENTED
Definition: debug.h:118
_In_ PSTORAGE_PROPERTY_ID PropertyId
Definition: cdrom.h:932
#define NULL
Definition: types.h:112
MIXER_CONTEXT MixerContext
Definition: mmixer.c:41
const GUID KSPROPSETID_Pin
Definition: filter.c:47
const GUID KSPROPSETID_Topology
Definition: filter.c:46
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
#define KSPROPERTY_TYPE_TOPOLOGY
Definition: dmksctrl.h:53
struct KSIDENTIFIER KSPROPERTY
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:427
Status
Definition: gdiplustypes.h:25
struct KSPIN_PHYSICALCONNECTION * PKSPIN_PHYSICALCONNECTION
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
@ KSPROPERTY_PIN_CINSTANCES
Definition: ks.h:625
@ KSPROPERTY_PIN_PHYSICALCONNECTION
Definition: ks.h:635
@ KSPROPERTY_PIN_CTYPES
Definition: ks.h:626
struct KSMULTIPLE_ITEM * PKSMULTIPLE_ITEM
#define KSNODETYPE_TONE
Definition: ksmedia.h:453
#define KSNODETYPE_LOUDNESS
Definition: ksmedia.h:398
#define KSNODETYPE_MUX
Definition: ksmedia.h:433
#define KSNODETYPE_REVERB
Definition: ksmedia.h:312
#define KSNODETYPE_CHORUS
Definition: ksmedia.h:307
#define KSNODETYPE_VOLUME
Definition: ksmedia.h:338
#define KSNODETYPE_MUTE
Definition: ksmedia.h:348
#define KSNODETYPE_AGC
Definition: ksmedia.h:267
#define KSNODETYPE_SUPERMIX
Definition: ksmedia.h:277
#define KSNODETYPE_PEAKMETER
Definition: ksmedia.h:443
#define KSNODETYPE_STEREO_WIDE
Definition: ksmedia.h:448
#define KSPROPSETID_Audio
Definition: ksmedia.h:1051
MIXER_STATUS
Definition: mmixer.h:4
@ MM_STATUS_UNSUCCESSFUL
Definition: mmixer.h:11
@ MM_STATUS_NO_MEMORY
Definition: mmixer.h:12
@ MM_STATUS_SUCCESS
Definition: mmixer.h:5
@ MM_STATUS_MORE_ENTRIES
Definition: mmixer.h:9
#define MIXERCONTROL_CONTROLTYPE_ONOFF
Definition: mmsystem.h:383
#define MIXERCONTROL_CONTROLTYPE_MUX
Definition: mmsystem.h:403
#define MIXERCONTROL_CONTROLTYPE_LOUDNESS
Definition: mmsystem.h:386
#define MIXERCONTROL_CONTROLTYPE_FADER
Definition: mmsystem.h:397
#define MIXERCONTROL_CONTROLTYPE_VOLUME
Definition: mmsystem.h:398
#define MIXERCONTROL_CONTROLTYPE_PEAKMETER
Definition: mmsystem.h:380
#define MIXERCONTROL_CONTROLTYPE_MUTE
Definition: mmsystem.h:384
#define ASSERT(a)
Definition: mode.c:44
HMIXER hMixer
Definition: test.c:10
long LONG
Definition: pedump.c:60
ULONG MMixerGetFilterPinCount(IN PMIXER_CONTEXT MixerContext, IN HANDLE hMixer)
Definition: filter.c:15
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:214
MIXER_STATUS MMixerGetPhysicalConnection(IN PMIXER_CONTEXT MixerContext, IN HANDLE hMixer, IN ULONG PinId, OUT PKSPIN_PHYSICALCONNECTION *OutConnection)
Definition: filter.c:91
ULONG MMixerGetControlTypeFromTopologyNode(IN LPGUID NodeType)
Definition: filter.c:139
MIXER_STATUS MMixerGetFilterTopologyProperty(IN PMIXER_CONTEXT MixerContext, IN HANDLE hMixer, IN ULONG PropertyId, OUT PKSMULTIPLE_ITEM *OutMultipleItem)
Definition: filter.c:39
ULONG MMixerGetPinInstanceCount(PMIXER_CONTEXT MixerContext, HANDLE hFilter, ULONG PinId)
Definition: filter.c:259
#define DPRINT
Definition: sndvol32.h:73
ULONG Id
Definition: dmksctrl.h:77
ULONG Flags
Definition: dmksctrl.h:78
GUID Set
Definition: dmksctrl.h:76
ULONG CurrentCount
Definition: ks.h:652
Definition: ks.h:642
ULONG Reserved
Definition: ks.h:645
KSPROPERTY Property
Definition: ks.h:643
ULONG PinId
Definition: ks.h:644
PMIXER_DEVICE_CONTROL Control
Definition: mmixer.h:95
PMIXER_FREE Free
Definition: mmixer.h:96
PMIXER_ALLOC Alloc
Definition: mmixer.h:94
Property(long _type, long _tag, INREAL _value)
Definition: reader.h:125
ULONG Flags
Definition: ntfs.h:536
uint32_t * PULONG
Definition: typedefs.h:59
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
int32_t * PLONG
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_ ULONG _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesReturned
Definition: wdfiotarget.h:1052
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:235