ape  0.5.0
Audio Programming Environment
SharedInterface.h
Go to the documentation of this file.
1 /*************************************************************************************
2 
3  Audio Programming Environment - Audio Plugin - v. 0.3.0.
4 
5  Copyright (C) 2017 Janus Lynggaard Thorborg [LightBridge Studios]
6 
7  This program is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 
20  See \licenses\ for additional details on licenses associated with this program.
21 
22  **************************************************************************************
23 
24  file:SharedInterface.h
25 
26  Defines the shared interface between the engine and the plugins,
27  providing a common API.
28 
29 *************************************************************************************/
30 
31 #ifndef APE_SHAREDINTERFACE_H
32  #define APE_SHAREDINTERFACE_H
33 
34  #include "APE.h"
35 
36  typedef enum
37  {
42 
43  typedef enum
44  {
49 
50  typedef enum
51  {
54  } APE_DataType;
55 
56  typedef enum
57  {
58  APE_FFT_Inverse = 0 << 0,
59  APE_FFT_Forward = 1 << 0,
60  APE_FFT_Real = 1 << 1,
61  APE_FFT_NonScaled = 1 << 2
63 
64  typedef enum
65  {
79 
80  struct APE_SharedInterface;
81 
82  struct APE_AudioFile
83  {
84  const char* name;
85  unsigned long long samples;
86  unsigned int channels;
88  double sampleRate;
89  const float* const* data;
90  };
91 
92  struct APE_Parameter
93  {
95  int id, changeFlags;
96  };
97 
101  struct APE_PlayHeadPosition
102  {
104  double bpm;
105 
107  int timeSigNumerator;
109  int timeSigDenominator;
110 
112  long long timeInSamples;
114  double timeInSeconds;
115 
117  double editOriginTime;
118 
120  double ppqPosition;
121 
131 
133  int frameRate;
134 
136  bool isPlaying;
137 
142  bool isRecording;
143 
148  double ppqLoopStart;
149 
154  double ppqLoopEnd;
155 
157  bool isLooping;
158  };
159 
160  struct APE_SharedInterface
161  {
162  void (APE_API * abortPlugin) (struct APE_SharedInterface * iface, const char * reason);
163  float (APE_API * getSampleRate) (struct APE_SharedInterface * iface);
164  int (APE_API_VARI * printLine) (struct APE_SharedInterface * iface, unsigned nColor, const char * fmt, ...);
165  int (APE_API_VARI * printThemedLine) (struct APE_SharedInterface * iface, APE_TextColour color, const char * fmt, ...);
166  int (APE_API * msgBox) (struct APE_SharedInterface * iface, const char * text, const char * title, int nStyle, int nBlocking);
167  long long (APE_API * timerGet) (struct APE_SharedInterface * iface);
168  double (APE_API * timerDiff) (struct APE_SharedInterface * iface, long long time);
169  void * (APE_API * alloc) (struct APE_SharedInterface * iface, APE_AllocationLabel label, size_t size, size_t align);
170  void (APE_API * free) (struct APE_SharedInterface * iface, void * ptr);
171  void (APE_API * setInitialDelay) (struct APE_SharedInterface * iface, int samples);
172  int (APE_API_VARI * createLabel) (struct APE_SharedInterface * iface, const char * name, const char * fmt, ...);
173  int (APE_API * getNumInputs) (struct APE_SharedInterface * iface);
174  int (APE_API * getNumOutputs) (struct APE_SharedInterface * iface);
175  int (APE_API * createMeter) (struct APE_SharedInterface * iface, const char * name, const double* extVal, const double* peakVal);
176  double (APE_API * getBPM) (struct APE_SharedInterface * iface);
177  int (APE_API * createPlot) (struct APE_SharedInterface * iface, const char * name, const double * const values, const unsigned int numVals);
178  int (APE_API * presentTrace) (struct APE_SharedInterface * iface, const char** nameTuple, size_t numNames, const float* const values, size_t numValues);
179  int (APE_API * createNormalParameter) (struct APE_SharedInterface * iface, const char * name, const char * unit, APE_Parameter* extVal, APE_Transformer transformer, APE_Normalizer normalizer, PFloat min, PFloat max);
180  int (APE_API * createBooleanParameter) (struct APE_SharedInterface * iface, const char * name, APE_Parameter* extVal);
181  int (APE_API * createListParameter) (struct APE_SharedInterface * iface, const char * name, APE_Parameter* extVal, int numValues, const char* const* values);
182  int (APE_API * destroyResource) (struct APE_SharedInterface * iface, int resourceID, int reserved);
183  int (APE_API * loadAudioFile) (struct APE_SharedInterface * iface, const char* path, double sampleRate, APE_AudioFile* result);
184  int (APE_API * createFFT) (struct APE_SharedInterface * iface, APE_DataType type, size_t size);
185  void (APE_API * performFFT) (struct APE_SharedInterface * iface, int fftID, APE_FFT_Options options, const void* in, void* out);
186  void (APE_API * releaseFFT) (struct APE_SharedInterface * iface, int fftID);
187  void (APE_API * setTriggeringChannel) (struct APE_SharedInterface * iface, int channel);
188  int (APE_API * createAudioOutputFile) (struct APE_SharedInterface * iface, const char* relativePath, double sampleRate, int channels, int bits, float quality);
189  void (APE_API * writeAudioFile) (struct APE_SharedInterface * iface, int file, unsigned int numSamples, const float* const* data);
190  void (APE_API * closeAudioFile) (struct APE_SharedInterface * iface, int file);
191  int (APE_API * getPlayHeadPosition) (struct APE_SharedInterface * iface, struct APE_PlayHeadPosition* result);
192  };
193 
194 #if defined(__cplusplus) && !defined(__cfront)
195 
196  //using SharedInterface = APE_SharedInterface;
197 
198 #endif
199 #endif
APE_PlayHeadPosition::ppqPositionOfLastBarStart
double ppqPositionOfLastBarStart
Definition: SharedInterface.h:129
APE_Parameter::step
PFloat step
Definition: SharedInterface.h:93
APE.h
APE_SharedInterface::min
const char const char APE_Parameter APE_Transformer APE_Normalizer PFloat min
Definition: SharedInterface.h:178
APE_SharedInterface::type
APE_DataType type
Definition: SharedInterface.h:183
APE_DataType_Double
Definition: SharedInterface.h:52
APE_SharedInterface::file
int file
Definition: SharedInterface.h:188
APE_Alloc_Buffer
Definition: SharedInterface.h:64
APE_SharedInterface::samples
int samples
Definition: SharedInterface.h:170
APE_Parameter::id
int id
Definition: SharedInterface.h:94
APE_SharedInterface::size
APE_DataType size_t size
Definition: SharedInterface.h:183
APE_SharedInterface::resourceID
int resourceID
Definition: SharedInterface.h:181
APE_Parameter::changeFlags
int changeFlags
Definition: SharedInterface.h:94
APE_Alloc_Temp
Definition: SharedInterface.h:66
APE_PlayHeadPosition::timeInSeconds
double timeInSeconds
Definition: SharedInterface.h:113
APE_SharedInterface::result
const char double APE_AudioFile * result
Definition: SharedInterface.h:182
APE_AudioFile::fractionalLength
double fractionalLength
Definition: SharedInterface.h:86
APE_DataType
APE_DataType
Definition: SharedInterface.h:49
APE_TextColour_Default
Definition: SharedInterface.h:44
APE_SharedInterface::color
unsigned const char APE_TextColour color
Definition: SharedInterface.h:164
APE_SharedInterface::nColor
unsigned nColor
Definition: SharedInterface.h:163
APE_Normalizer
PFloat(APE_API * APE_Normalizer)(PFloat y, PFloat _min, PFloat _max)
Definition: APE.h:59
APE_FFT_NonScaled
Definition: SharedInterface.h:60
APE_SharedInterface::values
const char const double *const values
Definition: SharedInterface.h:176
APE_TextColour_Error
Definition: SharedInterface.h:46
APE_PlayHeadPosition::timeInSamples
long long timeInSamples
Definition: SharedInterface.h:111
APE_SharedInterface::name
const char * name
Definition: SharedInterface.h:171
APE_AudioFile::sampleRate
double sampleRate
Definition: SharedInterface.h:87
APE_AudioFile::samples
unsigned long long samples
Definition: SharedInterface.h:84
APE_TextColour
APE_TextColour
Definition: SharedInterface.h:42
APE_FFT_Real
Definition: SharedInterface.h:59
APE_SharedInterface::data
int unsigned int const float *const * data
Definition: SharedInterface.h:188
APE_PlayHeadPosition::frameRate
int frameRate
Definition: SharedInterface.h:132
APE_SharedInterface::fmt
unsigned const char * fmt
Definition: SharedInterface.h:163
APE_SharedInterface::int
int(APE_API_VARI *printLine)(struct APE_SharedInterface *iface
APE_Optimization_Fast
Whatever settings are the fastest to compile
Definition: SharedInterface.h:72
APE_SharedInterface::normalizer
const char const char APE_Parameter APE_Transformer APE_Normalizer normalizer
Definition: SharedInterface.h:178
APE_PlayHeadPosition::bpm
double bpm
Definition: SharedInterface.h:103
APE_SharedInterface::nStyle
unsigned const char APE_TextColour const char const char const char int nStyle
Definition: SharedInterface.h:165
APE_PlayHeadPosition::timeSigNumerator
int timeSigNumerator
Definition: SharedInterface.h:106
APE_FFT_Forward
Definition: SharedInterface.h:58
APE_Parameter::old
PFloat old
Definition: SharedInterface.h:93
APE_SharedInterface::channels
const char double int channels
Definition: SharedInterface.h:187
APE_SharedInterface::quality
const char double int int float quality
Definition: SharedInterface.h:187
APE_SharedInterface::fmt
unsigned const char APE_TextColour const char * fmt
Definition: SharedInterface.h:164
APE_SharedInterface::extVal
const char const double * extVal
Definition: SharedInterface.h:174
APE_PlayHeadPosition::ppqPosition
double ppqPosition
Definition: SharedInterface.h:119
APE_SharedInterface::numVals
const char const double *const const unsigned int numVals
Definition: SharedInterface.h:176
APE_SharedInterface::out
int APE_FFT_Options const void void * out
Definition: SharedInterface.h:184
PFloat
double PFloat
Floating-precision point type used for parameter processing
Definition: APE.h:56
APE_SharedInterface::time
long long time
Definition: SharedInterface.h:167
APE_SharedInterface::fftID
int fftID
Definition: SharedInterface.h:184
APE_SharedInterface::extVal
const char APE_Parameter * extVal
Definition: SharedInterface.h:179
APE_SharedInterface::channel
int channel
Definition: SharedInterface.h:186
APE_Optimization_Best
Whatever settings produce the fastest code
Definition: SharedInterface.h:76
APE_PlayHeadPosition::isLooping
bool isLooping
Definition: SharedInterface.h:156
APE_SharedInterface::transformer
const char const char APE_Parameter APE_Transformer transformer
Definition: SharedInterface.h:178
APE_FFT_Inverse
Definition: SharedInterface.h:57
APE_SharedInterface::nBlocking
unsigned const char APE_TextColour const char const char const char int int nBlocking
Definition: SharedInterface.h:165
APE_SharedInterface::unit
const char const char * unit
Definition: SharedInterface.h:178
APE_SharedInterface::nameTuple
const char ** nameTuple
Definition: SharedInterface.h:177
APE_SharedInterface::sampleRate
const char double sampleRate
Definition: SharedInterface.h:182
APE_SharedInterface::options
int APE_FFT_Options options
Definition: SharedInterface.h:184
APE_SharedInterface::numSamples
int unsigned int numSamples
Definition: SharedInterface.h:188
APE_SharedInterface::long
long long(APE_API *timerGet)(struct APE_SharedInterface *iface)
APE_PlayHeadPosition
juce::AudioPlayHead::CurrentPositionInfo
Definition: SharedInterface.h:100
APE_SharedInterface::ptr
void * ptr
Definition: SharedInterface.h:169
APE_SharedInterface::double
double(APE_API *timerDiff)(struct APE_SharedInterface *iface
APE_SharedInterface::peakVal
const char const double const double * peakVal
Definition: SharedInterface.h:174
APE_SharedInterface
Definition: SharedInterface.h:159
APE_PlayHeadPosition::editOriginTime
double editOriginTime
Definition: SharedInterface.h:116
APE_Parameter::next
PFloat next
Definition: SharedInterface.h:93
APE_SharedInterface::title
unsigned const char APE_TextColour const char const char const char * title
Definition: SharedInterface.h:165
APE_SharedInterface::path
const char * path
Definition: SharedInterface.h:182
APE_AudioFile::data
const float *const * data
Definition: SharedInterface.h:88
APE_SharedInterface::float
float(APE_API *getSampleRate)(struct APE_SharedInterface *iface)
APE_SharedInterface::numValues
const char size_t const float *const size_t numValues
Definition: SharedInterface.h:177
APE_SharedInterface::max
const char const char APE_Parameter APE_Transformer APE_Normalizer PFloat PFloat max
Definition: SharedInterface.h:178
APE_Optimization_Level
APE_Optimization_Level
Definition: SharedInterface.h:63
APE_Optimization_Debug
For checked builds, can include extra guards
Definition: SharedInterface.h:68
APE_AllocationLabel
APE_AllocationLabel
Definition: SharedInterface.h:35
APE_AudioFile::channels
unsigned int channels
Definition: SharedInterface.h:85
APE_Alloc_Tiny
Definition: SharedInterface.h:65
APE_SharedInterface::numNames
const char size_t numNames
Definition: SharedInterface.h:177
APE_SharedInterface::void
void(APE_API *abortPlugin)(struct APE_SharedInterface *iface
APE_SharedInterface::relativePath
const char * relativePath
Definition: SharedInterface.h:187
APE_DataType_Single
Definition: SharedInterface.h:51
APE_API_VARI
#define APE_API_VARI
Definition: APE.h:49
APE_PlayHeadPosition::ppqLoopEnd
double ppqLoopEnd
Definition: SharedInterface.h:153
APE_Transformer
PFloat(APE_API * APE_Transformer)(PFloat x, PFloat _min, PFloat _max)
Definition: APE.h:58
APE_PlayHeadPosition::isRecording
bool isRecording
Definition: SharedInterface.h:141
APE_AudioFile::name
const char * name
Definition: SharedInterface.h:83
APE_PlayHeadPosition::timeSigDenominator
int timeSigDenominator
Definition: SharedInterface.h:108
APE_Parameter
Definition: SharedInterface.h:91
APE_PlayHeadPosition::isPlaying
bool isPlaying
Definition: SharedInterface.h:135
APE_SharedInterface::text
unsigned const char APE_TextColour const char const char * text
Definition: SharedInterface.h:165
APE_SharedInterface::reason
const char * reason
Definition: SharedInterface.h:161
APE_FFT_Options
APE_FFT_Options
Definition: SharedInterface.h:55
APE_SharedInterface::alloc
void *APE_API * alloc(struct APE_SharedInterface *iface, APE_AllocationLabel label, size_t size, size_t align)
APE_AudioFile
Definition: SharedInterface.h:81
APE_TextColour_Warning
Definition: SharedInterface.h:45
APE_SharedInterface::in
int APE_FFT_Options const void * in
Definition: SharedInterface.h:184
APE_SharedInterface::bits
const char double int int bits
Definition: SharedInterface.h:187
APE_SharedInterface::reserved
int int reserved
Definition: SharedInterface.h:181
APE_PlayHeadPosition::ppqLoopStart
double ppqLoopStart
Definition: SharedInterface.h:147
APE_API
#define APE_API
Definition: APE.h:48
APE_SharedInterface::values
const char size_t const float *const values
Definition: SharedInterface.h:177