aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/filters/nfc.h
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/filters/nfc.h')
-rw-r--r--Alc/filters/nfc.h64
1 files changed, 28 insertions, 36 deletions
diff --git a/Alc/filters/nfc.h b/Alc/filters/nfc.h
index d59280d0..40aca36e 100644
--- a/Alc/filters/nfc.h
+++ b/Alc/filters/nfc.h
@@ -1,10 +1,6 @@
#ifndef FILTER_NFC_H
#define FILTER_NFC_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
struct NfcFilter1 {
float base_gain, gain;
float b1, a1;
@@ -21,37 +17,33 @@ struct NfcFilter3 {
float z[3];
};
-typedef struct NfcFilter {
- struct NfcFilter1 first;
- struct NfcFilter2 second;
- struct NfcFilter3 third;
-} NfcFilter;
-
-
-/* NOTE:
- * w0 = speed_of_sound / (source_distance * sample_rate);
- * w1 = speed_of_sound / (control_distance * sample_rate);
- *
- * Generally speaking, the control distance should be approximately the average
- * speaker distance, or based on the reference delay if outputing NFC-HOA. It
- * must not be negative, 0, or infinite. The source distance should not be too
- * small relative to the control distance.
- */
-
-void NfcFilterCreate(NfcFilter *nfc, const float w0, const float w1);
-void NfcFilterAdjust(NfcFilter *nfc, const float w0);
-
-/* Near-field control filter for first-order ambisonic channels (1-3). */
-void NfcFilterProcess1(NfcFilter *nfc, float *RESTRICT dst, const float *RESTRICT src, const int count);
-
-/* Near-field control filter for second-order ambisonic channels (4-8). */
-void NfcFilterProcess2(NfcFilter *nfc, float *RESTRICT dst, const float *RESTRICT src, const int count);
-
-/* Near-field control filter for third-order ambisonic channels (9-15). */
-void NfcFilterProcess3(NfcFilter *nfc, float *RESTRICT dst, const float *RESTRICT src, const int count);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
+class NfcFilter {
+ NfcFilter1 first;
+ NfcFilter2 second;
+ NfcFilter3 third;
+
+public:
+ /* NOTE:
+ * w0 = speed_of_sound / (source_distance * sample_rate);
+ * w1 = speed_of_sound / (control_distance * sample_rate);
+ *
+ * Generally speaking, the control distance should be approximately the
+ * average speaker distance, or based on the reference delay if outputing
+ * NFC-HOA. It must not be negative, 0, or infinite. The source distance
+ * should not be too small relative to the control distance.
+ */
+
+ void init(const float w0, const float w1) noexcept;
+ void adjust(const float w0) noexcept;
+
+ /* Near-field control filter for first-order ambisonic channels (1-3). */
+ void process1(float *RESTRICT dst, const float *RESTRICT src, const int count);
+
+ /* Near-field control filter for second-order ambisonic channels (4-8). */
+ void process2(float *RESTRICT dst, const float *RESTRICT src, const int count);
+
+ /* Near-field control filter for third-order ambisonic channels (9-15). */
+ void process3(float *RESTRICT dst, const float *RESTRICT src, const int count);
+};
#endif /* FILTER_NFC_H */