aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-01-27 14:35:58 -0800
committerChris Robinson <[email protected]>2019-01-27 14:35:58 -0800
commitd7af17ab8770fc72dc4d4d814e0f6311577cdfb8 (patch)
tree09aff24d3e7827ed1868ac5ba94f767b57c1431e
parentf98a24fb8ac8fcaae61a4e31f49e774c1b83a046 (diff)
Round the calculated field distance in makehrtf
-rw-r--r--utils/makehrtf.cpp13
1 files 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<uint32_t>(hData->mIrRate), fp, filename))
+ if(!WriteBin4(BO_LITTLE, 4, hData->mIrRate, fp, filename))
return 0;
if(!WriteBin4(BO_LITTLE, 1, static_cast<uint32_t>(hData->mSampleType), fp, filename))
return 0;
if(!WriteBin4(BO_LITTLE, 1, static_cast<uint32_t>(hData->mChannelType), fp, filename))
return 0;
- if(!WriteBin4(BO_LITTLE, 1, static_cast<uint32_t>(hData->mIrPoints), fp, filename))
+ if(!WriteBin4(BO_LITTLE, 1, hData->mIrPoints, fp, filename))
return 0;
- if(!WriteBin4(BO_LITTLE, 1, static_cast<uint32_t>(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<uint32_t>(1000.0 * hData->mFds[fi].mDistance), fp, filename))
+ auto fdist = static_cast<uint32_t>(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<uint32_t>(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<uint32_t>(hData->mFds[fi].mEvs[ei].mAzCount), fp, filename))
+ if(!WriteBin4(BO_LITTLE, 1, hData->mFds[fi].mEvs[ei].mAzCount, fp, filename))
return 0;
}
}