From a9fd3a8c17a90890243ac48a5b9ad9afc82db8a2 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 6 May 2018 08:21:32 -0400 Subject: [PATCH] Add Vec::flip() --- include/dsp/frame.hpp | 2 -- include/engine.hpp | 3 ++- include/util/math.hpp | 8 ++++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/dsp/frame.hpp b/include/dsp/frame.hpp index 82c8d1be..91ee7510 100644 --- a/include/dsp/frame.hpp +++ b/include/dsp/frame.hpp @@ -9,8 +9,6 @@ namespace rack { template struct Frame { float samples[CHANNELS]; - - Frame() {} }; } // namespace rack diff --git a/include/engine.hpp b/include/engine.hpp index 096272af..36c4c813 100644 --- a/include/engine.hpp +++ b/include/engine.hpp @@ -67,7 +67,8 @@ struct Module { /** Advances the module by 1 audio frame with duration 1.0 / gSampleRate */ virtual void step() {} - /** Called when the engine sample rate is changed */ + /** Called when the engine sample rate is changed + */ virtual void onSampleRateChange() {} /** Called when module is created by the Add Module popup, cloning, or when loading a patch or autosave */ virtual void onCreate() {} diff --git a/include/util/math.hpp b/include/util/math.hpp index aaa98a5d..8312541e 100644 --- a/include/util/math.hpp +++ b/include/util/math.hpp @@ -143,9 +143,10 @@ inline void cmult(float *cr, float *ci, float ar, float ai, float br, float bi) struct Rect; struct Vec { - float x, y; + float x = 0.f; + float y = 0.f; - Vec() : x(0.0f), y(0.0f) {} + Vec() {} Vec(float x, float y) : x(x), y(y) {} Vec neg() { @@ -175,6 +176,9 @@ struct Vec { float norm() { return hypotf(x, y); } + Vec flip() { + return Vec(y, x); + } Vec min(Vec b) { return Vec(rack::min(x, b.x), rack::min(y, b.y)); }