Browse Source

Add Vec::flip()

tags/v0.6.1
Andrew Belt 6 years ago
parent
commit
a9fd3a8c17
3 changed files with 8 additions and 5 deletions
  1. +0
    -2
      include/dsp/frame.hpp
  2. +2
    -1
      include/engine.hpp
  3. +6
    -2
      include/util/math.hpp

+ 0
- 2
include/dsp/frame.hpp View File

@@ -9,8 +9,6 @@ namespace rack {
template <size_t CHANNELS>
struct Frame {
float samples[CHANNELS];

Frame() {}
};

} // namespace rack

+ 2
- 1
include/engine.hpp View File

@@ -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() {}


+ 6
- 2
include/util/math.hpp View File

@@ -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));
}


Loading…
Cancel
Save