diff options
author | Chris Robinson <[email protected]> | 2017-06-22 15:07:24 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-06-22 15:07:24 -0700 |
commit | d1077795deb8367d8e6fc39ecfc5f51b3c39d9e5 (patch) | |
tree | a49c50b6bf3e9ab456f4361a06cbffd4e100d465 | |
parent | 31b02e044f689e9d586a935c924e4a989371823e (diff) |
Stop conversion when no more source samples are available
-rw-r--r-- | Alc/converter.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Alc/converter.c b/Alc/converter.c index f1a3a96b..bc9d5087 100644 --- a/Alc/converter.c +++ b/Alc/converter.c @@ -219,7 +219,7 @@ ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALs const ALsizei increment = converter->mIncrement; ALsizei pos = 0; - while(pos < dstframes) + while(pos < dstframes && *srcframes > 0) { ALfloat *restrict SrcData = ASSUME_ALIGNED(converter->mSrcSamples, 16); ALfloat *restrict DstData = ASSUME_ALIGNED(converter->mDstSamples, 16); @@ -241,7 +241,8 @@ ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALs } *src = (const ALbyte*)*src + SrcFrameSize*-prepcount; *srcframes += prepcount; - prepcount = 0; + converter->mSrcPrepCount = 0; + continue; } toread = mini(*srcframes, BUFFERSIZE-(MAX_POST_SAMPLES+MAX_PRE_SAMPLES)); @@ -253,7 +254,7 @@ ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALs */ for(chan = 0;chan < converter->mNumChannels;chan++) LoadSamples(&converter->Chan[chan].mPrevSamples[prepcount], - (const ALbyte*)src + converter->mSrcTypeSize*chan, + (const ALbyte*)*src + converter->mSrcTypeSize*chan, converter->mNumChannels, converter->mSrcType, toread ); |