aboutsummaryrefslogtreecommitdiffstats
path: root/utils/makemhr/makemhr.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-03-25 20:16:02 -0700
committerChris Robinson <[email protected]>2019-03-25 20:16:02 -0700
commit0a4d1c858ec21b948838f5e9b464b5534d497bca (patch)
tree871998dc725daf2c83ca852ea5a57887e153c4c3 /utils/makemhr/makemhr.cpp
parentcb02bb00bebefce11092eeb7efaafa8a16a090af (diff)
Support loading SOFA files directly with makemhr
This extracts the definition info it can from the SOFA, and uses the same logic as sofa-info to automatically detect an appropriate layout. There is a bit of code duplication from loaddef.cpp and sofa-info.cpp, though there are slight modifications.
Diffstat (limited to 'utils/makemhr/makemhr.cpp')
-rw-r--r--utils/makemhr/makemhr.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/utils/makemhr/makemhr.cpp b/utils/makemhr/makemhr.cpp
index 6824c542..4406384a 100644
--- a/utils/makemhr/makemhr.cpp
+++ b/utils/makemhr/makemhr.cpp
@@ -1475,7 +1475,9 @@ static void CalculateHrtds(const HeadModelT model, const double radius, HrirData
}
// Allocate and configure dynamic HRIR structures.
-int PrepareHrirData(const uint fdCount, const double distances[MAX_FD_COUNT], const uint evCounts[MAX_FD_COUNT], const uint azCounts[MAX_FD_COUNT * MAX_EV_COUNT], HrirDataT *hData)
+int PrepareHrirData(const uint fdCount, const double (&distances)[MAX_FD_COUNT],
+ const uint (&evCounts)[MAX_FD_COUNT], const uint azCounts[MAX_FD_COUNT * MAX_EV_COUNT],
+ HrirDataT *hData)
{
uint evTotal = 0, azTotal = 0, fi, ei, ai;
@@ -1566,8 +1568,11 @@ static int ProcessDefinition(const char *inName, const uint outRate, const Chann
startbytes[3] == 'F')
{
fclose(fp);
- fprintf(stderr, "Error: Direct SOFA input not yet supported\n");
- return 0;
+ fp = nullptr;
+
+ fprintf(stdout, "Reading HRTF data from %s...\n", inName);
+ if(!LoadSofaFile(inName, fftSize, truncSize, chanMode, &hData))
+ return 0;
}
}
if(fp != nullptr)