blob: a3a04fb617c5668f76a531a19a9656e34ba96c10 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#pragma once
#include <QMap>
#include "effects/effectprocessor.h"
#include "engine/engine.h"
#include "engine/effects/engineeffect.h"
#include "engine/effects/engineeffectparameter.h"
#include "util/class.h"
#include "util/defs.h"
#include "util/sample.h"
#include "util/samplebuffer.h"
class EchoGroupState : public EffectState {
public:
// 3 seconds max. This supports the full range of 2 beats for tempos down to
// 40 BPM.
static constexpr int kMaxDelaySeconds = 3;
EchoGroupState(const mixxx::EngineParameters& bufferParameters)
: EffectState(bufferParameters) {
audioParametersChanged(bufferParameters);
clear();
}
void audioParametersChanged(const mixxx::EngineParameters& bufferParameters) {
delay_buf = mixxx::SampleBuffer(kMaxDelaySeconds
* bufferParameters.sampleRate() * bufferParameters.channelCount());
};
void clear() {
delay_buf.clear();
prev_send = 0.0f;
prev_feedback= 0.0f;
prev_delay_samples = 0;
write_position = 0;
ping_pong = 0;
};
mixxx::SampleBuffer delay_buf;
CSAMPLE_GAIN prev_send;
CSAMPLE_GAIN prev_feedback;
int prev_delay_samples;
int write_position;
int ping_pong;
};
class EchoEffect : public EffectProcessorImpl<EchoGroupState> {
public:
EchoEffect(EngineEffect* pEffect);
static QString getId();
static EffectManifestPointer getManifest();
void processChannel(const ChannelHandle& handle,
EchoGroupState* pState,
const CSAMPLE* pInput, CSAMPLE* pOutput,
const mixxx::EngineParameters& bufferParameters,
const EffectEnableState enableState,
const GroupFeatureState& groupFeatures);
private:
QString debugString() const {
return getId();
}
EngineEffectParameter* m_pDelayParameter;
EngineEffectParameter* m_pSendParameter;
EngineEffectParameter* m_pFeedbackParameter;
EngineEffectParameter* m_pPingPongParameter;
EngineEffectParameter* m_pQuantizeParameter;
EngineEffectParameter* m_pTripletParameter;
DISALLOW_COPY_AND_ASSIGN(EchoEffect);
};
|