Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Commit 76bd798

Browse files
committed
2 parents f3032f5 + 860054b commit 76bd798

17 files changed

+2722
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
From 5320d2504651758bc787e4253a12f3ce7a99bca6 Mon Sep 17 00:00:00 2001
2+
From: Mark Harmstone <[email protected]>
3+
Date: Thu, 19 Mar 2015 21:59:29 +0000
4+
Subject: [PATCH 01/17] dsound: Apply filters before sound is multiplied to
5+
speakers.
6+
MIME-Version: 1.0
7+
Content-Type: multipart/mixed; boundary="------------2.0.5"
8+
9+
This is a multi-part message in MIME format.
10+
--------------2.0.5
11+
Content-Type: text/plain; charset=UTF-8; format=fixed
12+
Content-Transfer-Encoding: 8bit
13+
14+
---
15+
dlls/dsound/mixer.c | 97 ++++++++++++++++++++++++++++++++++++++++++-----------
16+
1 file changed, 78 insertions(+), 19 deletions(-)
17+
18+
19+
--------------2.0.5
20+
Content-Type: text/x-patch; name="0001-dsound-Apply-filters-before-sound-is-multiplied-to-s.patch"
21+
Content-Transfer-Encoding: 8bit
22+
Content-Disposition: attachment; filename="0001-dsound-Apply-filters-before-sound-is-multiplied-to-s.patch"
23+
24+
diff --git a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c
25+
index 85ab14a..c41ef3a 100644
26+
--- a/dlls/dsound/mixer.c
27+
+++ b/dlls/dsound/mixer.c
28+
@@ -266,15 +266,62 @@ static inline float get_current_sample(const IDirectSoundBufferImpl *dsb,
29+
return dsb->get(dsb, mixpos % dsb->buflen, channel);
30+
}
31+
32+
+static void apply_filters(IDirectSoundBufferImpl *dsb, float* buf, UINT count)
33+
+{
34+
+ int i;
35+
+ HRESULT hr;
36+
+
37+
+ if (count > 0) {
38+
+ for (i = 0; i < dsb->num_filters; i++) {
39+
+ if (dsb->filters[i].inplace) {
40+
+ hr = IMediaObjectInPlace_Process(dsb->filters[i].inplace, count * dsb->mix_channels * sizeof(float),
41+
+ (BYTE*)buf, 0, DMO_INPLACE_NORMAL);
42+
+
43+
+ if (FAILED(hr))
44+
+ WARN("IMediaObjectInPlace_Process failed for filter %u\n", i);
45+
+ } else
46+
+ WARN("filter %u has no inplace object - unsupported\n", i);
47+
+ }
48+
+ }
49+
+}
50+
+
51+
static UINT cp_fields_noresample(IDirectSoundBufferImpl *dsb, UINT count)
52+
{
53+
UINT istride = dsb->pwfx->nBlockAlign;
54+
UINT ostride = dsb->device->pwfx->nChannels * sizeof(float);
55+
DWORD channel, i;
56+
- for (i = 0; i < count; i++)
57+
- for (channel = 0; channel < dsb->mix_channels; channel++)
58+
- dsb->put(dsb, i * ostride, channel, get_current_sample(dsb,
59+
- dsb->sec_mixpos + i * istride, channel));
60+
+ BOOL using_filters = dsb->num_filters > 0;
61+
+ float *buf, *buftmp;
62+
+
63+
+ if (using_filters) {
64+
+ buf = HeapAlloc(GetProcessHeap(), 0, count * dsb->mix_channels * sizeof(float));
65+
+ buftmp = buf;
66+
+
67+
+ for (i = 0; i < count; i++) {
68+
+ for (channel = 0; channel < dsb->mix_channels; channel++) {
69+
+ *buftmp = get_current_sample(dsb, dsb->sec_mixpos + i*istride, channel);
70+
+ buftmp++;
71+
+ }
72+
+ }
73+
+
74+
+ apply_filters(dsb, buf, count);
75+
+
76+
+ buftmp = buf;
77+
+ for (i = 0; i < count; i++) {
78+
+ for (channel = 0; channel < dsb->mix_channels; channel++) {
79+
+ dsb->put(dsb, i * ostride, channel, *buftmp);
80+
+ buftmp++;
81+
+ }
82+
+ }
83+
+
84+
+ HeapFree(GetProcessHeap(), 0, buf);
85+
+ } else {
86+
+ for (i = 0; i < count; i++)
87+
+ for (channel = 0; channel < dsb->mix_channels; channel++)
88+
+ dsb->put(dsb, i * ostride, channel, get_current_sample(dsb,
89+
+ dsb->sec_mixpos + i * istride, channel));
90+
+ }
91+
+
92+
return count;
93+
}
94+
95+
@@ -299,6 +346,9 @@ static UINT cp_fields_resample(IDirectSoundBufferImpl *dsb, UINT count, LONG64 *
96+
float* fir_copy = HeapAlloc(GetProcessHeap(), 0,
97+
sizeof(float) * fir_cachesize);
98+
99+
+ BOOL using_filters = dsb->num_filters > 0;
100+
+ float *buf = NULL, *buftmp = NULL;
101+
+
102+
/* Important: this buffer MUST be non-interleaved
103+
* if you want -msse3 to have any effect.
104+
* This is good for CPU cache effects, too.
105+
@@ -309,6 +359,11 @@ static UINT cp_fields_resample(IDirectSoundBufferImpl *dsb, UINT count, LONG64 *
106+
*(itmp++) = get_current_sample(dsb,
107+
dsb->sec_mixpos + i * istride, channel);
108+
109+
+ if (using_filters) {
110+
+ buf = HeapAlloc(GetProcessHeap(), 0, sizeof(float) * count * dsb->mix_channels);
111+
+ buftmp = buf;
112+
+ }
113+
+
114+
for(i = 0; i < count; ++i) {
115+
UINT int_fir_steps = (freqAcc_start + i * dsb->freqAdjustNum) * dsbfirstep / dsb->freqAdjustDen;
116+
float total_fir_steps = (freqAcc_start + i * dsb->freqAdjustNum) * dsbfirstep / (float)dsb->freqAdjustDen;
117+
@@ -332,10 +387,28 @@ static UINT cp_fields_resample(IDirectSoundBufferImpl *dsb, UINT count, LONG64 *
118+
float* cache = &intermediate[channel * required_input + ipos];
119+
for (j = 0; j < fir_used; j++)
120+
sum += fir_copy[j] * cache[j];
121+
- dsb->put(dsb, i * ostride, channel, sum * dsb->firgain);
122+
+
123+
+ if (using_filters)
124+
+ *(buftmp++) = sum * dsb->firgain;
125+
+ else
126+
+ dsb->put(dsb, i * ostride, channel, sum * dsb->firgain);
127+
}
128+
}
129+
130+
+ if (using_filters) {
131+
+ apply_filters(dsb, buf, count);
132+
+
133+
+ buftmp = buf;
134+
+ for (i = 0; i < count; i++) {
135+
+ for (channel = 0; channel < dsb->mix_channels; channel++) {
136+
+ dsb->put(dsb, i * ostride, channel, *buftmp);
137+
+ buftmp++;
138+
+ }
139+
+ }
140+
+
141+
+ HeapFree(GetProcessHeap(), 0, buf);
142+
+ }
143+
+
144+
*freqAccNum = freqAcc_end % dsb->freqAdjustDen;
145+
146+
HeapFree(GetProcessHeap(), 0, fir_copy);
147+
@@ -397,8 +470,6 @@ static inline DWORD DSOUND_BufPtrDiff(DWORD buflen, DWORD ptr1, DWORD ptr2)
148+
static void DSOUND_MixToTemporary(IDirectSoundBufferImpl *dsb, DWORD frames)
149+
{
150+
UINT size_bytes = frames * sizeof(float) * dsb->device->pwfx->nChannels;
151+
- HRESULT hr;
152+
- int i;
153+
154+
if (dsb->device->tmp_buffer_len < size_bytes || !dsb->device->tmp_buffer)
155+
{
156+
@@ -410,18 +481,6 @@ static void DSOUND_MixToTemporary(IDirectSoundBufferImpl *dsb, DWORD frames)
157+
}
158+
159+
cp_fields(dsb, frames, &dsb->freqAccNum);
160+
-
161+
- if (size_bytes > 0) {
162+
- for (i = 0; i < dsb->num_filters; i++) {
163+
- if (dsb->filters[i].inplace) {
164+
- hr = IMediaObjectInPlace_Process(dsb->filters[i].inplace, size_bytes, (BYTE*)dsb->device->tmp_buffer, 0, DMO_INPLACE_NORMAL);
165+
-
166+
- if (FAILED(hr))
167+
- WARN("IMediaObjectInPlace_Process failed for filter %u\n", i);
168+
- } else
169+
- WARN("filter %u has no inplace object - unsupported\n", i);
170+
- }
171+
- }
172+
}
173+
174+
static void DSOUND_MixerVol(const IDirectSoundBufferImpl *dsb, INT frames)
175+
176+
--------------2.0.5--
177+
178+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
From 4955dfc670b462207df25d1a96efb696cf2fa301 Mon Sep 17 00:00:00 2001
2+
From: Mark Harmstone <[email protected]>
3+
Date: Sun, 15 Mar 2015 18:04:16 +0000
4+
Subject: [PATCH 02/17] dsound: Add EAX v1 constants and structs.
5+
MIME-Version: 1.0
6+
Content-Type: multipart/mixed; boundary="------------2.0.5"
7+
8+
This is a multi-part message in MIME format.
9+
--------------2.0.5
10+
Content-Type: text/plain; charset=UTF-8; format=fixed
11+
Content-Transfer-Encoding: 8bit
12+
13+
---
14+
dlls/dsound/dsound_eax.h | 89 ++++++++++++++++++++++++++++++++++++++++++++
15+
dlls/dsound/dsound_private.h | 1 +
16+
2 files changed, 90 insertions(+)
17+
create mode 100644 dlls/dsound/dsound_eax.h
18+
19+
20+
--------------2.0.5
21+
Content-Type: text/x-patch; name="0002-dsound-Add-EAX-v1-constants-and-structs.patch"
22+
Content-Transfer-Encoding: 8bit
23+
Content-Disposition: attachment; filename="0002-dsound-Add-EAX-v1-constants-and-structs.patch"
24+
25+
diff --git a/dlls/dsound/dsound_eax.h b/dlls/dsound/dsound_eax.h
26+
new file mode 100644
27+
index 0000000..600029f
28+
--- /dev/null
29+
+++ b/dlls/dsound/dsound_eax.h
30+
@@ -0,0 +1,89 @@
31+
+/*
32+
+ * Copyright (c) 2015 Mark Harmstone
33+
+ *
34+
+ * This library is free software; you can redistribute it and/or
35+
+ * modify it under the terms of the GNU Lesser General Public
36+
+ * License as published by the Free Software Foundation; either
37+
+ * version 2.1 of the License, or (at your option) any later version.
38+
+ *
39+
+ * This library is distributed in the hope that it will be useful,
40+
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
41+
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42+
+ * Lesser General Public License for more details.
43+
+ *
44+
+ * You should have received a copy of the GNU Lesser General Public
45+
+ * License along with this library; if not, write to the Free Software
46+
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
47+
+ */
48+
+
49+
+#ifndef DSOUND_EAX_H_DEFINED
50+
+#define DSOUND_EAX_H_DEFINED
51+
+
52+
+#ifdef __cplusplus
53+
+extern "C" {
54+
+#endif
55+
+
56+
+DEFINE_GUID(DSPROPSETID_EAX_ReverbProperties, 0x4a4e6fc1, 0xc341, 0x11d1, 0xb7, 0x3a, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00);
57+
+DEFINE_GUID(DSPROPSETID_EAXBUFFER_ReverbProperties, 0x4a4e6fc0, 0xc341, 0x11d1, 0xb7, 0x3a, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00);
58+
+
59+
+typedef enum {
60+
+ DSPROPERTY_EAX_ALL,
61+
+ DSPROPERTY_EAX_ENVIRONMENT,
62+
+ DSPROPERTY_EAX_VOLUME,
63+
+ DSPROPERTY_EAX_DECAYTIME,
64+
+ DSPROPERTY_EAX_DAMPING
65+
+} DSPROPERTY_EAX_REVERBPROPERTY;
66+
+
67+
+typedef struct {
68+
+ unsigned long environment;
69+
+ float fVolume;
70+
+ float fDecayTime_sec;
71+
+ float fDamping;
72+
+} EAX_REVERBPROPERTIES;
73+
+
74+
+enum {
75+
+ EAX_ENVIRONMENT_GENERIC,
76+
+ EAX_ENVIRONMENT_PADDEDCELL,
77+
+ EAX_ENVIRONMENT_ROOM,
78+
+ EAX_ENVIRONMENT_BATHROOM,
79+
+ EAX_ENVIRONMENT_LIVINGROOM,
80+
+ EAX_ENVIRONMENT_STONEROOM,
81+
+ EAX_ENVIRONMENT_AUDITORIUM,
82+
+ EAX_ENVIRONMENT_CONCERTHALL,
83+
+ EAX_ENVIRONMENT_CAVE,
84+
+ EAX_ENVIRONMENT_ARENA,
85+
+ EAX_ENVIRONMENT_HANGAR,
86+
+ EAX_ENVIRONMENT_CARPETEDHALLWAY,
87+
+ EAX_ENVIRONMENT_HALLWAY,
88+
+ EAX_ENVIRONMENT_STONECORRIDOR,
89+
+ EAX_ENVIRONMENT_ALLEY,
90+
+ EAX_ENVIRONMENT_FOREST,
91+
+ EAX_ENVIRONMENT_CITY,
92+
+ EAX_ENVIRONMENT_MOUNTAINS,
93+
+ EAX_ENVIRONMENT_QUARRY,
94+
+ EAX_ENVIRONMENT_PLAIN,
95+
+ EAX_ENVIRONMENT_PARKINGLOT,
96+
+ EAX_ENVIRONMENT_SEWERPIPE,
97+
+ EAX_ENVIRONMENT_UNDERWATER,
98+
+ EAX_ENVIRONMENT_DRUGGED,
99+
+ EAX_ENVIRONMENT_DIZZY,
100+
+ EAX_ENVIRONMENT_PSYCHOTIC,
101+
+ EAX_ENVIRONMENT_COUNT
102+
+};
103+
+
104+
+typedef enum {
105+
+ DSPROPERTY_EAXBUFFER_ALL,
106+
+ DSPROPERTY_EAXBUFFER_REVERBMIX
107+
+} DSPROPERTY_EAXBUFFER_REVERBPROPERTY;
108+
+
109+
+typedef struct {
110+
+ float fMix;
111+
+} EAXBUFFER_REVERBPROPERTIES;
112+
+
113+
+#define EAX_REVERBMIX_USEDISTANCE -1.0f
114+
+
115+
+#ifdef __cplusplus
116+
+}
117+
+#endif
118+
+
119+
+#endif
120+
diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h
121+
index 9c001ed..274c2a6 100644
122+
--- a/dlls/dsound/dsound_private.h
123+
+++ b/dlls/dsound/dsound_private.h
124+
@@ -29,6 +29,7 @@
125+
#include "mediaobj.h"
126+
#include "mmsystem.h"
127+
#include "uuids.h"
128+
+#include "dsound_eax.h"
129+
130+
#include "wine/list.h"
131+
132+
133+
--------------2.0.5--
134+
135+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
From d440a67426a4222193b6148b6707f00fe8ce66bc Mon Sep 17 00:00:00 2001
2+
From: Mark Harmstone <[email protected]>
3+
Date: Sun, 15 Mar 2015 18:04:38 +0000
4+
Subject: [PATCH 03/17] dsound: Report that we support EAX v1.
5+
MIME-Version: 1.0
6+
Content-Type: multipart/mixed; boundary="------------2.0.5"
7+
8+
This is a multi-part message in MIME format.
9+
--------------2.0.5
10+
Content-Type: text/plain; charset=UTF-8; format=fixed
11+
Content-Transfer-Encoding: 8bit
12+
13+
---
14+
dlls/dsound/buffer.c | 12 ++++++++++++
15+
1 file changed, 12 insertions(+)
16+
17+
18+
--------------2.0.5
19+
Content-Type: text/x-patch; name="0003-dsound-Report-that-we-support-EAX-v1.patch"
20+
Content-Transfer-Encoding: 8bit
21+
Content-Disposition: attachment; filename="0003-dsound-Report-that-we-support-EAX-v1.patch"
22+
23+
diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c
24+
index 4e84d17..c540c35 100644
25+
--- a/dlls/dsound/buffer.c
26+
+++ b/dlls/dsound/buffer.c
27+
@@ -1319,6 +1319,18 @@ static HRESULT WINAPI IKsPropertySetImpl_QuerySupport(IKsPropertySet *iface, REF
28+
29+
TRACE("(%p,%s,%d,%p)\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport);
30+
31+
+ if (IsEqualGUID(&DSPROPSETID_EAX_ReverbProperties, guidPropSet)) {
32+
+ if (dwPropID <= DSPROPERTY_EAX_DAMPING) {
33+
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET;
34+
+ return S_OK;
35+
+ }
36+
+ } else if (IsEqualGUID(&DSPROPSETID_EAXBUFFER_ReverbProperties, guidPropSet)) {
37+
+ if (dwPropID <= DSPROPERTY_EAXBUFFER_REVERBMIX) {
38+
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET;
39+
+ return S_OK;
40+
+ }
41+
+ }
42+
+
43+
return E_PROP_ID_UNSUPPORTED;
44+
}
45+
46+
47+
--------------2.0.5--
48+
49+

0 commit comments

Comments
 (0)