aboutsummaryrefslogtreecommitdiffstats
path: root/utils/sofa-support.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-12-11 00:48:03 -0800
committerChris Robinson <[email protected]>2019-12-11 00:49:57 -0800
commit4867f93a34226be5d7d78e2f58f1413fc88816e4 (patch)
tree530b7d0504686a98e738f58d9294e811db42bccb /utils/sofa-support.h
parentae916929c95d676c14279d701f105819e9e62a13 (diff)
Move duplicate SOFA-related functions to a reusable library
Diffstat (limited to 'utils/sofa-support.h')
-rw-r--r--utils/sofa-support.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/utils/sofa-support.h b/utils/sofa-support.h
new file mode 100644
index 00000000..1229f49d
--- /dev/null
+++ b/utils/sofa-support.h
@@ -0,0 +1,30 @@
+#ifndef UTILS_SOFA_SUPPORT_H
+#define UTILS_SOFA_SUPPORT_H
+
+#include <cstddef>
+#include <memory>
+#include <vector>
+
+#include "mysofa.h"
+
+
+struct MySofaDeleter {
+ void operator()(MYSOFA_HRTF *sofa) { mysofa_free(sofa); }
+};
+using MySofaHrtfPtr = std::unique_ptr<MYSOFA_HRTF,MySofaDeleter>;
+
+// Per-field measurement info.
+struct SofaField {
+ using uint = unsigned int;
+
+ double mDistance{0.0};
+ uint mEvCount{0u};
+ uint mEvStart{0u};
+ std::vector<uint> mAzCounts;
+};
+
+const char *SofaErrorStr(int err);
+
+std::vector<SofaField> GetCompatibleLayout(const size_t m, const float *xyzs);
+
+#endif /* UTILS_SOFA_SUPPORT_H */