DaisySP
Loading...
Searching...
No Matches
crossfade.h
1/*
2Copyright (c) 2020 Electrosmith, Corp, Paul Batchelor
3
4Use of this source code is governed by an MIT-style
5license that can be found in the LICENSE file or at
6https://opensource.org/licenses/MIT.
7*/
8
9#pragma once
10#ifndef DSY_CROSSFADE_H
11#define DSY_CROSSFADE_H
12#include <stdint.h>
13#ifdef __cplusplus
14
15namespace daisysp
16{
24enum
25{
26 CROSSFADE_LIN,
27 CROSSFADE_CPOW,
28 CROSSFADE_LOG,
29 CROSSFADE_EXP,
30 CROSSFADE_LAST,
31};
32
42{
43 public:
44 CrossFade() {}
45 ~CrossFade() {}
51 inline void Init(int curve)
52 {
53 pos_ = 0.5f;
54 curve_ = curve < CROSSFADE_LAST ? curve : CROSSFADE_LIN;
55 }
56
59 inline void Init() { Init(CROSSFADE_LIN); }
62 float Process(float &in1, float &in2);
63
64
68 inline void SetPos(float pos) { pos_ = pos; }
72 inline void SetCurve(uint8_t curve) { curve_ = curve; }
75 inline float GetPos(float pos) { return pos_; }
78 inline uint8_t GetCurve(uint8_t curve) { return curve_; }
79
80 private:
81 float pos_;
82 uint8_t curve_;
83};
84} // namespace daisysp
85#endif
86#endif
Definition crossfade.h:42
void SetCurve(uint8_t curve)
Definition crossfade.h:72
float GetPos(float pos)
Definition crossfade.h:75
void Init(int curve)
Definition crossfade.h:51
float Process(float &in1, float &in2)
Definition crossfade.cpp:12
void SetPos(float pos)
Definition crossfade.h:68
void Init()
Definition crossfade.h:59
uint8_t GetCurve(uint8_t curve)
Definition crossfade.h:78
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16