aboutsummaryrefslogtreecommitdiffstats
path: root/utils/makemhr/makemhr.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-03-25 00:21:45 -0700
committerChris Robinson <[email protected]>2019-03-25 00:21:45 -0700
commita3687db015d4b5942d955e493b2ea4292127ef80 (patch)
treea3f59f9923e403d4ef72f4d759f06c483fa939b8 /utils/makemhr/makemhr.cpp
parent78aeca10c9913a9bf0a42cc86cf641006031b6ba (diff)
Use only a single function to load the HrirDataT
Diffstat (limited to 'utils/makemhr/makemhr.cpp')
-rw-r--r--utils/makemhr/makemhr.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/utils/makemhr/makemhr.cpp b/utils/makemhr/makemhr.cpp
index 327d6992..11f04eb6 100644
--- a/utils/makemhr/makemhr.cpp
+++ b/utils/makemhr/makemhr.cpp
@@ -1534,41 +1534,34 @@ int PrepareHrirData(const uint fdCount, const double distances[MAX_FD_COUNT], co
static int ProcessDefinition(const char *inName, const uint outRate, const ChannelModeT chanMode, const uint fftSize, const int equalize, const int surface, const double limit, const uint truncSize, const HeadModelT model, const double radius, const char *outName)
{
char rateStr[8+1], expName[MAX_PATH_LEN];
- TokenReaderT tr;
HrirDataT hData;
FILE *fp;
int ret;
- fprintf(stdout, "Reading HRIR definition from %s...\n", inName?inName:"stdin");
- if(inName != nullptr)
+ if(!inName)
+ {
+ inName = "stdin";
+ fp = stdin;
+ }
+ else
{
fp = fopen(inName, "r");
if(fp == nullptr)
{
- fprintf(stderr, "\nError: Could not open definition file '%s'\n", inName);
+ fprintf(stderr, "Error: Could not open input file '%s'\n", inName);
return 0;
}
- TrSetup(fp, inName, &tr);
}
- else
+ fprintf(stdout, "Reading HRIR definition from %s...\n", inName);
+ if(!LoadDefInput(fp, inName, fftSize, truncSize, chanMode, &hData))
{
- fp = stdin;
- TrSetup(fp, "<stdin>", &tr);
- }
- if(!ProcessMetrics(&tr, fftSize, truncSize, chanMode, &hData))
- {
- if(inName != nullptr)
- fclose(fp);
- return 0;
- }
- if(!ProcessSources(&tr, &hData))
- {
- if(inName)
+ if(fp != stdin)
fclose(fp);
return 0;
}
if(fp != stdin)
fclose(fp);
+
if(equalize)
{
uint c = (hData.mChannelType == CT_STEREO) ? 2 : 1;