Skip to content

Commit

Permalink
Fixed sound pops introduced by WaveMix upsampler.
Browse files Browse the repository at this point in the history
This does not fix WINE issues, but at least you don’t have to up sample manually.
  • Loading branch information
k4zmu2a committed Aug 19, 2021
1 parent d5b44e4 commit 10c83e8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions SpaceCadetPinball/WaveMix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2377,6 +2377,12 @@ HPSTR WaveMix::SamplesPerSecAlign(HPSTR lpInData, DWORD nInSamplesPerSec, DWORD
}
}

// Dump raw PCM for analysis.
/*FILE* file;
fopen_s(&file,"wav1_dump.raw", "w");
fwrite(dataBufBup, 1, sampleSize * dwNumSamples2, file);
fclose(file);*/

GlobalUnlock(GlobalHandle(lpInDataBup));
GlobalFree(GlobalHandle(lpInDataBup));
return dataBufBup;
Expand Down Expand Up @@ -2427,7 +2433,7 @@ void WaveMix::RepSample(HPSTR lpOutData, HPSTR lpInData, unsigned nRep, int nByt
{
auto sample = *src;
auto dst2 = &dst[nChannels];
auto delta = (src[nChannels] - src[0]) / nRep;
auto delta = (src[nChannels] - src[0]) / static_cast<int>(nRep);
*dst = *src;
dst++;
for (auto repeatIndex = nRep - 1; repeatIndex; repeatIndex--)
Expand All @@ -2447,7 +2453,7 @@ void WaveMix::RepSample(HPSTR lpOutData, HPSTR lpInData, unsigned nRep, int nByt
{
auto sample = *src;
auto dst2 = &dst[nChannels];
auto delta = (src[nChannels] - src[0]) / nRep; /*Was dst[nChannels] - */
auto delta = (src[nChannels] - src[0]) / static_cast<int>(nRep); /*Was dst[nChannels] - */
*dst = *src;
++dst;
for (auto repeatIndex2 = nRep - 1; repeatIndex2; --repeatIndex2)
Expand Down

0 comments on commit 10c83e8

Please sign in to comment.