[Bug 14717] resampled sound is horrible
wine-bugs at winehq.org
wine-bugs at winehq.org
Sun Jan 2 10:56:28 CST 2011
http://bugs.winehq.org/show_bug.cgi?id=14717
--- Comment #115 from Krzysztof Nikiel <zzdz2 at yahoo.pl> 2011-01-02 10:56:28 CST ---
(In reply to comment #112)
> Clicks for resampled sound are indeed gone. However, they appeared for the case
> when there is no change in the sample rate. I guess that the resampling delay
> should be added to the write lead, not used instead of it. Could you please
> change the patch?
OK, the initial modification was too quick.
This should make it better:
diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c
index 3148502..10e68c8 100644
--- a/dlls/dsound/buffer.c
+++ b/dlls/dsound/buffer.c
@@ -500,6 +500,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Lock(
) {
HRESULT hres = DS_OK;
IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface;
+ INT firspace;
TRACE("(%p,%d,%d,%p,%p,%p,%p,0x%08x) at %d\n",
This,
@@ -542,9 +543,11 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Lock(
return DSERR_INVALIDPARAM;
}
- writebytes -= This->firdelay;
- if ((INT)writebytes < 0)
- writebytes = 0;
+ firspace = This->inpos - This->firdelay - writecursor;
+ while (firspace < 0)
+ firspace += This->buflen;
+ if (writebytes > firspace)
+ writebytes = firspace;
/* **** */
RtlAcquireResourceShared(&This->lock, TRUE);
diff --git a/dlls/dsound/resample.c b/dlls/dsound/resample.c
index d2bbda2..3204a2b 100644
--- a/dlls/dsound/resample.c
+++ b/dlls/dsound/resample.c
@@ -47,7 +47,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dsound);
#define SAMPLE24(p) (*((BYTE*)p)|*((BYTE*)p+1)<<8|*((CHAR*)p+2)<<16)
#ifdef WORDS_BIGENDIAN
#define SAMPLE16(p) (*((BYTE*)p)|*((CHAR*)p+1)<<8)
-#define PUT16(p) (*((BYTE*)p)|*((CHAR*)p+1)<<8)
+#define PUT16(p,s) *((BYTE*)p)=s;*((BYTE*)p+1)=(s>>8)
#else
#define SAMPLE16(p) (*((SHORT*)p))
#define PUT16(p,s) *((SHORT*)p)=s
@@ -364,13 +364,12 @@ void DSOUND_RecalcFormat(IDirectSoundBufferImpl * dsb)
if (dsb->freq == dsb->outfreq)
{
dsb->firstep = 1;
- dsb->firdelay = 0;
+ dsb->firdelay = 1;
}
else
- {
dsb->firdelay = (2 * g_fir[dsb->quality]->size / dsb->firstep) + 1;
- dsb->firdelay *= dsb->pwfx->nBlockAlign;
- }
+
+ dsb->firdelay *= dsb->pwfx->nBlockAlign;
TRACE("resample quality: %d\n", dsb->quality);
TRACE("resample firstep %d\n", dsb->firstep);
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.
More information about the wine-bugs
mailing list