diff options
25 files changed, 79 insertions, 83 deletions
diff --git a/api/plugin-api.hpp b/api/plugin-api.hpp index a4573c85..1bfce7d5 100644 --- a/api/plugin-api.hpp +++ b/api/plugin-api.hpp @@ -120,7 +120,7 @@ struct OTR_API_EXPORT IFilter : module_status_mixin IFilter(); // optional destructor - virtual ~IFilter(); + ~IFilter() override; // perform filtering step. // you have to take care of dt on your own, try "opentrack-compat/timer.hpp" virtual void filter(const double *input, double *output) = 0; diff --git a/compat/correlation-calibrator.hpp b/compat/correlation-calibrator.hpp index cc168fcd..44aee537 100644 --- a/compat/correlation-calibrator.hpp +++ b/compat/correlation-calibrator.hpp @@ -9,7 +9,7 @@ namespace correlation_calibrator_impl { -static constexpr inline double min[6] = { +static constexpr double min[6] = { -50, -50, 250, @@ -19,7 +19,7 @@ static constexpr inline double min[6] = { -180, }; -static constexpr inline double max[6] = { +static constexpr double max[6] = { 50, 50, 250, @@ -29,18 +29,18 @@ static constexpr inline double max[6] = { 180, }; -static constexpr inline double yaw_spacing_in_degrees = 1.5; -static constexpr inline double pitch_spacing_in_degrees = 1; -static constexpr inline double roll_spacing_in_degrees = 1; +static constexpr double yaw_spacing_in_degrees = 1.5; +static constexpr double pitch_spacing_in_degrees = 1; +static constexpr double roll_spacing_in_degrees = 1; -static constexpr inline unsigned yaw_nbuckets = unsigned(1+ 360./yaw_spacing_in_degrees); -static constexpr inline unsigned pitch_nbuckets = unsigned(1+ 360./pitch_spacing_in_degrees); -static constexpr inline unsigned roll_nbuckets = unsigned(1+ 360./roll_spacing_in_degrees); +static constexpr unsigned yaw_nbuckets = unsigned(1+ 360./yaw_spacing_in_degrees); +static constexpr unsigned pitch_nbuckets = unsigned(1+ 360./pitch_spacing_in_degrees); +static constexpr unsigned roll_nbuckets = unsigned(1+ 360./roll_spacing_in_degrees); -static constexpr inline double translation_spacing = .25; -static constexpr inline unsigned x_nbuckets = unsigned(1+ (max[0]-min[0])/translation_spacing); -static constexpr inline unsigned y_nbuckets = unsigned(1+ (max[1]-min[1])/translation_spacing); -static constexpr inline unsigned z_nbuckets = unsigned(1+ (max[2]-min[2])/translation_spacing); +static constexpr double translation_spacing = .25; +static constexpr unsigned x_nbuckets = unsigned(1+ (max[0]-min[0])/translation_spacing); +static constexpr unsigned y_nbuckets = unsigned(1+ (max[1]-min[1])/translation_spacing); +static constexpr unsigned z_nbuckets = unsigned(1+ (max[2]-min[2])/translation_spacing); using vec6 = Mat<double, 6, 1>; using mat66 = Mat<double, 6, 6>; @@ -68,7 +68,7 @@ public: mat66 get_coefficients() const; unsigned sample_count() const; - static constexpr inline unsigned min_samples = 25; + static constexpr unsigned min_samples = 25; }; } // ns correlation_calibrator_impl diff --git a/compat/mutex.hpp b/compat/mutex.hpp index e142fd0b..e4d0fee6 100644 --- a/compat/mutex.hpp +++ b/compat/mutex.hpp @@ -10,8 +10,8 @@ class OTR_COMPAT_EXPORT mutex public: using RecursionMode = QMutex::RecursionMode; - static constexpr inline RecursionMode Recursive = RecursionMode::Recursive; - static constexpr inline RecursionMode NonRecursive = RecursionMode::NonRecursive; + static constexpr RecursionMode Recursive = RecursionMode::Recursive; + static constexpr RecursionMode NonRecursive = RecursionMode::NonRecursive; mutex& operator=(const mutex& datum); mutex(const mutex& datum); diff --git a/cv/numeric.hpp b/cv/numeric.hpp index 87fe7a69..ce8f7e82 100644 --- a/cv/numeric.hpp +++ b/cv/numeric.hpp @@ -8,8 +8,8 @@ namespace numeric_types { static_assert(std::is_floating_point_v<f>); - static constexpr inline f eps = f(1e-8); - static constexpr inline f pi = f(M_PI); + static constexpr f eps = f(1e-8); + static constexpr f pi = f(M_PI); template<int n> using vec = cv::Vec<f, n>; using vec2 = vec<2>; diff --git a/cv/translation-calibrator.cpp b/cv/translation-calibrator.cpp index 9ead888e..8117b1e7 100644 --- a/cv/translation-calibrator.cpp +++ b/cv/translation-calibrator.cpp @@ -80,7 +80,7 @@ tt TranslationCalibrator::get_estimate() }; } -static constexpr inline double r2d = 180/M_PI; +static constexpr double r2d = 180/M_PI; bool TranslationCalibrator::check_bucket(const cv::Matx33d& R_CM_k) { diff --git a/cv/translation-calibrator.hpp b/cv/translation-calibrator.hpp index da052526..406edb72 100644 --- a/cv/translation-calibrator.hpp +++ b/cv/translation-calibrator.hpp @@ -41,8 +41,8 @@ public: // we're bringing in 3DOF samples but the calibrator only // checks yaw and pitch - static constexpr inline unsigned num_cal_axis = 3; - static constexpr inline unsigned num_nsample_axis = 2; + static constexpr unsigned num_cal_axis = 3; + static constexpr unsigned num_nsample_axis = 2; using cv_cal_vec = cv::Vec<float, num_cal_axis>; using cv_nsample_vec = cv::Vec<unsigned, num_nsample_axis>; @@ -51,6 +51,6 @@ public: // get the current estimate for t_MH tt get_estimate(); - static constexpr inline double yaw_spacing_in_degrees = 2; - static constexpr inline double pitch_spacing_in_degrees = 1.5; + static constexpr double yaw_spacing_in_degrees = 2; + static constexpr double pitch_spacing_in_degrees = 1.5; }; diff --git a/dinput/win32-joystick.hpp b/dinput/win32-joystick.hpp index 59ec0c49..331e4968 100644 --- a/dinput/win32-joystick.hpp +++ b/dinput/win32-joystick.hpp @@ -23,22 +23,22 @@ namespace win32_joy_impl { -static constexpr inline unsigned max_buttons = std::size(DIJOYSTATE2().rgbButtons); -static constexpr inline unsigned max_pov_hats = std::size(DIJOYSTATE2().rgdwPOV); +static constexpr unsigned max_buttons = std::size(DIJOYSTATE2().rgbButtons); +static constexpr unsigned max_pov_hats = std::size(DIJOYSTATE2().rgdwPOV); -static constexpr inline unsigned pov_hat_directions = 8; +static constexpr unsigned pov_hat_directions = 8; // cf. https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ee416628(v=vs.85) // see also remarks on the page // no need to check for pos == unsigned(-1) || pos == 0xffff, // this logic doesn't require that -static constexpr inline unsigned value_per_pov_hat_direction = 36000 / pov_hat_directions; -static constexpr inline unsigned max_buttons_and_pov_hats = max_buttons + max_pov_hats * pov_hat_directions; +static constexpr unsigned value_per_pov_hat_direction = 36000 / pov_hat_directions; +static constexpr unsigned max_buttons_and_pov_hats = max_buttons + max_pov_hats * pov_hat_directions; //static_assert(pov_hat_directions == 4 || pov_hat_directions == 8); // XXX how many axis update events can we reasonably get in a short time frame? -static constexpr inline unsigned num_buffers = 16; +static constexpr unsigned num_buffers = 16; //#define WIN32_JOY_DEBUG @@ -63,7 +63,7 @@ struct OTR_DINPUT_EXPORT win32_joy_ctx final using joys_t = std::unordered_map<QString, std::shared_ptr<joy>>; - static constexpr inline int joy_axis_size = 65536; + static constexpr int joy_axis_size = 65536; struct joy_info { diff --git a/filter-accela/ftnoir_filter_accela.cpp b/filter-accela/ftnoir_filter_accela.cpp index 56ac9b5c..9e973586 100644 --- a/filter-accela/ftnoir_filter_accela.cpp +++ b/filter-accela/ftnoir_filter_accela.cpp @@ -31,7 +31,7 @@ static void do_deltas(const double* deltas, double* output, F&& fun) dist += deltas[k]*deltas[k]; dist = sqrt(dist); - const double value = double(fun(dist)); + const double value = fun(dist); for (unsigned k = 0; k < N; k++) { @@ -82,14 +82,14 @@ void accela::filter(const double* input, double *output) return; } - const double rot_thres { s.rot_smoothing }; - const double pos_thres { s.pos_smoothing }; + const double rot_thres{s.rot_smoothing}; + const double pos_thres{s.pos_smoothing}; const double dt = t.elapsed_seconds(); t.start(); - const double rot_dz = s.rot_deadzone.to<double>(); - const double pos_dz = s.pos_deadzone.to<double>(); + const double rot_dz{ s.rot_deadzone}; + const double pos_dz{ s.pos_deadzone}; // rot @@ -142,10 +142,10 @@ void settings_accela::make_splines(spline& rot, spline& pos) rot.clear(); pos.clear(); for (const auto& val : rot_gains) - rot.add_point(QPointF(val.x, val.y)); + rot.add_point({ val.x, val.y }); for (const auto& val : pos_gains) - pos.add_point(QPointF(val.x, val.y)); + pos.add_point({ val.x, val.y }); } OPENTRACK_DECLARE_FILTER(accela, dialog_accela, accelaDll) diff --git a/filter-accela/ftnoir_filter_accela.h b/filter-accela/ftnoir_filter_accela.h index a3f93756..9112b0b8 100644 --- a/filter-accela/ftnoir_filter_accela.h +++ b/filter-accela/ftnoir_filter_accela.h @@ -17,6 +17,8 @@ #include <QMutex> #include <QTimer> +//#define DEBUG_ACCELA + class accela : public IFilter { public: @@ -57,6 +59,6 @@ class accelaDll : public Metadata { Q_OBJECT - QString name() { return tr("Accela"); } - QIcon icon() { return QIcon(":/images/filter-16.png"); } + QString name() override { return tr("Accela"); } + QIcon icon() override { return QIcon(":/images/filter-16.png"); } }; diff --git a/filter-accela/ftnoir_filter_accela_dialog.cpp b/filter-accela/ftnoir_filter_accela_dialog.cpp index 51c31ca4..d63f27fd 100644 --- a/filter-accela/ftnoir_filter_accela_dialog.cpp +++ b/filter-accela/ftnoir_filter_accela_dialog.cpp @@ -42,7 +42,7 @@ dialog_accela::dialog_accela() QDialog dr; spline_widget r(&dr); dr.setWindowTitle("Accela rotation gain"); r.set_preview_only(true); r.setEnabled(true); - r.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); r.setConfig(&rot); + r.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); r.set_config(&rot); r.setFixedSize(1024, 600); dr.show(); dr.exec(); @@ -52,7 +52,7 @@ dialog_accela::dialog_accela() QDialog dt; spline_widget t(&dt); dt.setWindowTitle("Accela translation gain"); t.set_preview_only(true); t.setEnabled(true); - dt.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); t.setConfig(&pos); + dt.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); t.set_config(&pos); t.setFixedSize(1024, 600); dt.show(); dt.exec(); diff --git a/filter-ewma2/ftnoir_filter_ewma2.cpp b/filter-ewma2/ftnoir_filter_ewma2.cpp index 46c4796d..ce6cd040 100644 --- a/filter-ewma2/ftnoir_filter_ewma2.cpp +++ b/filter-ewma2/ftnoir_filter_ewma2.cpp @@ -48,7 +48,7 @@ void ewma::filter(const double *input, double *output) // scale curve .01->1 where 1.0 is sqrt(norm_noise). const double smoothing_scale_curve = *s.kSmoothingScaleCurve; // min/max smoothing .01->1 - const double min_smoothing = *s.kMinSmoothing; + const double min_smoothing{s.kMinSmoothing}; const double max_smoothing = std::fmax(min_smoothing, *s.kMaxSmoothing); // Calculate the new camera position. diff --git a/filter-kalman/kalman.h b/filter-kalman/kalman.h index ad5e3e20..2d8db86e 100644 --- a/filter-kalman/kalman.h +++ b/filter-kalman/kalman.h @@ -26,8 +26,8 @@ using namespace options; #include <QString> #include <QWidget> -static constexpr inline int NUM_STATE_DOF = 12; -static constexpr inline int NUM_MEASUREMENT_DOF = 6; +static constexpr int NUM_STATE_DOF = 12; +static constexpr int NUM_MEASUREMENT_DOF = 6; // These vectors are compile time fixed size, stack allocated using StateToMeasureMatrix = Eigen::Matrix<double, NUM_MEASUREMENT_DOF, NUM_STATE_DOF>; using StateMatrix = Eigen::Matrix<double, NUM_STATE_DOF, NUM_STATE_DOF>; @@ -86,11 +86,11 @@ struct settings : opts { value<slider_value> noise_rot_slider_value { b, "noise-rotation-slider", { .5, 0, 1 } }; value<slider_value> noise_pos_slider_value { b, "noise-position-slider", { .5, 0, 1 } }; - static constexpr inline double adaptivity_window_length = 0.25; // seconds - static constexpr inline double deadzone_scale = 8; - static constexpr inline double deadzone_exponent = 2.0; - static constexpr inline double process_sigma_pos = 0.5; - static constexpr inline double process_sigma_rot = 0.5; + static constexpr double adaptivity_window_length = 0.25; // seconds + static constexpr double deadzone_scale = 8; + static constexpr double deadzone_exponent = 2.0; + static constexpr double process_sigma_pos = 0.5; + static constexpr double process_sigma_rot = 0.5; static double map_slider_value(const slider_value &v); diff --git a/gui/process_detector.cpp b/gui/process_detector.cpp index ef65ca9a..67b05c7c 100644 --- a/gui/process_detector.cpp +++ b/gui/process_detector.cpp @@ -20,8 +20,8 @@ #include <QSettings> #include <QtEvents> -static constexpr inline auto RECORD_SEPARATOR = QChar(char(0x1e)); // RS ^] -static constexpr inline auto UNIT_SEPARATOR = QChar(char(0x1f)); // US ^_ +static constexpr auto RECORD_SEPARATOR = QChar(char(0x1e)); // RS ^] +static constexpr auto UNIT_SEPARATOR = QChar(char(0x1f)); // US ^_ using namespace options; using namespace options::globals; diff --git a/options/base-value.hpp b/options/base-value.hpp index 11d17c00..7a3ac420 100644 --- a/options/base-value.hpp +++ b/options/base-value.hpp @@ -17,7 +17,7 @@ #include <utility> -#define OTR_OPTIONS_SLOT(t) void setValue(t datum) { store_(datum); } +#define OTR_OPTIONS_SLOT(t) void setValue(t datum) noexcept { store_(datum); } #define OTR_OPTIONS_SIGNAL(t) void valueChanged(t) const namespace options { diff --git a/options/connector.cpp b/options/connector.cpp index 90770167..35d408d5 100644 --- a/options/connector.cpp +++ b/options/connector.cpp @@ -78,4 +78,11 @@ void connector::notify_all_values() const val->notify(); } +void connector::set_all_to_default_() +{ + for (auto& pair : connected_values) + for (auto& val : pair.second) + val->set_to_default(); +} + } // ns options::detail diff --git a/options/connector.hpp b/options/connector.hpp index 11aa94da..e22cb20f 100644 --- a/options/connector.hpp +++ b/options/connector.hpp @@ -39,23 +39,11 @@ protected: void notify_values(const QString& name) const; void notify_all_values() const; virtual QMutex* get_mtx() const = 0; - - template<typename F> - void forall(F&& fun) - { - QMutexLocker l(get_mtx()); - - for (auto& pair : connected_values) - for (auto& val : pair.second) - fun(val); - } + void set_all_to_default_(); public: connector(); virtual ~connector(); - - connector(const connector&) = default; - connector& operator=(const connector&) = default; }; } // ns options::detail diff --git a/options/value-traits.hpp b/options/value-traits.hpp index 21e00d80..aeb34cfa 100644 --- a/options/value-traits.hpp +++ b/options/value-traits.hpp @@ -45,8 +45,7 @@ struct default_value_traits return self::qvariant_from_storage(self::storage_from_value(val)); } - static constexpr inline - value_type pass_value(const value_type& x) + static constexpr value_type pass_value(const value_type& x) { if constexpr(std::is_same_v<value_type, stored_type>) return x; diff --git a/pose-widget/pose-widget.hpp b/pose-widget/pose-widget.hpp index 4a97b789..87367b96 100644 --- a/pose-widget/pose-widget.hpp +++ b/pose-widget/pose-widget.hpp @@ -85,7 +85,7 @@ struct pose_transform final : QThread std::vector<uv_> uv_vec; std::atomic<bool> fresh; - static constexpr inline int w = 320, h = 240; + static constexpr int w = 320, h = 240; }; class OTR_POSE_WIDGET_EXPORT pose_widget final : public QWidget diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h index 2c2a1e05..1d6fd107 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.h +++ b/tracker-aruco/ftnoir_tracker_aruco.h @@ -67,7 +67,7 @@ struct settings : opts { class aruco_tracker : protected virtual QThread, public ITracker { Q_OBJECT - static constexpr inline float c_search_window = 1.3f; + static constexpr float c_search_window = 1.3f; public: aruco_tracker(); ~aruco_tracker() override; @@ -120,21 +120,21 @@ private: bool use_otsu = false; #if !defined USE_EXPERIMENTAL_CANNY - static constexpr inline int adaptive_thres = 6; + static constexpr int adaptive_thres = 6; #else - static constexpr inline int adaptive_thres = 3; + static constexpr int adaptive_thres = 3; #endif - static constexpr inline double timeout = .35; - static constexpr inline double timeout_backoff_c = .25; + static constexpr double timeout = .35; + static constexpr double timeout_backoff_c = .25; - static constexpr inline float size_min = 0.05f; - static constexpr inline float size_max = 0.5f; + static constexpr float size_min = 0.05f; + static constexpr float size_max = 0.5f; - static constexpr inline double RC = .25; + static constexpr double RC = .25; #ifdef DEBUG_UNSHARP_MASKING - static constexpr inline double gauss_kernel_size = 3; + static constexpr double gauss_kernel_size = 3; cv::Mat blurred; #endif }; diff --git a/tracker-joystick/ftnoir_tracker_joystick.h b/tracker-joystick/ftnoir_tracker_joystick.h index 2fd1068f..d59c70de 100644 --- a/tracker-joystick/ftnoir_tracker_joystick.h +++ b/tracker-joystick/ftnoir_tracker_joystick.h @@ -45,7 +45,7 @@ public: void data(double *data); settings s; QString guid; - static constexpr inline int AXIS_MAX = win32_joy_ctx::joy_axis_size; + static constexpr int AXIS_MAX = win32_joy_ctx::joy_axis_size; win32_joy_ctx joy_ctx; }; diff --git a/tracker-pt/module/camera.h b/tracker-pt/module/camera.h index 69b2f860..2ea633d0 100644 --- a/tracker-pt/module/camera.h +++ b/tracker-pt/module/camera.h @@ -56,7 +56,7 @@ private: pt_settings s; - static constexpr inline f dt_eps = f{1}/256; + static constexpr f dt_eps = f{1}/256; }; } // ns pt_module diff --git a/tracker-pt/module/point_extractor.h b/tracker-pt/module/point_extractor.h index 06948ac7..a6103667 100644 --- a/tracker-pt/module/point_extractor.h +++ b/tracker-pt/module/point_extractor.h @@ -36,7 +36,7 @@ public: void extract_points(const pt_frame& frame, pt_preview& preview_frame, std::vector<vec2>& points) override; PointExtractor(const QString& module_name); private: - static constexpr inline int max_blobs = 16; + static constexpr int max_blobs = 16; pt_settings s; diff --git a/tracker-pt/point_tracker.h b/tracker-pt/point_tracker.h index c39774cd..6f3e0cee 100644 --- a/tracker-pt/point_tracker.h +++ b/tracker-pt/point_tracker.h @@ -32,7 +32,7 @@ using namespace numeric_types; struct PointModel final { - static constexpr inline unsigned N_POINTS = 3; + static constexpr unsigned N_POINTS = 3; vec3 M01; // M01 in model frame vec3 M02; // M02 in model frame diff --git a/tracker-steamvr/steamvr.hpp b/tracker-steamvr/steamvr.hpp index 8c76ad17..1a16f002 100644 --- a/tracker-steamvr/steamvr.hpp +++ b/tracker-steamvr/steamvr.hpp @@ -56,7 +56,7 @@ struct device_list final static cc_noinline maybe_pose get_pose(int k); static QString error_string(vr_error_t error); - static constexpr inline unsigned max_devices = vr::k_unMaxTrackedDeviceCount; + static constexpr unsigned max_devices = vr::k_unMaxTrackedDeviceCount; template<typename F> friend auto with_vr_lock(F&& fun) -> decltype(fun(vr_t(), vr_error_t())); diff --git a/variant/trackmouse/window.hpp b/variant/trackmouse/window.hpp index fd5d5f44..2c196852 100644 --- a/variant/trackmouse/window.hpp +++ b/variant/trackmouse/window.hpp @@ -70,7 +70,7 @@ class main_window final : public QMainWindow, private State bool maybe_die_on_config_not_writable(const QString& current); void die_on_config_not_writable(); - static constexpr inline int save_settings_interval_ms = 2500; + static constexpr int save_settings_interval_ms = 2500; private slots: void save_modules(); |