This repository has been archived by the owner on Oct 1, 2020. It is now read-only.
/
0001-Revert-dsound-Use-a-better-name-for-IDirectSoundBuff.patch
106 lines (95 loc) · 4.03 KB
/
0001-Revert-dsound-Use-a-better-name-for-IDirectSoundBuff.patch
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
From 49a87ca03766da11e80ec5f0677d1cd7d46b17ca Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 23 Dec 2015 00:58:57 +0100
Subject: Revert "dsound: Use a better name for
IDirectSoundBufferImpl_Create()."
This reverts commit bb72548f3870b1df03ad9fe7ad2e543a69d5d574.
---
dlls/dsound/buffer.c | 24 +++++++++++++++---------
dlls/dsound/dsound.c | 7 +++++--
dlls/dsound/dsound_private.h | 6 ++++--
3 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c
index e85a5d1..c59090a 100644
--- a/dlls/dsound/buffer.c
+++ b/dlls/dsound/buffer.c
@@ -983,15 +983,19 @@ static const IDirectSoundBuffer8Vtbl dsbvt =
IDirectSoundBufferImpl_GetObjectInPath
};
-HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *dsbd,
- IDirectSoundBuffer **buffer)
+HRESULT IDirectSoundBufferImpl_Create(
+ DirectSoundDevice * device,
+ IDirectSoundBufferImpl **pdsb,
+ LPCDSBUFFERDESC dsbd)
{
IDirectSoundBufferImpl *dsb;
LPWAVEFORMATEX wfex = dsbd->lpwfxFormat;
HRESULT err = DS_OK;
DWORD capf = 0;
- TRACE("(%p,%p,%p)\n", device, dsbd, buffer);
+ TRACE("(%p,%p,%p)\n",device,pdsb,dsbd);
+
+ *pdsb = NULL;
if (dsbd->dwBufferBytes < DSBSIZE_MIN || dsbd->dwBufferBytes > DSBSIZE_MAX) {
WARN("invalid parameter: dsbd->dwBufferBytes = %d\n", dsbd->dwBufferBytes);
@@ -1103,12 +1107,14 @@ HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *ds
RtlInitializeResource(&dsb->lock);
- /* register buffer */
- err = DirectSoundDevice_AddBuffer(device, dsb);
- if (err == DS_OK)
- *buffer = (IDirectSoundBuffer*)&dsb->IDirectSoundBuffer8_iface;
- else
- IDirectSoundBuffer8_Release(&dsb->IDirectSoundBuffer8_iface);
+ /* register buffer if not primary */
+ if (!(dsbd->dwFlags & DSBCAPS_PRIMARYBUFFER)) {
+ err = DirectSoundDevice_AddBuffer(device, dsb);
+ if (err == DS_OK)
+ *pdsb = dsb;
+ else
+ IDirectSoundBuffer8_Release(&dsb->IDirectSoundBuffer8_iface);
+ }
return err;
}
diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c
index fb9fd66..64bfbd3 100644
--- a/dlls/dsound/dsound.c
+++ b/dlls/dsound/dsound.c
@@ -461,6 +461,8 @@ static HRESULT DirectSoundDevice_CreateSoundBuffer(
WARN("primarybuffer_create() failed\n");
}
} else {
+ IDirectSoundBufferImpl * dsb;
+
if (dsbd->lpwfxFormat == NULL) {
WARN("invalid parameter: dsbd->lpwfxFormat can't be NULL for "
"secondary buffer\n");
@@ -537,8 +539,9 @@ static HRESULT DirectSoundDevice_CreateSoundBuffer(
return DSERR_INVALIDPARAM;
}
- hres = secondarybuffer_create(device, dsbd, ppdsb);
- if (SUCCEEDED(hres)) {
+ hres = IDirectSoundBufferImpl_Create(device, &dsb, dsbd);
+ if (dsb) {
+ *ppdsb = (IDirectSoundBuffer*)&dsb->IDirectSoundBuffer8_iface;
if (dsbd->dwFlags & DSBCAPS_LOCHARDWARE)
device->drvcaps.dwFreeHwMixingAllBuffers--;
} else
diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h
index 63d1226..303ce0e 100644
--- a/dlls/dsound/dsound_private.h
+++ b/dlls/dsound/dsound_private.h
@@ -181,8 +181,10 @@ void put_stereo2surround51(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD c
void put_surround512stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN;
void put_quad2stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN;
-HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *dsbd,
- IDirectSoundBuffer **buffer) DECLSPEC_HIDDEN;
+HRESULT IDirectSoundBufferImpl_Create(
+ DirectSoundDevice *device,
+ IDirectSoundBufferImpl **ppdsb,
+ LPCDSBUFFERDESC dsbd) DECLSPEC_HIDDEN;
HRESULT IDirectSoundBufferImpl_Duplicate(
DirectSoundDevice *device,
IDirectSoundBufferImpl **ppdsb,
--
2.8.0