-
Notifications
You must be signed in to change notification settings - Fork 1
/
EasyAirwindowsAudioEffectX.h
103 lines (73 loc) · 3.7 KB
/
EasyAirwindowsAudioEffectX.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
/* ========================================
* This file was generated by: https://github.com/iffyloop/EasyAirwindows
* Based on airwin2clap source: https://github.com/baconpaul/airwin2clap
* Please refer to airwin2clap author information contained later in this file
* ======================================== */
#pragma once
#include <cstdint>
#include <cstring>
#include <string>
#include <cmath>
#include <set>
#include <string>
#include <math.h>
#pragma warning(push)
#pragma warning(disable : 4996)
namespace EasyAirwindows {
static constexpr double __EasyAirwindows_M_PI = 3.14159265358979323846;
static constexpr double __EasyAirwindows_M_PI_2 = 1.57079632679489661923;
static constexpr double __EasyAirwindows_M_PI_4 = 0.785398163397448309616;
//
// Created by Paul Walker on 6/20/22.
//
// This file has the smallest possible API required to allow each of the Airwin
// MacVST to compile without any external API.
typedef const void *__EasyAirwindows_audioMasterCallback;
typedef int __EasyAirwindows_VstPlugCategory;
typedef int32_t __EasyAirwindows_VstInt32;
#define __EasyAirwindows_vst_strncpy strncpy
static constexpr uint32_t __EasyAirwindows_kVstMaxProgNameLen = 32;
static constexpr uint32_t __EasyAirwindows_kVstMaxParamStrLen = 64;
static constexpr uint32_t __EasyAirwindows_kVstMaxProductStrLen = 64;
static constexpr uint32_t __EasyAirwindows_kVstMaxVendorStrLen = 64;
static constexpr uint32_t __EasyAirwindows_kPlugCategEffect = 1;
inline void __EasyAirwindows_float2string(float f, char *c, uint32_t n) {
__EasyAirwindows_vst_strncpy(c, std::to_string(f).c_str(), n);
}
inline void __EasyAirwindows_dB2string(float value, char *t, uint32_t num) {
if (value <= 0.00001) // -100 dB, show -inf from that point onwards
__EasyAirwindows_vst_strncpy (t, "-inf", num);
else
__EasyAirwindows_float2string ((float)(20.0 * log10 (value)), t, num);
}
inline void __EasyAirwindows_int2string(int f, char *c, uint32_t n) {
__EasyAirwindows_vst_strncpy(c, std::to_string(f).c_str(), n);
}
struct EasyAirwindowsAudioEffect {
uint32_t numParams{0};
EasyAirwindowsAudioEffect(__EasyAirwindows_audioMasterCallback audioMaster, uint32_t kNumPrograms, uint32_t kNumParameters) : numParams(kNumParameters){}
virtual ~EasyAirwindowsAudioEffect() = default;
double sr{1};
void setSampleRate(double d) { sr = d; }
double getSampleRate() { return sr; }
int nin{0}, nout{0};
void setNumInputs(uint32_t kNumInputs) { nin = kNumInputs; }
void setNumOutputs(uint32_t kNumOutputs) { nout = kNumOutputs; }
void setUniqueID(uint32_t kUniqueId) {}
bool canProcessReplacing() { return false; }
bool canDoubleReplacing() { return false; }
void programsAreChunks(bool b) {}
virtual void processReplacing(float **inputs, float **outputs, __EasyAirwindows_VstInt32 sampleFrames) = 0;
virtual void processDoubleReplacing(double **inputs, double **outputs, __EasyAirwindows_VstInt32 sampleFrames) = 0;
virtual __EasyAirwindows_VstInt32 getChunk(void **data, bool isPreset) { return 0; };
virtual __EasyAirwindows_VstInt32 setChunk(void *data, __EasyAirwindows_VstInt32 byteSize, bool isPreset) { return 0; };
virtual float getParameter(__EasyAirwindows_VstInt32 index) { return 0.f; };
virtual void setParameter(__EasyAirwindows_VstInt32 index, float value) {};
virtual void getParameterLabel(__EasyAirwindows_VstInt32 index, char *text) {};
virtual void getParameterName(__EasyAirwindows_VstInt32 index, char *text) {};
virtual void getParameterDisplay(__EasyAirwindows_VstInt32 index, char *text) {};
virtual __EasyAirwindows_VstInt32 canDo(char *text) = 0;
};
typedef EasyAirwindowsAudioEffect EasyAirwindowsAudioEffectX;
}
#pragma warning(pop)