ASPiK SDK
plugincore.h
1 // -----------------------------------------------------------------------------
2 // ASPiK Plugin Kernel File: plugincore.h
3 //
12 // -----------------------------------------------------------------------------
13 #ifndef __pluginCore_h__
14 #define __pluginCore_h__
15 
16 #include "pluginbase.h"
17 
18 // **--0x7F1F--**
19 enum controlID{
20  volume_dB
21 };
22 
23 // **--0x0F1F--**
24 
45 class PluginCore : public PluginBase
46 {
47 public:
48  PluginCore();
49 
51  virtual ~PluginCore(){}
52 
53  // --- PluginBase Overrides ---
54  //
56  bool initPluginParameters();
57 
59  virtual bool reset(ResetInfo& resetInfo);
60 
62  virtual bool initialize(PluginInfo& _pluginInfo);
63 
64  // --- preProcess: sync GUI parameters here; override if you don't want to use automatic variable-binding
65  virtual bool preProcessAudioBuffers(ProcessBufferInfo& processInfo);
66 
68  virtual bool processAudioFrame(ProcessFrameInfo& processFrameInfo);
69 
70  // --- uncomment and override this for buffer processing; see base class implementation for
71  // help on breaking up buffers and getting info from processBufferInfo
72  //virtual bool processAudioBuffers(ProcessBufferInfo& processBufferInfo);
73 
75  virtual bool postProcessAudioBuffers(ProcessBufferInfo& processInfo);
76 
78  virtual bool updatePluginParameter(int32_t controlID, double controlValue, ParameterUpdateInfo& paramInfo);
79 
81  virtual bool updatePluginParameterNormalized(int32_t controlID, double normalizedValue, ParameterUpdateInfo& paramInfo);
82 
84  virtual bool postUpdatePluginParameter(int32_t controlID, double controlValue, ParameterUpdateInfo& paramInfo);
85 
87  virtual bool guiParameterChanged(int32_t controlID, double actualValue);
88 
90  virtual bool processMessage(MessageInfo& messageInfo);
91 
93  virtual bool processMIDIEvent(midiEvent& event);
94 
96  virtual bool setVectorJoystickParameters(const VectorJoystickData& vectorJoysickData);
97 
99  bool initPluginPresets();
100 
101  // --- BEGIN USER VARIABLES AND FUNCTIONS -------------------------------------- //
102  // Add your variables and methods here
103  double phaseInc = 0.0;
104  double moduloCounter = 0.0;
105  bool noteOn = false;
106 
107 
108  // --- END USER VARIABLES AND FUNCTIONS -------------------------------------- //
109 
110 private:
111  // **--0x07FD--**
112  double volume_dB = 0.000000;
113 
114  // **--0x1A7F--**
115  // --- end member variables
116 
117 public:
122  static const char* getPluginBundleName();
123 
128  static const char* getPluginName();
129 
134  static const char* getShortPluginName();
135 
140  static const char* getVendorName();
141 
146  static const char* getVendorURL();
147 
152  static const char* getVendorEmail();
153 
158  static const char* getAUCocoaViewFactoryName();
159 
164  static pluginType getPluginType();
165 
170  static const char* getVSTFUID();
171 
176  static int32_t getFourCharCode();
177 
179  bool initPluginDescriptors();
180 
181 };
182 
183 
184 
185 //----------------------------------------------------------------
186 // --- MIDI Constants
187 //----------------------------------------------------------------
188 //
189 // --- CHANNEL VOICE MESSAGES
190 const unsigned char NOTE_OFF = 0x80;
191 const unsigned char NOTE_ON = 0x90;
192 const unsigned char POLY_PRESSURE = 0xA0;
193 const unsigned char CONTROL_CHANGE = 0xB0;
194 const unsigned char PROGRAM_CHANGE = 0xC0;
195 const unsigned char CHANNEL_PRESSURE = 0xD0;
196 const unsigned char PITCH_BEND = 0xE0;
197 
198 // --- CONTINUOUS CONTROLLERS
199 const unsigned char MOD_WHEEL = 0x01;
200 const unsigned char VOLUME_CC07 = 0x07;
201 const unsigned char PAN_CC10 = 0x0A;
202 const unsigned char EXPRESSION_CC11 = 0x0B;
203 const unsigned char JOYSTICK_X = 0x10;
204 const unsigned char JOYSTICK_Y = 0x11;
205 const unsigned char SUSTAIN_PEDAL = 0x40;
206 const unsigned char RESET_ALL_CONTROLLERS = 0x79;
207 const unsigned char ALL_NOTES_OFF = 0x7B;
208 
209 // --- SYSTEM MESSAGES
210 const unsigned char SYSTEM_EXCLUSIVE = 0xF0;
211 const unsigned char MIDI_TIME_CODE = 0xF1;
212 const unsigned char SONG_POSITION_POINTER = 0xF2;
213 const unsigned char SONG_SELECT = 0xF3;
214 const unsigned char TUNE_REQUEST = 0xF6;
215 const unsigned char END_OF_EXCLUSIVE = 0xF7;
216 const unsigned char TIMING_CLOCK = 0xF8;
217 const unsigned char START = 0xFA;
218 const unsigned char CONTINUE = 0xFB;
219 const unsigned char SToP = 0xFC;
220 const unsigned char ACTIVE_SENSING = 0xFE;
221 const unsigned char SYSTEM_RESET = 0xFF;
222 
223 // --- FOR Synth Projects
224 enum midiChannels {
225  MIDI_CH_1 = 0, MIDI_CH_2, MIDI_CH_3, MIDI_CH_4, MIDI_CH_5, MIDI_CH_6, MIDI_CH_7,
226  MIDI_CH_8, MIDI_CH_9, MIDI_CH_10, MIDI_CH_11, MIDI_CH_12, MIDI_CH_13,
227  MIDI_CH_14, MIDI_CH_15, MIDI_CH_16, MIDI_CH_ALL
228 };
229 
230 inline double unipolarToBipolar(double value)
231 {
232  return 2.0*value - 1.0;
233 }
234 
235 const float midiFreqTable[128] = {
236  8.1757993698120117,
237  8.6619567871093750,
238  9.1770238876342773,
239  9.7227182388305664,
240  10.3008613586425780,
241  10.9133825302124020,
242  11.5623254776000980,
243  12.2498569488525390,
244  12.9782714843750000,
245  13.7500000000000000,
246  14.5676174163818360,
247  15.4338531494140630,
248  16.3515987396240230,
249  17.3239135742187500,
250  18.3540477752685550,
251  19.4454364776611330,
252  20.6017227172851560,
253  21.8267650604248050,
254  23.1246509552001950,
255  24.4997138977050780,
256  25.9565429687500000,
257  27.5000000000000000,
258  29.1352348327636720,
259  30.8677062988281250,
260  32.7031974792480470,
261  34.6478271484375000,
262  36.7080955505371090,
263  38.8908729553222660,
264  41.2034454345703130,
265  43.6535301208496090,
266  46.2493019104003910,
267  48.9994277954101560,
268  51.9130859375000000,
269  55.0000000000000000,
270  58.2704696655273440,
271  61.7354125976562500,
272  65.4063949584960940,
273  69.2956542968750000,
274  73.4161911010742190,
275  77.7817459106445310,
276  82.4068908691406250,
277  87.3070602416992190,
278  92.4986038208007810,
279  97.9988555908203130,
280  103.8261718750000000,
281  110.0000000000000000,
282  116.5409393310546900,
283  123.4708251953125000,
284  130.8127899169921900,
285  138.5913085937500000,
286  146.8323822021484400,
287  155.5634918212890600,
288  164.8137817382812500,
289  174.6141204833984400,
290  184.9972076416015600,
291  195.9977111816406200,
292  207.6523437500000000,
293  220.0000000000000000,
294  233.0818786621093700,
295  246.9416503906250000,
296  261.6255798339843700,
297  277.1826171875000000,
298  293.6647644042968700,
299  311.1269836425781200,
300  329.6275634765625000,
301  349.2282409667968700,
302  369.9944152832031200,
303  391.9954223632812500,
304  415.3046875000000000,
305  440.0000000000000000,
306  466.1637573242187500,
307  493.8833007812500000,
308  523.2511596679687500,
309  554.3652343750000000,
310  587.3295288085937500,
311  622.2539672851562500,
312  659.2551269531250000,
313  698.4564819335937500,
314  739.9888305664062500,
315  783.9908447265625000,
316  830.6093750000000000,
317  880.0000000000000000,
318  932.3275146484375000,
319  987.7666015625000000,
320  1046.5023193359375000,
321  1108.7304687500000000,
322  1174.6590576171875000,
323  1244.5079345703125000,
324  1318.5102539062500000,
325  1396.9129638671875000,
326  1479.9776611328125000,
327  1567.9816894531250000,
328  1661.2187500000000000,
329  1760.0000000000000000,
330  1864.6550292968750000,
331  1975.5332031250000000,
332  2093.0046386718750000,
333  2217.4609375000000000,
334  2349.3181152343750000,
335  2489.0158691406250000,
336  2637.0205078125000000,
337  2793.8259277343750000,
338  2959.9553222656250000,
339  3135.9633789062500000,
340  3322.4375000000000000,
341  3520.0000000000000000,
342  3729.3100585937500000,
343  3951.0664062500000000,
344  4186.0092773437500000,
345  4434.9218750000000000,
346  4698.6362304687500000,
347  4978.0317382812500000,
348  5274.0410156250000000,
349  5587.6518554687500000,
350  5919.9106445312500000,
351  6271.9267578125000000,
352  6644.8750000000000000,
353  7040.0000000000000000,
354  7458.6201171875000000,
355  7902.1328125000000000,
356  8372.0185546875000000,
357  8869.8437500000000000,
358  9397.2724609375000000,
359  9956.0634765625000000,
360  10548.0820312500000000,
361  11175.3037109375000000,
362  11839.8212890625000000,
363  12543.8535156250000000 };
364 
365 
366 
367 
368 
369 
370 
371 #endif /* defined(__pluginCore_h__) */
Information that includes the message code as well as the message data.
Definition: pluginstructures.h:705
static const char * getShortPluginName()
Definition: plugincore.cpp:499
bool initPluginDescriptors()
setup the plugin description strings, flags and codes; this is ordinarily done through the ASPiKreato...
Definition: plugincore.cpp:460
static int32_t getFourCharCode()
Definition: plugincore.cpp:506
Information package that arrives with each new audio frame; called internally from the buffer process...
Definition: pluginstructures.h:1110
static const char * getAUCocoaViewFactoryName()
Definition: plugincore.cpp:503
bool initPluginPresets()
use this method to add new presets to the list
Definition: plugincore.cpp:446
virtual bool processMIDIEvent(midiEvent &event)
process a MIDI event
Definition: plugincore.cpp:415
virtual bool setVectorJoystickParameters(const VectorJoystickData &vectorJoysickData)
(for future use)
Definition: plugincore.cpp:431
virtual bool processAudioFrame(ProcessFrameInfo &processFrameInfo)
frame-processing method
Definition: plugincore.cpp:152
The PluginBase object is the base class for the Plugin Core object.
Definition: pluginbase.h:221
virtual bool processMessage(MessageInfo &messageInfo)
For Custom View and Custom Sub-Controller Operations.
Definition: plugincore.cpp:355
Information about a paraemeter being updated. Used when bound variables are updated. Multiple advanced uses.
Definition: pluginstructures.h:834
static const char * getPluginName()
Definition: plugincore.cpp:498
Sample rate and bit-depth information that is passed during the reset( ) function.
Definition: pluginstructures.h:180
virtual bool updatePluginParameterNormalized(int32_t controlID, double normalizedValue, ParameterUpdateInfo &paramInfo)
update the PluginParameter's value based on normlaized GUI control, preset, or data smoothing (thread...
Definition: plugincore.cpp:266
bool initPluginParameters()
create all of your plugin parameters here
Definition: plugincore.cpp:60
PluginCore()
PluginCore constructor is launching pad for object initialization.
Definition: plugincore.cpp:25
double unipolarToBipolar(double value)
calculates the bipolar [-1.0, +1.0] value FROM a unipolar [0.0, +1.0] value
Definition: fxobjects.h:240
pluginType
Use this enum to identify the plugin category.
Definition: pluginstructures.h:61
Information package that arrives with each new audio buffer process cycle. Contains everything needed...
Definition: pluginstructures.h:1056
virtual bool updatePluginParameter(int32_t controlID, double controlValue, ParameterUpdateInfo &paramInfo)
update the PluginParameter's value based on GUI control, preset, or data smoothing (thread-safe) ...
Definition: plugincore.cpp:242
Incoming data from a vector joystick.
Definition: pluginstructures.h:276
virtual bool guiParameterChanged(int32_t controlID, double actualValue)
has nothing to do with actual variable or updated variable (binding)
Definition: plugincore.cpp:326
virtual ~PluginCore()
Definition: plugincore.h:51
virtual bool preProcessAudioBuffers(ProcessBufferInfo &processInfo)
do anything needed prior to arrival of audio buffers
Definition: plugincore.cpp:131
virtual bool initialize(PluginInfo &_pluginInfo)
one-time initialize function called after object creation and before the first reset( ) call ...
Definition: plugincore.cpp:110
virtual bool postUpdatePluginParameter(int32_t controlID, double controlValue, ParameterUpdateInfo &paramInfo)
perform any operations after the plugin parameter has been updated; this is one paradigm for transfer...
Definition: plugincore.cpp:290
static const char * getPluginBundleName()
Definition: plugincore.cpp:497
The PluginCore object is the default PluginBase derived object for ASPiK projects. Note that you are fre to change the name of this object (as long as you change it in the compiler settings, etc...)
Definition: plugincore.h:43
static const char * getVendorEmail()
Definition: plugincore.cpp:502
static pluginType getPluginType()
Definition: plugincore.cpp:504
virtual bool postProcessAudioBuffers(ProcessBufferInfo &processInfo)
do anything needed prior to arrival of audio buffers
Definition: plugincore.cpp:220
static const char * getVSTFUID()
Definition: plugincore.cpp:505
Structure that is used during the base class initilize( ) funciton call, after object instantiation i...
Definition: pluginstructures.h:753
static const char * getVendorURL()
Definition: plugincore.cpp:501
virtual bool reset(ResetInfo &resetInfo)
initialize object for a new run of audio; called just before audio streams
Definition: plugincore.cpp:94
static const char * getVendorName()
Definition: plugincore.cpp:500
Information about a MIDI event.
Definition: pluginstructures.h:561