-
Notifications
You must be signed in to change notification settings - Fork 0
/
DDLModule.h
133 lines (92 loc) · 4.58 KB
/
DDLModule.h
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
RackAFX(TM)
Applicatios Programming Interface
Derived Class Object Definition
Copyright(c) Tritone Systems Inc. 2006-2012
Your plug-in must implement the constructor,
destructor and virtual Plug-In API Functions below.
*/
#pragma once
// base class
#include "plugin.h"
// abstract base class for RackAFX filters
class CDDLModule : public CPlugIn
{
public:
// RackAFX Plug-In API Member Methods:
// The followung 5 methods must be impelemented for a meaningful Plug-In
//
// 1. One Time Initialization
CDDLModule();
// 2. One Time Destruction
virtual ~CDDLModule(void);
// 3. The Prepare For Play Function is called just before audio streams
virtual bool __stdcall prepareForPlay();
// 4. processAudioFrame() processes an audio input to create an audio output
virtual bool __stdcall processAudioFrame(float* pInputBuffer, float* pOutputBuffer, UINT uNumInputChannels, UINT uNumOutputChannels);
// 5. userInterfaceChange() occurs when the user moves a control.
virtual bool __stdcall userInterfaceChange(int nControlIndex);
// OPTIONAL ADVANCED METHODS ------------------------------------------------------------------------------------------------
// These are more advanced; see the website for more details
//
// 6. initialize() is called once just after creation; if you need to use Plug-In -> Host methods
// such as sendUpdateGUI(), you must do them here and NOT in the constructor
virtual bool __stdcall initialize();
// 7. joystickControlChange() occurs when the user moves a control.
virtual bool __stdcall joystickControlChange(float fControlA, float fControlB, float fControlC, float fControlD, float fACMix, float fBDMix);
// 8. process buffers instead of Frames:
// NOTE: set m_bWantBuffers = true to use this function
virtual bool __stdcall processRackAFXAudioBuffer(float* pInputBuffer, float* pOutputBuffer, UINT uNumInputChannels, UINT uNumOutputChannels, UINT uBufferSize);
// 9. rocess buffers instead of Frames:
// NOTE: set m_bWantVSTBuffers = true to use this function
virtual bool __stdcall processVSTAudioBuffer(float** ppInputs, float** ppOutputs, UINT uNumChannels, int uNumFrames);
// 10. MIDI Note On Event
virtual bool __stdcall midiNoteOn(UINT uChannel, UINT uMIDINote, UINT uVelocity);
// 11. MIDI Note Off Event
virtual bool __stdcall midiNoteOff(UINT uChannel, UINT uMIDINote, UINT uVelocity, bool bAllNotesOff);
// 12. MIDI Modulation Wheel uModValue = 0 -> 127
virtual bool __stdcall midiModWheel(UINT uChannel, UINT uModValue);
// 13. MIDI Pitch Bend
// nActualPitchBendValue = -8192 -> 8191, 0 is center, corresponding to the 14-bit MIDI value
// fNormalizedPitchBendValue = -1.0 -> +1.0, 0 is at center by using only -8191 -> +8191
virtual bool __stdcall midiPitchBend(UINT uChannel, int nActualPitchBendValue, float fNormalizedPitchBendValue);
// 14. MIDI Timing Clock (Sunk to BPM) function called once per clock
virtual bool __stdcall midiClock();
// 15. all MIDI messages -
// NOTE: set m_bWantAllMIDIMessages true to get everything else (other than note on/off)
virtual bool __stdcall midiMessage(unsigned char cChannel, unsigned char cStatus, unsigned char cData1, unsigned char cData2);
// 16. initUI() is called only once from the constructor; you do not need to write or call it. Do NOT modify this function
virtual bool __stdcall initUI();
// Add your code here: ----------------------------------------------------------- //
float m_fDelayInSamples;
float m_fFeedback;
float m_fWetLevel;
// maintain our buffer
float* m_pBuffer;
int m_nReadIndex;
int m_nWriteIndex;
int m_nBufferSize;
// cooking
void cookVariables();
// reset
void resetDelay();
// stuff for parent object use
bool m_bUseExternalFeedback; // flag for enabling/disabling
float m_fFeedbackIn; // the user supplied feedback sample value
int m_nSamplesBack; //the user supplied number of "old" samples to go back for multitap delays
float getPastSample(int m_nSamplesBack);
// current FB is fb*output
float getCurrentFeedbackOutput(){return m_fFeedback*m_pBuffer[m_nReadIndex];}
// set the feedback sample
void setCurrentFeedbackInput(float f){m_fFeedbackIn = f;}
// enable/disable external FB source
void setUsesExternalFeedback(bool b){m_bUseExternalFeedback = false;}
// END OF USER CODE -------------------------------------------------------------- //
// ADDED BY RACKAFX -- DO NOT EDIT THIS CODE!!! ----------------------------------- //
// **--0x07FD--**
float m_fDelay_ms;
float m_fFeedback_pct;
float m_fWetLevel_pct;
// **--0x1A7F--**
// ------------------------------------------------------------------------------- //
};