diff --git a/utils/makemhr/loadsofa.cpp b/utils/makemhr/loadsofa.cpp index 3299ba74fb..3fe4992fdf 100644 --- a/utils/makemhr/loadsofa.cpp +++ b/utils/makemhr/loadsofa.cpp @@ -62,12 +62,12 @@ using uint = unsigned int; */ auto PrepareLayout(const al::span xyzs, HrirDataT *hData) -> bool { - fprintf(stdout, "Detecting compatible layout...\n"); + fputs("Detecting compatible layout...\n", stdout); auto fds = GetCompatibleLayout(xyzs); if(fds.size() > MAX_FD_COUNT) { - fprintf(stdout, "Incompatible layout (inumerable radii).\n"); + fputs("Incompatible layout (inumerable radii).\n", stdout); return false; } @@ -92,7 +92,7 @@ auto PrepareLayout(const al::span xyzs, HrirDataT *hData) -> bool ++fi; } - fprintf(stdout, "Using %u of %zu IRs.\n", ir_total, xyzs.size()/3); + printf("Using %u of %zu IRs.\n", ir_total, xyzs.size()/3); const auto azs = al::span{azCounts}.first(); return PrepareHrirData(al::span{distances}.first(fi), evCounts, azs, hData); } @@ -422,8 +422,8 @@ bool LoadSofaFile(const std::string_view filename, const uint numThreads, const MySofaHrtfPtr sofaHrtf{mysofa_load(std::string{filename}.c_str(), &err)}; if(!sofaHrtf) { - fprintf(stdout, "Error: Could not load %.*s: %s (%d)\n", al::sizei(filename), - filename.data(), SofaErrorStr(err), err); + printf("Error: Could not load %.*s: %s (%d)\n", al::sizei(filename), filename.data(), + SofaErrorStr(err), err); return false; } diff --git a/utils/makemhr/makemhr.cpp b/utils/makemhr/makemhr.cpp index 508fd996a8..1c88259612 100644 --- a/utils/makemhr/makemhr.cpp +++ b/utils/makemhr/makemhr.cpp @@ -1076,7 +1076,7 @@ void CalculateHrtds(const HeadModelT model, const double radius, HrirDataT *hDat } if(maxHrtd > MaxHrtd) { - fprintf(stdout, " Scaling for max delay of %f samples to %f\n...\n", maxHrtd, MaxHrtd); + printf(" Scaling for max delay of %f samples to %f\n...\n", maxHrtd, MaxHrtd); const double scale{MaxHrtd / maxHrtd}; for(auto &field : hData->mFds) { @@ -1158,12 +1158,11 @@ bool ProcessDefinition(std::string_view inName, const uint outRate, const Channe { HrirDataT hData; - fprintf(stdout, "Using %u thread%s.\n", numThreads, (numThreads==1)?"":"s"); + printf("Using %u thread%s.\n", numThreads, (numThreads==1)?"":"s"); if(inName.empty() || inName == "-"sv) { inName = "stdin"sv; - fprintf(stdout, "Reading HRIR definition from %.*s...\n", al::sizei(inName), - inName.data()); + printf("Reading HRIR definition from %.*s...\n", al::sizei(inName), inName.data()); if(!LoadDefInput(std::cin, {}, inName, fftSize, truncSize, outRate, chanMode, &hData)) return false; } @@ -1190,15 +1189,13 @@ bool ProcessDefinition(std::string_view inName, const uint outRate, const Channe && startbytes[3] == 'F') { input = nullptr; - fprintf(stdout, "Reading HRTF data from %.*s...\n", al::sizei(inName), - inName.data()); + printf("Reading HRTF data from %.*s...\n", al::sizei(inName), inName.data()); if(!LoadSofaFile(inName, numThreads, fftSize, truncSize, outRate, chanMode, &hData)) return false; } else { - fprintf(stdout, "Reading HRIR definition from %.*s...\n", al::sizei(inName), - inName.data()); + printf("Reading HRIR definition from %.*s...\n", al::sizei(inName), inName.data()); if(!LoadDefInput(*input, startbytes, inName, fftSize, truncSize, outRate, chanMode, &hData)) return false; @@ -1213,43 +1210,43 @@ bool ProcessDefinition(std::string_view inName, const uint outRate, const Channe if(hData.mFds.size() > 1) { - fprintf(stdout, "Balancing field magnitudes...\n"); + fputs("Balancing field magnitudes...\n", stdout); BalanceFieldMagnitudes(&hData, c, m); } - fprintf(stdout, "Calculating diffuse-field average...\n"); + fputs("Calculating diffuse-field average...\n", stdout); CalculateDiffuseFieldAverage(&hData, c, m, surface, limit, dfa); - fprintf(stdout, "Performing diffuse-field equalization...\n"); + fputs("Performing diffuse-field equalization...\n", stdout); DiffuseFieldEqualize(c, m, dfa, &hData); } if(hData.mFds.size() > 1) { - fprintf(stdout, "Sorting %zu fields...\n", hData.mFds.size()); + printf("Sorting %zu fields...\n", hData.mFds.size()); std::sort(hData.mFds.begin(), hData.mFds.end(), [](const HrirFdT &lhs, const HrirFdT &rhs) noexcept { return lhs.mDistance < rhs.mDistance; }); if(farfield) { - fprintf(stdout, "Clearing %zu near field%s...\n", hData.mFds.size()-1, + printf("Clearing %zu near field%s...\n", hData.mFds.size()-1, (hData.mFds.size()-1 != 1) ? "s" : ""); hData.mFds.erase(hData.mFds.cbegin(), hData.mFds.cend()-1); } } - fprintf(stdout, "Synthesizing missing elevations...\n"); + fputs("Synthesizing missing elevations...\n", stdout); if(model == HM_Dataset) SynthesizeOnsets(&hData); SynthesizeHrirs(&hData); - fprintf(stdout, "Performing minimum phase reconstruction...\n"); + fputs("Performing minimum phase reconstruction...\n", stdout); ReconstructHrirs(&hData, numThreads); - fprintf(stdout, "Truncating minimum-phase HRIRs...\n"); + fputs("Truncating minimum-phase HRIRs...\n", stdout); hData.mIrPoints = truncSize; - fprintf(stdout, "Normalizing final HRIRs...\n"); + fputs("Normalizing final HRIRs...\n", stdout); NormalizeHrirs(&hData); - fprintf(stdout, "Calculating impulse delays...\n"); + fputs("Calculating impulse delays...\n", stdout); CalculateHrtds(model, (radius > DefaultCustomRadius) ? radius : hData.mRadius, &hData); const auto rateStr = std::to_string(hData.mIrRate); const auto expName = StrSubst(outName, "%r"sv, rateStr); - fprintf(stdout, "Creating MHR data set %s...\n", expName.c_str()); + printf("Creating MHR data set %s...\n", expName.c_str()); return StoreMhr(&hData, expName); } @@ -1283,7 +1280,7 @@ int main(al::span args) { if(args.size() < 2) { - fprintf(stdout, "HRTF Processing and Composition Utility\n\n"); + fputs("HRTF Processing and Composition Utility\n\n", stdout); PrintHelp(args[0], stdout); exit(EXIT_SUCCESS); } @@ -1496,7 +1493,7 @@ int main(al::span args) const int ret{ProcessDefinition(inName, outRate, chanMode, farfield, numThreads, fftSize, equalize, surface, limit, truncSize, model, radius, outName)}; if(!ret) return -1; - fprintf(stdout, "Operation completed.\n"); + fputs("Operation completed.\n", stdout); return EXIT_SUCCESS; } diff --git a/utils/openal-info.c b/utils/openal-info.c index 669727a60e..c37e85c779 100644 --- a/utils/openal-info.c +++ b/utils/openal-info.c @@ -55,7 +55,7 @@ static void printList(const char *list, char separator) if(!list || *list == '\0') { - fprintf(stdout, "\n%s!!! none !!!\n", indent); + printf("\n%s!!! none !!!\n", indent); return; } @@ -73,7 +73,7 @@ static void printList(const char *list, char separator) if(len + col + 2 >= MaxWidth) { - fprintf(stdout, "\n%s", indent); + printf("\n%s", indent); col = strlen(indent); } else diff --git a/utils/sofa-info.cpp b/utils/sofa-info.cpp index e899c66cd2..5460d4c6bb 100644 --- a/utils/sofa-info.cpp +++ b/utils/sofa-info.cpp @@ -45,7 +45,7 @@ void PrintSofaAttributes(const char *prefix, MYSOFA_ATTRIBUTE *attribute) { while(attribute) { - fprintf(stdout, "%s.%s: %s\n", prefix, attribute->name, attribute->value); + printf("%s.%s: %s\n", prefix, attribute->name, attribute->value); attribute = attribute->next; } } @@ -57,10 +57,10 @@ void PrintSofaArray(const char *prefix, MYSOFA_ARRAY *array, bool showValues=tru { const auto values = al::span{array->values, array->elements}; for(size_t i{0u};i < values.size();++i) - fprintf(stdout, "%s[%zu]: %.6f\n", prefix, i, values[i]); + printf("%s[%zu]: %.6f\n", prefix, i, values[i]); } else - fprintf(stdout, "%s[...]: <%u values suppressed>\n", prefix, array->elements); + printf("%s[...]: <%u values suppressed>\n", prefix, array->elements); } /* Attempts to produce a compatible layout. Most data sets tend to be @@ -76,7 +76,7 @@ void PrintCompatibleLayout(const al::span xyzs) auto fds = GetCompatibleLayout(xyzs); if(fds.empty()) { - fprintf(stdout, "No compatible field layouts in SOFA file.\n"); + fputs("No compatible field layouts in SOFA file.\n", stdout); return; } @@ -87,18 +87,18 @@ void PrintCompatibleLayout(const al::span xyzs) used_elems += fds[fi].mAzCounts[ei]; } - fprintf(stdout, "Compatible Layout (%u of %zu measurements):\n\ndistance = %.3f", used_elems, + printf("Compatible Layout (%u of %zu measurements):\n\ndistance = %.3f", used_elems, xyzs.size()/3, fds[0].mDistance); for(size_t fi{1u};fi < fds.size();fi++) - fprintf(stdout, ", %.3f", fds[fi].mDistance); + printf(", %.3f", fds[fi].mDistance); - fprintf(stdout, "\nazimuths = "); + fputs("\nazimuths = ", stdout); for(size_t fi{0u};fi < fds.size();++fi) { for(uint ei{0u};ei < fds[fi].mEvStart;++ei) - fprintf(stdout, "%d%s", fds[fi].mAzCounts[fds[fi].mEvCount - 1 - ei], ", "); + printf("%d%s", fds[fi].mAzCounts[fds[fi].mEvCount - 1 - ei], ", "); for(uint ei{fds[fi].mEvStart};ei < fds[fi].mEvCount;++ei) - fprintf(stdout, "%d%s", fds[fi].mAzCounts[ei], + printf("%d%s", fds[fi].mAzCounts[ei], (ei < (fds[fi].mEvCount - 1)) ? ", " : (fi < (fds.size() - 1)) ? ";\n " : "\n"); } @@ -111,7 +111,7 @@ void SofaInfo(const std::string &filename) MySofaHrtfPtr sofa{mysofa_load(filename.c_str(), &err)}; if(!sofa) { - fprintf(stdout, "Error: Could not load source file '%s' (%s).\n", filename.c_str(), + printf("Error: Could not load source file '%s' (%s).\n", filename.c_str(), SofaErrorStr(err)); return; } @@ -119,17 +119,17 @@ void SofaInfo(const std::string &filename) /* NOTE: Some valid SOFA files are failing this check. */ err = mysofa_check(sofa.get()); if(err != MYSOFA_OK) - fprintf(stdout, "Warning: Supposedly malformed source file '%s' (%s).\n", filename.c_str(), + printf("Warning: Supposedly malformed source file '%s' (%s).\n", filename.c_str(), SofaErrorStr(err)); mysofa_tocartesian(sofa.get()); PrintSofaAttributes("Info", sofa->attributes); - fprintf(stdout, "Measurements: %u\n", sofa->M); - fprintf(stdout, "Receivers: %u\n", sofa->R); - fprintf(stdout, "Emitters: %u\n", sofa->E); - fprintf(stdout, "Samples: %u\n", sofa->N); + printf("Measurements: %u\n", sofa->M); + printf("Receivers: %u\n", sofa->R); + printf("Emitters: %u\n", sofa->E); + printf("Samples: %u\n", sofa->N); PrintSofaArray("SampleRate", &sofa->DataSamplingRate); PrintSofaArray("DataDelay", &sofa->DataDelay); @@ -142,7 +142,7 @@ int main(al::span args) { if(args.size() != 2) { - fprintf(stdout, "Usage: %.*s \n", al::sizei(args[0]), args[0].data()); + printf("Usage: %.*s \n", al::sizei(args[0]), args[0].data()); return 0; } diff --git a/utils/sofa-support.cpp b/utils/sofa-support.cpp index ecaaf3d61d..f03707a7f7 100644 --- a/utils/sofa-support.cpp +++ b/utils/sofa-support.cpp @@ -213,13 +213,13 @@ auto GetCompatibleLayout(const al::span xyzs) -> std::vector xyzs) -> std::vector xyzs) -> std::vector(std::round(180.0 / step)) + 1; if(evCount < 5) { - fprintf(stdout, "Too few uniform elevations on field distance %f.\n", dist); + printf("Too few uniform elevations on field distance %f.\n", dist); continue; } @@ -267,7 +267,7 @@ auto GetCompatibleLayout(const al::span xyzs) -> std::vector xyzs) -> std::vector(std::round(360.0f / step));