Rebase against 975d0632a19efd41338cb73a97f1b0bdbe7bc0cc.

This commit is contained in:
Alistair Leslie-Hughes
2021-09-21 09:08:59 +10:00
parent 2771ab8cee
commit a1db1dfc16
31 changed files with 313 additions and 327 deletions

View File

@@ -1,20 +1,20 @@
From f02dd0110ae95771a6e44a608c724d964fab7f68 Mon Sep 17 00:00:00 2001
From 2af1ec49d958424e2b78f52ae3e3daca1d562b35 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 28 Mar 2015 08:18:10 +0100
Subject: dsound: Apply filters before sound is multiplied to speakers.
Subject: [PATCH] dsound: Apply filters before sound is multiplied to speakers.
Based on a patch by Mark Harmstone.
---
dlls/dsound/dsound.c | 2 +
dlls/dsound/dsound_private.h | 4 +-
dlls/dsound/mixer.c | 110 ++++++++++++++++++++++++-----------
3 files changed, 81 insertions(+), 35 deletions(-)
dlls/dsound/mixer.c | 109 ++++++++++++++++++++++++-----------
3 files changed, 80 insertions(+), 35 deletions(-)
diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c
index 71ede7d8..cc8b4444 100644
index 3085d86e5b5..91fa94b943e 100644
--- a/dlls/dsound/dsound.c
+++ b/dlls/dsound/dsound.c
@@ -233,6 +233,8 @@ static ULONG DirectSoundDevice_Release(DirectSoundDevice * device)
@@ -234,6 +234,8 @@ static ULONG DirectSoundDevice_Release(DirectSoundDevice * device)
if(device->mmdevice)
IMMDevice_Release(device->mmdevice);
CloseHandle(device->sleepev);
@@ -24,10 +24,10 @@ index 71ede7d8..cc8b4444 100644
HeapFree(GetProcessHeap(), 0, device->cp_buffer);
HeapFree(GetProcessHeap(), 0, device->buffer);
diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h
index c9ae7fd7..371cc5fb 100644
index 2408f80ba82..2e23f222b03 100644
--- a/dlls/dsound/dsound_private.h
+++ b/dlls/dsound/dsound_private.h
@@ -90,8 +90,8 @@ struct DirectSoundDevice
@@ -89,8 +89,8 @@ struct DirectSoundDevice
int speaker_num[DS_MAX_CHANNELS];
int num_speakers;
int lfe_channel;
@@ -39,11 +39,11 @@ index c9ae7fd7..371cc5fb 100644
DSVOLUMEPAN volpan;
diff --git a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c
index 1643e7d4..d4dbdc15 100644
index 1877d61cbf0..13bff1b9ae7 100644
--- a/dlls/dsound/mixer.c
+++ b/dlls/dsound/mixer.c
@@ -278,23 +278,22 @@ static inline float get_current_sample(const IDirectSoundBufferImpl *dsb,
return dsb->get(dsb, mixpos % dsb->buflen, channel);
@@ -283,10 +283,9 @@ static inline float get_current_sample(const IDirectSoundBufferImpl *dsb,
return dsb->get(dsb, buffer + (mixpos % buflen), channel);
}
-static UINT cp_fields_noresample(IDirectSoundBufferImpl *dsb, UINT count)
@@ -51,13 +51,17 @@ index 1643e7d4..d4dbdc15 100644
{
UINT istride = dsb->pwfx->nBlockAlign;
- UINT ostride = dsb->device->pwfx->nChannels * sizeof(float);
UINT committed_samples = 0;
DWORD channel, i;
for (i = 0; i < count; i++)
@@ -302,17 +301,16 @@ static UINT cp_fields_noresample(IDirectSoundBufferImpl *dsb, UINT count)
for (; i < count; i++)
for (channel = 0; channel < dsb->mix_channels; channel++)
- dsb->put(dsb, i * ostride, channel, get_current_sample(dsb,
- dsb->sec_mixpos + i * istride, channel));
+ put(dsb, i * ostride, channel, get_current_sample(dsb,
+ dsb->sec_mixpos + i * istride, channel));
- dsb->put(dsb, i * ostride, channel, get_current_sample(dsb, dsb->buffer->memory,
+ put(dsb, i * ostride, channel, get_current_sample(dsb, dsb->buffer->memory,
dsb->buflen, dsb->sec_mixpos + i * istride, channel));
-
return count;
}
@@ -71,16 +75,16 @@ index 1643e7d4..d4dbdc15 100644
UINT channels = dsb->mix_channels;
LONG64 freqAcc_start = *freqAccNum;
@@ -322,7 +321,7 @@ static UINT cp_fields_resample_lq(IDirectSoundBufferImpl *dsb, UINT count, LONG6
float s1 = get_current_sample(dsb, idx, channel);
float s2 = get_current_sample(dsb, idx + istride, channel);
@@ -340,7 +338,7 @@ static UINT cp_fields_resample_lq(IDirectSoundBufferImpl *dsb, UINT count, LONG6
float s1 = get_current_sample(dsb, dsb->buffer->memory, dsb->buflen, idx, channel);
float s2 = get_current_sample(dsb, dsb->buffer->memory, dsb->buflen, idx + istride, channel);
float result = s1 * cur_freqAcc2 + s2 * cur_freqAcc;
- dsb->put(dsb, i * ostride, channel, result);
+ put(dsb, i * ostride, channel, result);
}
}
@@ -330,11 +329,11 @@ static UINT cp_fields_resample_lq(IDirectSoundBufferImpl *dsb, UINT count, LONG6
@@ -348,11 +346,11 @@ static UINT cp_fields_resample_lq(IDirectSoundBufferImpl *dsb, UINT count, LONG6
return max_ipos;
}
@@ -91,10 +95,10 @@ index 1643e7d4..d4dbdc15 100644
UINT i, channel;
UINT istride = dsb->pwfx->nBlockAlign;
- UINT ostride = dsb->device->pwfx->nChannels * sizeof(float);
UINT committed_samples = 0;
LONG64 freqAcc_start = *freqAccNum;
LONG64 freqAcc_end = freqAcc_start + count * dsb->freqAdjustNum;
@@ -395,7 +394,7 @@ static UINT cp_fields_resample_hq(IDirectSoundBufferImpl *dsb, UINT count, LONG6
@@ -422,7 +420,7 @@ static UINT cp_fields_resample_hq(IDirectSoundBufferImpl *dsb, UINT count, LONG6
float* cache = &intermediate[channel * required_input + ipos];
for (j = 0; j < fir_used; j++)
sum += fir_copy[j] * cache[j];
@@ -103,7 +107,7 @@ index 1643e7d4..d4dbdc15 100644
}
}
@@ -404,16 +403,17 @@ static UINT cp_fields_resample_hq(IDirectSoundBufferImpl *dsb, UINT count, LONG6
@@ -431,16 +429,17 @@ static UINT cp_fields_resample_hq(IDirectSoundBufferImpl *dsb, UINT count, LONG6
return max_ipos;
}
@@ -125,7 +129,7 @@ index 1643e7d4..d4dbdc15 100644
ipos = dsb->sec_mixpos + adv * dsb->pwfx->nBlockAlign;
if (ipos >= dsb->buflen) {
@@ -443,6 +443,21 @@ static inline DWORD DSOUND_BufPtrDiff(DWORD buflen, DWORD ptr1, DWORD ptr2)
@@ -476,6 +475,21 @@ static inline DWORD DSOUND_BufPtrDiff(DWORD buflen, DWORD ptr1, DWORD ptr2)
return buflen + ptr1 - ptr2;
}
}
@@ -147,7 +151,7 @@ index 1643e7d4..d4dbdc15 100644
/**
* Mix at most the given amount of data into the allocated temporary buffer
* of the given secondary buffer, starting from the dsb's first currently
@@ -458,34 +473,63 @@ static inline DWORD DSOUND_BufPtrDiff(DWORD buflen, DWORD ptr1, DWORD ptr2)
@@ -491,34 +505,63 @@ static inline DWORD DSOUND_BufPtrDiff(DWORD buflen, DWORD ptr1, DWORD ptr2)
*/
static void DSOUND_MixToTemporary(IDirectSoundBufferImpl *dsb, DWORD frames)
{
@@ -231,5 +235,5 @@ index 1643e7d4..d4dbdc15 100644
static void DSOUND_MixerVol(const IDirectSoundBufferImpl *dsb, INT frames)
--
2.19.1
2.33.0

View File

@@ -1,22 +1,22 @@
From 43637cb46c48e84e7f1b127ba4427900c76f2470 Mon Sep 17 00:00:00 2001
From f4e3bbf1a91a5a99d703d3fee9a81a5c5089ab79 Mon Sep 17 00:00:00 2001
From: Mark Harmstone <mark@harmstone.com>
Date: Fri, 27 Mar 2015 20:48:19 +0000
Subject: dsound: Support getting and setting EAX buffer properties.
Subject: [PATCH] dsound: Support getting and setting EAX buffer properties.
---
dlls/dsound/buffer.c | 2 ++
dlls/dsound/dsound_eax.h | 4 +++
dlls/dsound/dsound_private.h | 2 ++
dlls/dsound/eax.c | 64 ++++++++++++++++++++++++++++++++++++++++++++
dlls/dsound/eax.c | 64 ++++++++++++++++++++++++++++++++++++
4 files changed, 72 insertions(+)
diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c
index 0596ce3..1c318f5 100644
index b7a0fb26c4b..0aff7c96842 100644
--- a/dlls/dsound/buffer.c
+++ b/dlls/dsound/buffer.c
@@ -1092,6 +1092,8 @@ HRESULT IDirectSoundBufferImpl_Create(
/* calculate fragment size and write lead */
DSOUND_RecalcFormat(dsb);
@@ -1127,6 +1127,8 @@ HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *ds
return DSERR_OUTOFMEMORY;
}
+ dsb->eax.reverb_mix = EAX_REVERBMIX_USEDISTANCE;
+
@@ -24,7 +24,7 @@ index 0596ce3..1c318f5 100644
dsb->ds3db_ds3db.dwSize = sizeof(DS3DBUFFER);
dsb->ds3db_ds3db.vPosition.x = 0.0;
diff --git a/dlls/dsound/dsound_eax.h b/dlls/dsound/dsound_eax.h
index c90d82d..2ee83b9 100644
index c90d82d9a3f..2ee83b94ff9 100644
--- a/dlls/dsound/dsound_eax.h
+++ b/dlls/dsound/dsound_eax.h
@@ -119,6 +119,10 @@ typedef struct {
@@ -39,10 +39,10 @@ index c90d82d..2ee83b9 100644
}
#endif
diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h
index c16f770..c732b52 100644
index a11379f0f88..9b537ad80a5 100644
--- a/dlls/dsound/dsound_private.h
+++ b/dlls/dsound/dsound_private.h
@@ -176,6 +176,8 @@ struct IDirectSoundBufferImpl
@@ -177,6 +177,8 @@ struct IDirectSoundBufferImpl
int num_filters;
DSFilter* filters;
@@ -52,13 +52,14 @@ index c16f770..c732b52 100644
};
diff --git a/dlls/dsound/eax.c b/dlls/dsound/eax.c
index cdd03be..3931681 100644
index cdd03becbee..3931681d295 100644
--- a/dlls/dsound/eax.c
+++ b/dlls/dsound/eax.c
@@ -179,6 +179,38 @@ HRESULT WINAPI EAX_Get(IDirectSoundBufferImpl *buf, REFGUID guidPropSet,
@@ -178,6 +178,38 @@ HRESULT WINAPI EAX_Get(IDirectSoundBufferImpl *buf, REFGUID guidPropSet,
return E_PROP_ID_UNSUPPORTED;
}
return S_OK;
+ return S_OK;
+ } else if (IsEqualGUID(&DSPROPSETID_EAXBUFFER_ReverbProperties, guidPropSet)) {
+ EAXBUFFER_REVERBPROPERTIES *props;
+
@@ -90,14 +91,14 @@ index cdd03be..3931681 100644
+ return E_PROP_ID_UNSUPPORTED;
+ }
+
+ return S_OK;
return S_OK;
}
return E_PROP_ID_UNSUPPORTED;
@@ -276,6 +308,38 @@ HRESULT WINAPI EAX_Set(IDirectSoundBufferImpl *buf, REFGUID guidPropSet,
@@ -275,6 +307,38 @@ HRESULT WINAPI EAX_Set(IDirectSoundBufferImpl *buf, REFGUID guidPropSet,
return E_PROP_ID_UNSUPPORTED;
}
return S_OK;
+ return S_OK;
+ } else if (IsEqualGUID(&DSPROPSETID_EAXBUFFER_ReverbProperties, guidPropSet)) {
+ EAXBUFFER_REVERBPROPERTIES *props;
+
@@ -129,10 +130,9 @@ index cdd03be..3931681 100644
+ return E_PROP_ID_UNSUPPORTED;
+ }
+
+ return S_OK;
return S_OK;
}
return E_PROP_ID_UNSUPPORTED;
--
2.3.3
2.33.0

View File

@@ -1,4 +1,4 @@
From 66c0779d339d5d27753e6f0ac6509741b908cca1 Mon Sep 17 00:00:00 2001
From 3760db8daceee555842425400af01de2075b4568 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 4 Apr 2015 21:09:18 +0200
Subject: [PATCH] dsound: Various improvements to EAX support.
@@ -16,28 +16,19 @@ update it later when necessary (-> much faster). Moreover, to avoid unnecessary
locking, we initialize the EAX-specific properties always (for both the device and
the buffers).
---
dlls/dsound/buffer.c | 6 ++--
dlls/dsound/buffer.c | 4 ++-
dlls/dsound/dsound.c | 2 ++
dlls/dsound/dsound_eax.h | 1 +
dlls/dsound/dsound_private.h | 1 +
dlls/dsound/eax.c | 68 ++++++++++++++++--------------------
5 files changed, 37 insertions(+), 41 deletions(-)
5 files changed, 37 insertions(+), 39 deletions(-)
diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c
index 030f0849fed..252122d0374 100644
index 6b7414d34ff..b1efa0d3012 100644
--- a/dlls/dsound/buffer.c
+++ b/dlls/dsound/buffer.c
@@ -1084,8 +1084,6 @@ HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *ds
/* calculate fragment size and write lead */
DSOUND_RecalcFormat(dsb);
- dsb->eax.reverb_mix = EAX_REVERBMIX_USEDISTANCE;
-
if (dsb->dsbd.dwFlags & DSBCAPS_CTRL3D) {
dsb->ds3db_ds3db.dwSize = sizeof(DS3DBUFFER);
dsb->ds3db_ds3db.vPosition.x = 0.0;
@@ -1168,7 +1166,7 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
HRESULT hres = DS_OK;
@@ -1213,7 +1213,7 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
VOID *committedbuff;
TRACE("(%p,%p,%p)\n", device, ppdsb, pdsb);
- dsb = HeapAlloc(GetProcessHeap(),0,sizeof(*dsb));
@@ -45,7 +36,7 @@ index 030f0849fed..252122d0374 100644
if (dsb == NULL) {
WARN("out of memory\n");
*ppdsb = NULL;
@@ -1205,6 +1203,8 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
@@ -1261,6 +1261,8 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
InitializeSRWLock(&dsb->lock);
@@ -80,10 +71,10 @@ index a650108f570..a555a75e458 100644
float *SampleBuffer;
diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h
index 110dfe2c207..bca2bf46601 100644
index 43e62626161..065fe820055 100644
--- a/dlls/dsound/dsound_private.h
+++ b/dlls/dsound/dsound_private.h
@@ -234,6 +234,7 @@ HRESULT WINAPI EAX_Get(IDirectSoundBufferImpl *buf, REFGUID guidPropSet,
@@ -239,6 +239,7 @@ HRESULT WINAPI EAX_Get(IDirectSoundBufferImpl *buf, REFGUID guidPropSet,
HRESULT WINAPI EAX_Set(IDirectSoundBufferImpl *buf, REFGUID guidPropSet,
ULONG dwPropID, void *pInstanceData, ULONG cbInstanceData, void *pPropData,
ULONG cbPropData) DECLSPEC_HIDDEN;
@@ -92,7 +83,7 @@ index 110dfe2c207..bca2bf46601 100644
void init_eax_buffer(IDirectSoundBufferImpl *dsb) DECLSPEC_HIDDEN;
void process_eax_buffer(IDirectSoundBufferImpl *dsb, float *buf, DWORD count) DECLSPEC_HIDDEN;
diff --git a/dlls/dsound/eax.c b/dlls/dsound/eax.c
index a05b00e1c02..535ff92d44d 100644
index a05b00e1c02..ef802b95a7d 100644
--- a/dlls/dsound/eax.c
+++ b/dlls/dsound/eax.c
@@ -114,6 +114,8 @@ static const float LATE_LINE_MULTIPLIER = 4.0f;
@@ -253,5 +244,5 @@ index a05b00e1c02..535ff92d44d 100644
switch (dwPropID) {
case DSPROPERTY_EAXBUFFER_ALL:
--
2.27.0
2.33.0