From d7af17ab8770fc72dc4d4d814e0f6311577cdfb8 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 27 Jan 2019 14:35:58 -0800 Subject: Round the calculated field distance in makehrtf --- utils/makehrtf.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/utils/makehrtf.cpp b/utils/makehrtf.cpp index f50d1c78..c20e0655 100644 --- a/utils/makehrtf.cpp +++ b/utils/makehrtf.cpp @@ -1933,25 +1933,26 @@ static int StoreMhr(const HrirDataT *hData, const char *filename) } if(!WriteAscii(MHR_FORMAT, fp, filename)) return 0; - if(!WriteBin4(BO_LITTLE, 4, static_cast(hData->mIrRate), fp, filename)) + if(!WriteBin4(BO_LITTLE, 4, hData->mIrRate, fp, filename)) return 0; if(!WriteBin4(BO_LITTLE, 1, static_cast(hData->mSampleType), fp, filename)) return 0; if(!WriteBin4(BO_LITTLE, 1, static_cast(hData->mChannelType), fp, filename)) return 0; - if(!WriteBin4(BO_LITTLE, 1, static_cast(hData->mIrPoints), fp, filename)) + if(!WriteBin4(BO_LITTLE, 1, hData->mIrPoints, fp, filename)) return 0; - if(!WriteBin4(BO_LITTLE, 1, static_cast(hData->mFdCount), fp, filename)) + if(!WriteBin4(BO_LITTLE, 1, hData->mFdCount, fp, filename)) return 0; for(fi = 0;fi < hData->mFdCount;fi++) { - if(!WriteBin4(BO_LITTLE, 2, static_cast(1000.0 * hData->mFds[fi].mDistance), fp, filename)) + auto fdist = static_cast(std::round(1000.0 * hData->mFds[fi].mDistance)); + if(!WriteBin4(BO_LITTLE, 2, fdist, fp, filename)) return 0; - if(!WriteBin4(BO_LITTLE, 1, static_cast(hData->mFds[fi].mEvCount), fp, filename)) + if(!WriteBin4(BO_LITTLE, 1, hData->mFds[fi].mEvCount, fp, filename)) return 0; for(ei = 0;ei < hData->mFds[fi].mEvCount;ei++) { - if(!WriteBin4(BO_LITTLE, 1, static_cast(hData->mFds[fi].mEvs[ei].mAzCount), fp, filename)) + if(!WriteBin4(BO_LITTLE, 1, hData->mFds[fi].mEvs[ei].mAzCount, fp, filename)) return 0; } } -- cgit v1.2.3