forked from skei/vst3_plugin.h
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvst3.h
1217 lines (1044 loc) · 35.7 KB
/
vst3.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#ifndef vst3_included
#define vst3_included
//----------------------------------------------------------------------
// based on (extracted from) steinberg vst3 sdk (gpl3)
//----------
#ifdef __gnu_linux__
//#define VST3_LINUX
#define COM_COMPATIBLE 0
#define PLUGIN_API
#endif
#ifdef _WIN32
//#define VST3_WIN32
#define COM_COMPATIBLE 1
#define PLUGIN_API __stdcal
#endif
//----------
#define strncpy8 strncpy
//----------------------------------------------------------------------
//
//
//
//----------------------------------------------------------------------
#if COM_COMPATIBLE
#define INLINE_UID(l1,l2,l3,l4) { \
(int8_t)((l1 & 0x000000FF) ), (int8_t)((l1 & 0x0000FF00) >> 8), \
(int8_t)((l1 & 0x00FF0000) >> 16), (int8_t)((l1 & 0xFF000000) >> 24), \
(int8_t)((l2 & 0x00FF0000) >> 16), (int8_t)((l2 & 0xFF000000) >> 24), \
(int8_t)((l2 & 0x000000FF) ), (int8_t)((l2 & 0x0000FF00) >> 8), \
(int8_t)((l3 & 0xFF000000) >> 24), (int8_t)((l3 & 0x00FF0000) >> 16), \
(int8_t)((l3 & 0x0000FF00) >> 8), (int8_t)((l3 & 0x000000FF) ), \
(int8_t)((l4 & 0xFF000000) >> 24), (int8_t)((l4 & 0x00FF0000) >> 16), \
(int8_t)((l4 & 0x0000FF00) >> 8), (int8_t)((l4 & 0x000000FF) ) \
}
#else
#define INLINE_UID(l1, l2, l3, l4) { \
(int8_t)((l1 & 0xFF000000) >> 24), (int8_t)((l1 & 0x00FF0000) >> 16), \
(int8_t)((l1 & 0x0000FF00) >> 8), (int8_t)((l1 & 0x000000FF) ), \
(int8_t)((l2 & 0xFF000000) >> 24), (int8_t)((l2 & 0x00FF0000) >> 16), \
(int8_t)((l2 & 0x0000FF00) >> 8), (int8_t)((l2 & 0x000000FF) ), \
(int8_t)((l3 & 0xFF000000) >> 24), (int8_t)((l3 & 0x00FF0000) >> 16), \
(int8_t)((l3 & 0x0000FF00) >> 8), (int8_t)((l3 & 0x000000FF) ), \
(int8_t)((l4 & 0xFF000000) >> 24), (int8_t)((l4 & 0x00FF0000) >> 16), \
(int8_t)((l4 & 0x0000FF00) >> 8), (int8_t)((l4 & 0x000000FF) ) \
}
#endif
//#ifdef INIT_CLASS_IID
// #define DECLARE_CLASS_IID(classname, l1, l2, l3, l4)
// static const vst3_uuid classname##_iid = INLINE_UID (l1,l2,l3,l4);
// const vst3_uuid classname::iid (classname##_iid);
//#else
#define DECLARE_CLASS_IID(classname,l1,l2,l3,l4) \
static const TUID classname##_iid = INLINE_UID(l1,l2,l3,l4);
//----------
//----------------------------------------------------------------------
//
//
//
//----------------------------------------------------------------------
typedef char int8;
typedef short int16;
typedef int int32;
typedef long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
//typedef long int32;
//typedef __int64 int64;
//typedef unsigned long uint32;
//typedef unsigned __int64 uint64;
typedef char char8;
typedef char16_t char16;
typedef unsigned char uchar;
typedef char8 tchar;
//typedef int16 char16;
//typedef __wchar_t char16;
//typedef char16 tchar;
typedef char16 TChar;
typedef TChar String128[128];
typedef int32_t tresult;
typedef const char* FIDString;
typedef uint8_t TBool;
typedef double TQuarterNotes;
typedef int64_t TSamples;
//typedef int8 TUID[16];
typedef char TUID[16];
typedef TUID FUID;
typedef int32_t BusDirection;
typedef int32_t BusType;
typedef const char8* CString;
typedef int16_t CtrlNumber;
typedef int FileDescriptor;
typedef int32_t IoMode;
typedef uint32 KeyswitchTypeID;
typedef int32_t KnobMode;
typedef int32_t MediaType;
typedef double NoteExpressionValue;
typedef uint32 NoteExpressionTypeID;
typedef uint32_t ParamID;
typedef double ParamValue;
typedef int32_t ProgramListID;
typedef float Sample32;
typedef double Sample64;
typedef double SampleRate;
typedef uint64 Speaker;
typedef uint64 SpeakerArrangement;
typedef uint64_t TimerInterval;
typedef int32_t UnitID;
//----------------------------------------------------------------------
//
//
//
//----------------------------------------------------------------------
#ifndef kVstVersionString
#define kVstVersionString "VST 3.6.10" ///< SDK version for PClassInfo2
#endif
#ifndef kVstAudioEffectClass
#define kVstAudioEffectClass "Audio Module Class"
#endif
//----------
#if COM_COMPATIBLE
#ifdef _WIN32
enum {
kNoInterface = static_cast<tresult>(0x80004002L), // E_NOINTERFACE
kResultOk = static_cast<tresult>(0x00000000L), // S_OK
kResultTrue = kResultOk,
kResultFalse = static_cast<tresult>(0x00000001L), // S_FALSE
kInvalidArgument = static_cast<tresult>(0x80070057L), // E_INVALIDARG
kNotImplemented = static_cast<tresult>(0x80004001L), // E_NOTIMPL
kInternalError = static_cast<tresult>(0x80004005L), // E_FAIL
kNotInitialized = static_cast<tresult>(0x8000FFFFL), // E_UNEXPECTED
kOutOfMemory = static_cast<tresult>(0x8007000EL) // E_OUTOFMEMORY
};
#else // _WIN32
enum {
kNoInterface = static_cast<tresult>(0x80000004L), // E_NOINTERFACE
kResultOk = static_cast<tresult>(0x00000000L), // S_OK
kResultTrue = kResultOk,
kResultFalse = static_cast<tresult>(0x00000001L), // S_FALSE
kInvalidArgument = static_cast<tresult>(0x80000003L), // E_INVALIDARG
kNotImplemented = static_cast<tresult>(0x80000001L), // E_NOTIMPL
kInternalError = static_cast<tresult>(0x80000008L), // E_FAIL
kNotInitialized = static_cast<tresult>(0x8000FFFFL), // E_UNEXPECTED
kOutOfMemory = static_cast<tresult>(0x80000002L) // E_OUTOFMEMORY
};
#endif // _WIN32
#else // COM_COMPATIBLE
enum {
kNoInterface = -1,
kResultOk,
kResultTrue = kResultOk,
kResultFalse,
kInvalidArgument,
kNotImplemented,
kInternalError,
kNotInitialized,
kOutOfMemory
};
#endif // COM_COMPATIBLE
//----------------------------------------------------------------------
const char* kEditor = "editor";
const CString kFx = "Fx";
const CString kInstrument = "Instrument";
const FIDString kPlatformTypeHWND = "HWND";
const FIDString kPlatformTypeHIView = "HIView";
const FIDString kPlatformTypeNSView = "NSView";
const FIDString kPlatformTypeUIView = "UIView";
const FIDString kPlatformTypeX11EmbedWindowID = "X11EmbedWindowID";
static const UnitID kNoParentUnitId = -1;
static const ProgramListID kNoProgramListId = -1;
static const uint32 kNoTail = 0;
static const UnitID kRootUnitId = 0;
const Speaker kSpeakerL = 1 << 0;
const Speaker kSpeakerR = 1 << 1;
//----------------------------------------------------------------------
//namespace PlugType {
// const CString kFxAnalyzer = "Fx|Analyzer";
// const CString kFxDelay = "Fx|Delay";
// const CString kFxDistortion = "Fx|Distortion";
// const CString kFxDynamics = "Fx|Dynamics";
// const CString kFxEQ = "Fx|EQ";
// const CString kFxFilter = "Fx|Filter";
// const CString kFx = "Fx";
// const CString kFxInstrument = "Fx|Instrument";
// const CString kFxInstrumentExternal = "Fx|Instrument|External";
// const CString kFxSpatial = "Fx|Spatial";
// const CString kFxGenerator = "Fx|Generator";
// const CString kFxMastering = "Fx|Mastering";
// const CString kFxModulation = "Fx|Modulation";
// const CString kFxPitchShift = "Fx|Pitch Shift";
// const CString kFxRestoration = "Fx|Restoration";
// const CString kFxReverb = "Fx|Reverb";
// const CString kFxSurround = "Fx|Surround";
// const CString kFxTools = "Fx|Tools";
// const CString kFxNetwork = "Fx|Network";
// const CString kInstrument = "Instrument";
// const CString kInstrumentDrum = "Instrument|Drum";
// const CString kInstrumentSampler = "Instrument|Sampler";
// const CString kInstrumentSynth = "Instrument|Synth";
// const CString kInstrumentSynthSampler = "Instrument|Synth|Sampler";
// const CString kInstrumentExternal = "Instrument|External";
// const CString kSpatial = "Spatial";
// const CString kSpatialFx = "Spatial|Fx";
// const CString kOnlyRealTime = "OnlyRT";
// const CString kOnlyOfflineProcess = "OnlyOfflineProcess";
// const CString kNoOfflineProcess = "NoOfflineProcess";
// const CString kUpDownMix = "Up-Downmix";
// const CString kAnalyzer = "Analyzer";
// const CString kAmbisonic = "Ambisonic";
// const CString kMono = "Mono";
// const CString kStereo = "Stereo";
// const CString kSurround = "Surround";
//};
//----------------------------------------------------------------------
//enum NoteExpressionTypeIDs {
// kVolumeTypeID = 0,
// kPanTypeID,
// kTuningTypeID,
// kVibratoTypeID,
// kExpressionTypeID,
// kBrightnessTypeID,
// kTextTypeID,
// kPhonemeTypeID,
// kCustomStart = 100000
//};
//----------
enum BusDirections {
kInput = 0,
kOutput
};
enum BusTypes {
kMain = 0,
kAux
};
enum ControllerNumbers {
kCtrlBankSelectMSB = 0,
kCtrlModWheel = 1,
kCtrlBreath = 2,
kCtrlFoot = 4,
kCtrlPortaTime = 5,
kCtrlDataEntryMSB = 6,
kCtrlVolume = 7,
kCtrlBalance = 8,
kCtrlPan = 10,
kCtrlExpression = 11,
kCtrlEffect1 = 12,
kCtrlEffect2 = 13,
kCtrlGPC1 = 16,
kCtrlGPC2 = 17,
kCtrlGPC3 = 18,
kCtrlGPC4 = 19,
kCtrlBankSelectLSB = 32,
kCtrlDataEntryLSB = 38,
kCtrlSustainOnOff = 64,
kCtrlPortaOnOff = 65,
kCtrlSustenutoOnOff = 66,
kCtrlSoftPedalOnOff = 67,
kCtrlLegatoFootSwOnOff= 68,
kCtrlHold2OnOff = 69,
kCtrlSoundVariation = 70,
kCtrlFilterCutoff = 71,
kCtrlReleaseTime = 72,
kCtrlAttackTime = 73,
kCtrlFilterResonance= 74,
kCtrlDecayTime = 75,
kCtrlVibratoRate = 76,
kCtrlVibratoDepth = 77,
kCtrlVibratoDelay = 78,
kCtrlSoundCtrler10 = 79,
kCtrlGPC5 = 80,
kCtrlGPC6 = 81,
kCtrlGPC7 = 82,
kCtrlGPC8 = 83,
kCtrlPortaControl = 84,
kCtrlEff1Depth = 91,
kCtrlEff2Depth = 92,
kCtrlEff3Depth = 93,
kCtrlEff4Depth = 94,
kCtrlEff5Depth = 95,
kCtrlDataIncrement = 96,
kCtrlDataDecrement = 97,
kCtrlNRPNSelectLSB = 98,
kCtrlNRPNSelectMSB = 99,
kCtrlRPNSelectLSB = 100,
kCtrlRPNSelectMSB = 101,
kCtrlAllSoundsOff = 120,
kCtrlResetAllCtrlers = 121,
kCtrlLocalCtrlOnOff = 122,
kCtrlAllNotesOff = 123,
kCtrlOmniModeOff = 124,
kCtrlOmniModeOn = 125,
kCtrlPolyModeOnOff = 126,
kCtrlPolyModeOn = 127,
kAfterTouch = 128,
kPitchBend,
kCountCtrlNumber
};
enum MediaTypes {
kAudio = 0,
kEvent,
kNumMediaTypes
};
enum SymbolicSampleSizes {
kSample32,
kSample64
};
//----------------------------------------------------------------------
//
//
//
//----------------------------------------------------------------------
class IParameterChanges;
class IEventList;
//----------
struct AudioBusBuffers {
AudioBusBuffers () : numChannels (0), silenceFlags (0), channelBuffers64 (0) {}
int32 numChannels;
uint64 silenceFlags;
union {
Sample32** channelBuffers32;
Sample64** channelBuffers64;
};
};
struct BusInfo {
MediaType mediaType;
BusDirection direction;
int32 channelCount;
String128 name;
BusType busType;
uint32 flags;
enum BusFlags {
kDefaultActive = 1 << 0
};
};
struct Chord {
uint8 keyNote;
uint8 rootNote;
int16 chordMask;
enum Masks {
kChordMask = 0x0FFF,
kReservedMask = 0xF000
};
};
struct FrameRate {
enum FrameRateFlags {
kPullDownRate = 1 << 0,
kDropRate = 1 << 1
};
uint32 framesPerSecond;
uint32 flags;
};
struct KeyswitchInfo {
KeyswitchTypeID typeId;
String128 title;
String128 shortTitle;
int32 keyswitchMin;
int32 keyswitchMax;
int32 keyRemapped;
int32 unitId;
int32 flags;
};
struct ParameterInfo {
ParamID id;
String128 title;
String128 shortTitle;
String128 units;
int32 stepCount;
ParamValue defaultNormalizedValue;
UnitID unitId;
int32 flags;
enum ParameterFlags {
kCanAutomate = 1 << 0,
kIsReadOnly = 1 << 1,
kIsWrapAround = 1 << 2,
kIsList = 1 << 3,
kIsProgramChange = 1 << 15,
kIsBypass = 1 << 16
};
};
struct PClassInfo {
enum ClassCardinality {
kManyInstances = 0x7FFFFFFF
};
enum {
kCategorySize = 32,
kNameSize = 64
};
TUID cid;
int32 cardinality;
char8 category[kCategorySize];
char8 name[kNameSize];
PClassInfo(const TUID _cid, int32 _cardinality, const char8* _category, const char8* _name) {
memset (this, 0, sizeof (PClassInfo));
memcpy (cid, _cid, sizeof (TUID));
if (_category) strncpy8 (category, _category, kCategorySize);
if (_name) strncpy8 (name, _name, kNameSize);
cardinality = _cardinality;
}
//#if SMTG_CPP11
constexpr PClassInfo() : cid(), cardinality(), category(), name() {}
//#else
//PClassInfo () { memset (this, 0, sizeof (PClassInfo)); }
//#endif
};
struct PClassInfo2 {
TUID cid;
int32 cardinality;
char8 category[PClassInfo::kCategorySize];
char8 name[PClassInfo::kNameSize];
enum {
kVendorSize = 64,
kVersionSize = 64,
kSubCategoriesSize = 128
};
uint32 classFlags;
char8 subCategories[kSubCategoriesSize];
char8 vendor[kVendorSize];
char8 version[kVersionSize];
char8 sdkVersion[kVersionSize];
PClassInfo2 (const TUID _cid, int32 _cardinality, const char8* _category, const char8* _name,
int32 _classFlags, const char8* _subCategories, const char8* _vendor, const char8* _version,
const char8* _sdkVersion) {
memset (this, 0, sizeof (PClassInfo2));
memcpy (cid, _cid, sizeof (TUID));
cardinality = _cardinality;
if (_category) strncpy8 (category, _category, PClassInfo::kCategorySize);
if (_name) strncpy8 (name, _name, PClassInfo::kNameSize);
classFlags = static_cast<uint32> (_classFlags);
if (_subCategories) strncpy8 (subCategories, _subCategories, kSubCategoriesSize);
if (_vendor) strncpy8 (vendor, _vendor, kVendorSize);
if (_version) strncpy8 (version, _version, kVersionSize);
if (_sdkVersion) strncpy8 (sdkVersion, _sdkVersion, kVersionSize);
}
//#if SMTG_CPP11
constexpr PClassInfo2 ()
: cid(), cardinality(), category(), name(), classFlags(), subCategories(), vendor(), version(), sdkVersion() {}
//#else
// PClassInfo2 () { memset (this, 0, sizeof (PClassInfo2)); }
//#endif
};
/*
struct PClassInfoW {
TUID cid;
int32 cardinality;
char8 category[PClassInfo::kCategorySize];
char16 name[PClassInfo::kNameSize];
enum { kVendorSize = 64,
kVersionSize = 64,
kSubCategoriesSize = 128
};
uint32 classFlags;
char8 subCategories[kSubCategoriesSize];
char16 vendor[kVendorSize];
char16 version[kVersionSize];
char16 sdkVersion[kVersionSize];
PClassInfoW (const TUID _cid, int32 _cardinality, const char8* _category, const char16* _name,
int32 _classFlags, const char8* _subCategories, const char16* _vendor, const char16* _version,
const char16* _sdkVersion) {
memset (this, 0, sizeof (PClassInfoW));
memcpy (cid, _cid, sizeof (TUID));
cardinality = _cardinality;
if (_category) strncpy8 (category, _category, PClassInfo::kCategorySize);
if (_name) strncpy16 (name, _name, PClassInfo::kNameSize);
classFlags = static_cast<uint32> (_classFlags);
if (_subCategories) strncpy8 (subCategories, _subCategories, kSubCategoriesSize);
if (_vendor) strncpy16 (vendor, _vendor, kVendorSize);
if (_version) strncpy16 (version, _version, kVersionSize);
if (_sdkVersion) strncpy16 (sdkVersion, _sdkVersion, kVersionSize);
}
//#if SMTG_CPP11
constexpr PClassInfoW ()
: cid ()
, cardinality ()
, category ()
, name ()
, classFlags ()
, subCategories ()
, vendor ()
, version ()
, sdkVersion ()
{
}
//#else
// PClassInfoW () { memset (this, 0, sizeof (PClassInfoW)); }
//#endif
void fromAscii (const PClassInfo2& ci2) {
//memcpy (cid, ci2.cid, sizeof (TUID));
//cardinality = ci2.cardinality;
//strncpy8 (category, ci2.category, PClassInfo::kCategorySize);
//str8ToStr16 (name, ci2.name, PClassInfo::kNameSize);
//classFlags = ci2.classFlags;
//strncpy8 (subCategories, ci2.subCategories, kSubCategoriesSize);
//str8ToStr16(vendor, ci2.vendor, kVendorSize);
//str8ToStr16(version, ci2.version, kVersionSize);
//str8ToStr16(sdkVersion, ci2.sdkVersion, kVersionSize);
}
};
*/
struct PClassInfoW {
};
struct PFactoryInfo {
enum FactoryFlags {
kNoFlags = 0,
kClassesDiscardable = 1 << 0,
kLicenseCheck = 1 << 1,
kComponentNonDiscardable = 1 << 3,
kUnicode = 1 << 4
};
enum {
kURLSize = 256,
kEmailSize = 128,
kNameSize = 64
};
char8 vendor[kNameSize];
char8 url[kURLSize];
char8 email[kEmailSize];
int32 flags;
PFactoryInfo (const char8* _vendor, const char8* _url, const char8* _email, int32 _flags) {
strncpy8(vendor, _vendor, kNameSize);
strncpy8(url, _url, kURLSize);
strncpy8(email, _email, kEmailSize);
flags = _flags;
// #ifdef UNICODE
// flags |= kUnicode;
// #endif
}
//#if SMTG_CPP11
constexpr PFactoryInfo() : vendor(), url(), email(), flags() {}
//#else
// PFactoryInfo () { memset(this,0,sizeof(PFactoryInfo)); }
//#endif
};
struct ProgramListInfo {
ProgramListID id;
String128 name;
int32 programCount;
};
struct ProcessContext {
enum StatesAndFlags {
kPlaying = 1 << 1,
kCycleActive = 1 << 2,
kRecording = 1 << 3,
kSystemTimeValid = 1 << 8,
kContTimeValid = 1 << 17,
kProjectTimeMusicValid = 1 << 9,
kBarPositionValid = 1 << 11,
kCycleValid = 1 << 12,
kTempoValid = 1 << 10,
kTimeSigValid = 1 << 13,
kChordValid = 1 << 18,
kSmpteValid = 1 << 14,
kClockValid = 1 << 15
};
uint32 state;
double sampleRate;
TSamples projectTimeSamples;
int64 systemTime;
TSamples continousTimeSamples;
TQuarterNotes projectTimeMusic;
TQuarterNotes barPositionMusic;
TQuarterNotes cycleStartMusic;
TQuarterNotes cycleEndMusic;
double tempo;
int32 timeSigNumerator;
int32 timeSigDenominator;
Chord chord;
int32 smpteOffsetSubframes;
FrameRate frameRate;
int32 samplesToNextClock;
};
struct ProcessData {
ProcessData ()
: processMode (0), symbolicSampleSize (kSample32), numSamples (0), numInputs (0)
, numOutputs (0), inputs (0), outputs (0), inputParameterChanges (0), outputParameterChanges (0)
, inputEvents (0), outputEvents (0), processContext (0) {}
int32 processMode;
int32 symbolicSampleSize;
int32 numSamples;
int32 numInputs;
int32 numOutputs;
AudioBusBuffers* inputs;
AudioBusBuffers* outputs;
IParameterChanges* inputParameterChanges;
IParameterChanges* outputParameterChanges;
IEventList* inputEvents;
IEventList* outputEvents;
ProcessContext* processContext;
};
struct ProcessSetup {
int32 processMode;
int32 symbolicSampleSize;
int32 maxSamplesPerBlock;
SampleRate sampleRate;
};
struct RoutingInfo {
MediaType mediaType;
int32 busIndex;
int32 channel;
};
struct UnitInfo {
UnitID id;
UnitID parentUnitId;
String128 name;
ProgramListID programListId;
};
struct ViewRect {
//ViewRect(int32 l=0, int32 t=0, int32 r=0, int32 b=0)
//: left(l), top(t), right(r), bottom(b) {}
int32 left;
int32 top;
int32 right;
int32 bottom;
//int32 getWidth() const { return right - left; }
//int32 getHeight() const { return bottom - top; }
};
//----------------------------------------------------------------------
struct NoteOnEvent {
int16 channel;
int16 pitch;
float tuning;
float velocity;
int32 length;
int32 noteId;
};
struct NoteOffEvent {
int16 channel;
int16 pitch;
float velocity;
int32 noteId;
float tuning;
};
struct DataEvent {
uint32 size;
uint32 type;
const uint8* bytes;
enum DataTypes {
kMidiSysEx = 0
};
};
struct PolyPressureEvent {
int16 channel;
int16 pitch;
float pressure;
int32 noteId;
};
struct ChordEvent {
int16 root;
int16 bassNote;
int16 mask;
uint16 textLen;
const TChar* text;
};
struct ScaleEvent {
int16 root;
int16 mask;
uint16 textLen;
const TChar* text;
};
struct NoteExpressionValueEvent {
NoteExpressionTypeID typeId;
int32 noteId;
NoteExpressionValue value;
};
struct NoteExpressionTextEvent {
NoteExpressionTypeID typeId;
int32 noteId;
uint32 textLen;
const TChar* text;
};
struct Event {
int32 busIndex;
int32 sampleOffset;
TQuarterNotes ppqPosition;
uint16 flags;
enum EventFlags {
kIsLive = 1 << 0,
kUserReserved1 = 1 << 14,
kUserReserved2 = 1 << 15
};
enum EventTypes
{
kNoteOnEvent = 0,
kNoteOffEvent,
kDataEvent,
kPolyPressureEvent,
kNoteExpressionValueEvent,
kNoteExpressionTextEvent,
kChordEvent,
kScaleEvent
};
uint16 type;
union {
NoteOnEvent noteOn;
NoteOffEvent noteOff;
DataEvent data;
PolyPressureEvent polyPressure;
NoteExpressionValueEvent noteExpressionValue;
NoteExpressionTextEvent noteExpressionText;
ChordEvent chord;
ScaleEvent scale;
};
};
//----------------------------------------------------------------------
//
// utils
//
//----------------------------------------------------------------------
//#define char_to_utf16(C,U) UString128(C).copyTo(U,128)
//#define utf16_to_char(U,C) UString128(U).toAscii(C,128)
void char_to_utf16(const void* C, void* U) {
}
//----------
void utf16_to_char(const void* U, void* C) {
}
//
bool iidEqual(const void* iid1, const void* iid2) {
return false;
}
//----------------------------------------------------------------------
//
//
//
//----------------------------------------------------------------------
class FUnknown {
public:
virtual tresult PLUGIN_API queryInterface (const TUID _iid, void** obj) = 0;
virtual uint32_t PLUGIN_API addRef () = 0;
virtual uint32_t PLUGIN_API release () = 0;
static const TUID iid;
};
DECLARE_CLASS_IID(FUnknown, 0x00000000, 0x00000000, 0xC0000000, 0x00000046)
//----------
class IBStream
: public FUnknown {
public:
enum IStreamSeekMode {
kIBSeekSet = 0,
kIBSeekCur,
kIBSeekEnd
};
virtual tresult PLUGIN_API read(void* buffer, int32_t numBytes, int32_t* numBytesRead = 0) = 0;
virtual tresult PLUGIN_API write(void* buffer, int32_t numBytes, int32_t* numBytesWritten = 0) = 0;
virtual tresult PLUGIN_API seek(int64_t pos, int32_t mode, int64_t* result = 0) = 0;
virtual tresult PLUGIN_API tell(int64_t* pos) = 0;
static const TUID iid;
};
DECLARE_CLASS_IID(IBStream,0xC3BF6EA2,0x30994752,0x9B6BF990,0x1EE33E9B)
//----------
class IPluginFactory
: public FUnknown {
public:
virtual tresult PLUGIN_API getFactoryInfo(PFactoryInfo* info) = 0;
virtual int32_t PLUGIN_API countClasses() = 0;
virtual tresult PLUGIN_API getClassInfo (int32_t index, PClassInfo* info) = 0;
virtual tresult PLUGIN_API createInstance(FIDString cid, FIDString _iid, void** obj) = 0;
static const TUID iid;
};
DECLARE_CLASS_IID(IPluginFactory, 0x7A4D811C, 0x52114A1F, 0xAED9D2EE, 0x0B43BF9F)
//----------
class IPluginFactory2
: public IPluginFactory {
public:
virtual tresult PLUGIN_API getClassInfo2 (int32 index, PClassInfo2* info) = 0;
static const FUID iid;
};
DECLARE_CLASS_IID (IPluginFactory2, 0x0007B650, 0xF24B4C0B, 0xA464EDB9, 0xF00B2ABB)
//----------
class IPluginFactory3
: public IPluginFactory2 {
public:
virtual tresult PLUGIN_API getClassInfoUnicode (int32 index, PClassInfoW* info) = 0;
virtual tresult PLUGIN_API setHostContext (FUnknown* context) = 0;
static const FUID iid;
};
DECLARE_CLASS_IID (IPluginFactory3, 0x4555A2AB, 0xC1234E57, 0x9B122910, 0x36878931)
//----------
class IPluginBase
: public FUnknown {
public:
virtual tresult PLUGIN_API initialize(FUnknown* context) = 0;
virtual tresult PLUGIN_API terminate() = 0;
static const TUID iid;
};
DECLARE_CLASS_IID(IPluginBase,0x22888DDB,0x156E45AE,0x8358B348,0x08190625)
//----------
class IComponent
: public IPluginBase {
public:
virtual tresult PLUGIN_API getControllerClassId(TUID classId) = 0;
virtual tresult PLUGIN_API setIoMode(IoMode mode) = 0;
virtual int32_t PLUGIN_API getBusCount(MediaType type, BusDirection dir) = 0;
virtual tresult PLUGIN_API getBusInfo(MediaType type, BusDirection dir, int32_t index, BusInfo& bus) = 0;
virtual tresult PLUGIN_API getRoutingInfo(RoutingInfo& inInfo, RoutingInfo& outInfo) = 0;
virtual tresult PLUGIN_API activateBus(MediaType type, BusDirection dir, int32_t index, TBool state) = 0;
virtual tresult PLUGIN_API setActive(TBool state) = 0;
virtual tresult PLUGIN_API setState(IBStream* state) = 0;
virtual tresult PLUGIN_API getState(IBStream* state) = 0;
static const TUID iid;
};
DECLARE_CLASS_IID(IComponent,0xE831FF31,0xF2D54301,0x928EBBEE,0x25697802)
//----------
class IAudioProcessor
: public FUnknown {
public:
virtual tresult PLUGIN_API setBusArrangements(SpeakerArrangement* inputs, int32_t numIns, SpeakerArrangement* outputs, int32_t numOuts) = 0;
virtual tresult PLUGIN_API getBusArrangement(BusDirection dir, int32_t index, SpeakerArrangement& arr) = 0;
virtual tresult PLUGIN_API canProcessSampleSize(int32_t symbolicSampleSize) = 0;
virtual uint32_t PLUGIN_API getLatencySamples() = 0;
virtual tresult PLUGIN_API setupProcessing(ProcessSetup& setup) = 0;
virtual tresult PLUGIN_API setProcessing(TBool state) = 0;
virtual tresult PLUGIN_API process(ProcessData& data) = 0;
virtual uint32_t PLUGIN_API getTailSamples() = 0;
static const TUID iid;
};
DECLARE_CLASS_IID(IAudioProcessor,0x42043F99,0xB7DA453C,0xA569E79D,0x9AAEC33D)
//----------
class IUnitInfo
: public FUnknown {
public:
virtual int32 PLUGIN_API getUnitCount() = 0;
virtual tresult PLUGIN_API getUnitInfo(int32 unitIndex, UnitInfo& info /*out*/) = 0;
virtual int32 PLUGIN_API getProgramListCount() = 0;
virtual tresult PLUGIN_API getProgramListInfo(int32 listIndex, ProgramListInfo& info /*out*/) = 0;
virtual tresult PLUGIN_API getProgramName(ProgramListID listId, int32 programIndex, String128 name /*out*/) = 0;
virtual tresult PLUGIN_API getProgramInfo(ProgramListID listId, int32 programIndex, CString attributeId /*in*/, String128 attributeValue /*out*/) = 0;
virtual tresult PLUGIN_API hasProgramPitchNames(ProgramListID listId, int32 programIndex) = 0;
virtual tresult PLUGIN_API getProgramPitchName(ProgramListID listId, int32 programIndex, int16 midiPitch, String128 name /*out*/) = 0;
virtual UnitID PLUGIN_API getSelectedUnit() = 0;
virtual tresult PLUGIN_API selectUnit(UnitID unitId) = 0;
virtual tresult PLUGIN_API getUnitByBus(MediaType type, BusDirection dir, int32 busIndex, int32 channel, UnitID& unitId /*out*/) = 0;
virtual tresult PLUGIN_API setUnitProgramData(int32 listOrUnitId, int32 programIndex, IBStream* data) = 0;
static const FUID iid;
};
DECLARE_CLASS_IID (IUnitInfo, 0x3D4BD6B5, 0x913A4FD2, 0xA886E768, 0xA5EB92C1)
//----------
class IAttributeList
: public FUnknown {
public:
typedef const char* AttrID;
virtual tresult PLUGIN_API setInt(AttrID id, int64 value) = 0;
virtual tresult PLUGIN_API getInt(AttrID id, int64& value) = 0;
virtual tresult PLUGIN_API setFloat(AttrID id, double value) = 0;
virtual tresult PLUGIN_API getFloat(AttrID id, double& value) = 0;
virtual tresult PLUGIN_API setString(AttrID id, const TChar* string) = 0;
virtual tresult PLUGIN_API getString(AttrID id, TChar* string, uint32 size) = 0;
virtual tresult PLUGIN_API setBinary(AttrID id, const void* data, uint32 size) = 0;
virtual tresult PLUGIN_API getBinary(AttrID id, const void*& data, uint32& size) = 0;
static const FUID iid;
};
DECLARE_CLASS_IID (IAttributeList, 0x1E5F0AEB, 0xCC7F4533, 0xA2544011, 0x38AD5EE4)
//----------
class IMessage
: public FUnknown {
public:
virtual FIDString PLUGIN_API getMessageID () = 0;
virtual void PLUGIN_API setMessageID (FIDString id /*in*/) = 0;
virtual IAttributeList* PLUGIN_API getAttributes () = 0;
static const FUID iid;
};
DECLARE_CLASS_IID (IMessage, 0x936F033B, 0xC6C047DB, 0xBB0882F8, 0x13C1E613)
//----------
class IConnectionPoint
: public FUnknown {
public:
virtual tresult PLUGIN_API connect (IConnectionPoint* other) = 0;
virtual tresult PLUGIN_API disconnect (IConnectionPoint* other) = 0;
virtual tresult PLUGIN_API notify (IMessage* message) = 0;
static const FUID iid;
};
DECLARE_CLASS_IID (IConnectionPoint, 0x70A4156F, 0x6E6E4026, 0x989148BF, 0xAA60D8D1)
//----------
class IMidiMapping
: public FUnknown {
public:
virtual tresult PLUGIN_API getMidiControllerAssignment (int32 busIndex, int16 channel, CtrlNumber midiControllerNumber, ParamID& id/*out*/) = 0;
static const FUID iid;
};