File crossfade.h¶
File List > DaisySP > Source > Dynamics > crossfade.h
Go to the documentation of this file
Source Code¶
/*
Copyright (c) 2020 Electrosmith, Corp, Paul Batchelor
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
#pragma once
#ifndef DSY_CROSSFADE_H
#define DSY_CROSSFADE_H
#include <stdint.h>
#ifdef __cplusplus
namespace daisysp
{
enum
{
CROSSFADE_LIN,
CROSSFADE_CPOW,
CROSSFADE_LOG,
CROSSFADE_EXP,
CROSSFADE_LAST,
};
class CrossFade
{
public:
CrossFade() {}
~CrossFade() {}
inline void Init(int curve)
{
pos_ = 0.5f;
curve_ = curve < CROSSFADE_LAST ? curve : CROSSFADE_LIN;
}
inline void Init() { Init(CROSSFADE_LIN); }
float Process(float &in1, float &in2);
inline void SetPos(float pos) { pos_ = pos; }
inline void SetCurve(uint8_t curve) { curve_ = curve; }
inline float GetPos(float pos) { return pos_; }
inline uint8_t GetCurve(uint8_t curve) { return curve_; }
private:
float pos_;
uint8_t curve_;
};
} // namespace daisysp
#endif
#endif