Skip to content

Commit

Permalink
Even more WAV fixes
Browse files Browse the repository at this point in the history
Clearly I prefer FLAC over WAV.
  • Loading branch information
sagamusix committed Dec 1, 2015
1 parent 691e481 commit b26d83a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions SilenceRemover/SilenceRemover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static bool DecodeWAV(FILE *f, FILE *of)
if(!sampleRate) sampleRate = fmt.sampleRate;
else fmt.sampleRate = sampleRate;
delaySamples = static_cast<uint32_t>(0.5 + (delay * sampleRate) / 1000.0);
delayBytes = static_cast<uint32_t>(0.5 + (delay * (sampleRate * fmt.numChannels * ((fmt.bitsPerSample + 7) / 8))) / 1000.0);
delayBytes = delaySamples * fmt.numChannels * ((fmt.bitsPerSample + 7) / 8);
} else if(!memcmp(magic, "data", 4))
{
if(fmt.format != WAVFormatChunk::fmtPCM && fmt.format != WAVFormatChunk::fmtFloat)
Expand Down Expand Up @@ -167,7 +167,7 @@ static bool DecodeWAV(FILE *f, FILE *of)
return false;
}
}
uint32_t size = ftell(of);
uint32_t size = ftell(of) - 8;
fseek(of, 4, SEEK_SET);
fwrite(&size, 4, 1, of);

Expand Down

0 comments on commit b26d83a

Please sign in to comment.