JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
ipluginbase.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2// Project : SDK Core
3//
4// Category : SDK Core Interfaces
5// Filename : pluginterfaces/base/ipluginbase.h
6// Created by : Steinberg, 01/2004
7// Description : Basic Plug-in Interfaces
8//
9//-----------------------------------------------------------------------------
10// This file is part of a Steinberg SDK. It is subject to the license terms
11// in the LICENSE file found in the top-level directory of this distribution
12// and at www.steinberg.net/sdklicenses.
13// No part of the SDK, including this file, may be copied, modified, propagated,
14// or distributed except according to the terms contained in the LICENSE file.
15//-----------------------------------------------------------------------------
16
17#pragma once
18
19#include "funknown.h"
20#include "fstrdefs.h"
21
22namespace Steinberg {
23
24//------------------------------------------------------------------------
36class IPluginBase: public FUnknown
37{
38public:
39//------------------------------------------------------------------------
45 virtual tresult PLUGIN_API initialize (FUnknown* context) = 0;
46
49 virtual tresult PLUGIN_API terminate () = 0;
50
51//------------------------------------------------------------------------
52 static const FUID iid;
53};
54
55DECLARE_CLASS_IID (IPluginBase, 0x22888DDB, 0x156E45AE, 0x8358B348, 0x08190625)
56
57
58//------------------------------------------------------------------------
63{
64//------------------------------------------------------------------------
66 {
68 kNoFlags = 0,
69
73 kClassesDiscardable = 1 << 0,
74
77 kLicenseCheck = 1 << 1,
78
80 kComponentNonDiscardable = 1 << 3,
81
83 kUnicode = 1 << 4
84 };
85
86 enum
87 {
88 kURLSize = 256,
89 kEmailSize = 128,
90 kNameSize = 64
91 };
92
93//------------------------------------------------------------------------
94 char8 vendor[kNameSize];
95 char8 url[kURLSize];
96 char8 email[kEmailSize];
97 int32 flags;
98//------------------------------------------------------------------------
99 SMTG_CONSTEXPR14 PFactoryInfo (const char8* _vendor, const char8* _url, const char8* _email,
100 int32 _flags)
101#if SMTG_CPP14
102 : vendor (), url (), email (), flags ()
103#endif
104 {
105 strncpy8 (vendor, _vendor, kNameSize);
106 strncpy8 (url, _url, kURLSize);
107 strncpy8 (email, _email, kEmailSize);
108 flags = _flags;
109#ifdef UNICODE
110 flags |= kUnicode;
111#endif
112 }
113#if SMTG_CPP11
114 constexpr PFactoryInfo () : vendor (), url (), email (), flags () {}
115#else
116 PFactoryInfo () { memset (this, 0, sizeof (PFactoryInfo)); }
117#endif
118};
119
120//------------------------------------------------------------------------
125{
126//------------------------------------------------------------------------
127 enum ClassCardinality
128 {
129 kManyInstances = 0x7FFFFFFF
130 };
131
132 enum
133 {
134 kCategorySize = 32,
135 kNameSize = 64
136 };
137//------------------------------------------------------------------------
140
143
145 char8 category[kCategorySize];
146
148 char8 name[kNameSize];
149
150//------------------------------------------------------------------------
151
152 SMTG_CONSTEXPR14 PClassInfo (const TUID _cid, int32 _cardinality, const char8* _category,
153 const char8* _name)
154#if SMTG_CPP14
155 : cid (), cardinality (), category (), name ()
156#endif
157 {
158#if SMTG_CPP14
159 copyTUID (cid, _cid);
160#else
161 memset (this, 0, sizeof (PClassInfo));
162 memcpy (cid, _cid, sizeof (TUID));
163#endif
164 if (_category)
165 strncpy8 (category, _category, kCategorySize);
166 if (_name)
167 strncpy8 (name, _name, kNameSize);
168 cardinality = _cardinality;
169 }
170#if SMTG_CPP11
171 constexpr PClassInfo () : cid (), cardinality (), category (), name () {}
172#else
173 PClassInfo () { memset (this, 0, sizeof (PClassInfo)); }
174#endif
175};
176
177//------------------------------------------------------------------------
178// IPluginFactory interface declaration
179//------------------------------------------------------------------------
193{
194public:
195//------------------------------------------------------------------------
197 virtual tresult PLUGIN_API getFactoryInfo (PFactoryInfo* info) = 0;
198
202 virtual int32 PLUGIN_API countClasses () = 0;
203
205 virtual tresult PLUGIN_API getClassInfo (int32 index, PClassInfo* info) = 0;
206
208 virtual tresult PLUGIN_API createInstance (FIDString cid, FIDString _iid, void** obj) = 0;
209
210//------------------------------------------------------------------------
211 static const FUID iid;
212};
213
214DECLARE_CLASS_IID (IPluginFactory, 0x7A4D811C, 0x52114A1F, 0xAED9D2EE, 0x0B43BF9F)
215
216
217//------------------------------------------------------------------------
222{
223//------------------------------------------------------------------------
226
229
231 char8 category[PClassInfo::kCategorySize];
232
234 char8 name[PClassInfo::kNameSize];
235
236 enum {
237 kVendorSize = 64,
238 kVersionSize = 64,
239 kSubCategoriesSize = 128
240 };
241
244
246 char8 subCategories[kSubCategoriesSize];
247
249 char8 vendor[kVendorSize];
250
252 char8 version[kVersionSize];
253
255 char8 sdkVersion[kVersionSize];
256//------------------------------------------------------------------------
257
258 SMTG_CONSTEXPR14 PClassInfo2 (const TUID _cid, int32 _cardinality, const char8* _category,
259 const char8* _name, int32 _classFlags,
260 const char8* _subCategories, const char8* _vendor,
261 const char8* _version, const char8* _sdkVersion)
262#if SMTG_CPP14
263 : cid ()
264 , cardinality ()
265 , category ()
266 , name ()
267 , classFlags ()
268 , subCategories ()
269 , vendor ()
270 , version ()
271 , sdkVersion ()
272#endif
273 {
274#if SMTG_CPP14
275 copyTUID (cid, _cid);
276#else
277 memset (this, 0, sizeof (PClassInfo2));
278 memcpy (cid, _cid, sizeof (TUID));
279#endif
280 cardinality = _cardinality;
281 if (_category)
282 strncpy8 (category, _category, PClassInfo::kCategorySize);
283 if (_name)
284 strncpy8 (name, _name, PClassInfo::kNameSize);
285 classFlags = static_cast<uint32> (_classFlags);
286 if (_subCategories)
287 strncpy8 (subCategories, _subCategories, kSubCategoriesSize);
288 if (_vendor)
289 strncpy8 (vendor, _vendor, kVendorSize);
290 if (_version)
291 strncpy8 (version, _version, kVersionSize);
292 if (_sdkVersion)
293 strncpy8 (sdkVersion, _sdkVersion, kVersionSize);
294 }
295#if SMTG_CPP11
296 constexpr PClassInfo2 ()
297 : cid ()
298 , cardinality ()
299 , category ()
300 , name ()
301 , classFlags ()
302 , subCategories ()
303 , vendor ()
304 , version ()
305 , sdkVersion ()
306 {
307 }
308#else
309 PClassInfo2 () { memset (this, 0, sizeof (PClassInfo2)); }
310#endif
311};
312
313//------------------------------------------------------------------------
314// IPluginFactory2 interface declaration
315//------------------------------------------------------------------------
321{
322public:
323//------------------------------------------------------------------------
325 virtual tresult PLUGIN_API getClassInfo2 (int32 index, PClassInfo2* info) = 0;
326
327//------------------------------------------------------------------------
328 static const FUID iid;
329};
330DECLARE_CLASS_IID (IPluginFactory2, 0x0007B650, 0xF24B4C0B, 0xA464EDB9, 0xF00B2ABB)
331
332
333//------------------------------------------------------------------------
337{
338//------------------------------------------------------------------------
341 char8 category[PClassInfo::kCategorySize];
342 char16 name[PClassInfo::kNameSize];
343
344 enum {
345 kVendorSize = 64,
346 kVersionSize = 64,
347 kSubCategoriesSize = 128
348 };
349
352
354 char8 subCategories[kSubCategoriesSize];
355
357 char16 vendor[kVendorSize];
358
360 char16 version[kVersionSize];
361
363 char16 sdkVersion[kVersionSize];
364
365//------------------------------------------------------------------------
366 SMTG_CONSTEXPR14 PClassInfoW (const TUID _cid, int32 _cardinality, const char8* _category,
367 const char16* _name, int32 _classFlags,
368 const char8* _subCategories, const char16* _vendor,
369 const char16* _version, const char16* _sdkVersion)
370#if SMTG_CPP14
371 : cid ()
372 , cardinality ()
373 , category ()
374 , name ()
375 , classFlags ()
376 , subCategories ()
377 , vendor ()
378 , version ()
379 , sdkVersion ()
380#endif
381 {
382#if SMTG_CPP14
383 copyTUID (cid, _cid);
384#else
385 memset (this, 0, sizeof (PClassInfoW));
386 memcpy (cid, _cid, sizeof (TUID));
387#endif
388 cardinality = _cardinality;
389 if (_category)
390 strncpy8 (category, _category, PClassInfo::kCategorySize);
391 if (_name)
392 strncpy16 (name, _name, PClassInfo::kNameSize);
393 classFlags = static_cast<uint32> (_classFlags);
394 if (_subCategories)
395 strncpy8 (subCategories, _subCategories, kSubCategoriesSize);
396 if (_vendor)
397 strncpy16 (vendor, _vendor, kVendorSize);
398 if (_version)
399 strncpy16 (version, _version, kVersionSize);
400 if (_sdkVersion)
401 strncpy16 (sdkVersion, _sdkVersion, kVersionSize);
402 }
403#if SMTG_CPP11
404 constexpr PClassInfoW ()
405 : cid ()
406 , cardinality ()
407 , category ()
408 , name ()
409 , classFlags ()
410 , subCategories ()
411 , vendor ()
412 , version ()
413 , sdkVersion ()
414 {
415 }
416#else
417 PClassInfoW () { memset (this, 0, sizeof (PClassInfoW)); }
418#endif
419
420 SMTG_CONSTEXPR14 void fromAscii (const PClassInfo2& ci2)
421 {
422#if SMTG_CPP14
423 copyTUID (cid, ci2.cid);
424#else
425 memcpy (cid, ci2.cid, sizeof (TUID));
426#endif
427 cardinality = ci2.cardinality;
428 strncpy8 (category, ci2.category, PClassInfo::kCategorySize);
429 str8ToStr16 (name, ci2.name, PClassInfo::kNameSize);
430 classFlags = ci2.classFlags;
431 strncpy8 (subCategories, ci2.subCategories, kSubCategoriesSize);
432
433 str8ToStr16 (vendor, ci2.vendor, kVendorSize);
434 str8ToStr16 (version, ci2.version, kVersionSize);
435 str8ToStr16 (sdkVersion, ci2.sdkVersion, kVersionSize);
436 }
437};
438
439//------------------------------------------------------------------------
440// IPluginFactory3 interface declaration
441//------------------------------------------------------------------------
447{
448public:
449//------------------------------------------------------------------------
451 virtual tresult PLUGIN_API getClassInfoUnicode (int32 index, PClassInfoW* info) = 0;
452
454 virtual tresult PLUGIN_API setHostContext (FUnknown* context) = 0;
455
456//------------------------------------------------------------------------
457 static const FUID iid;
458};
459DECLARE_CLASS_IID (IPluginFactory3, 0x4555A2AB, 0xC1234E57, 0x9B122910, 0x36878931)
460//------------------------------------------------------------------------
461} // namespace Steinberg
462
463//------------------------------------------------------------------------
464#define LICENCE_UID(l1, l2, l3, l4) \
465{ \
466 (int8)((l1 & 0xFF000000) >> 24), (int8)((l1 & 0x00FF0000) >> 16), \
467 (int8)((l1 & 0x0000FF00) >> 8), (int8)((l1 & 0x000000FF) ), \
468 (int8)((l2 & 0xFF000000) >> 24), (int8)((l2 & 0x00FF0000) >> 16), \
469 (int8)((l2 & 0x0000FF00) >> 8), (int8)((l2 & 0x000000FF) ), \
470 (int8)((l3 & 0xFF000000) >> 24), (int8)((l3 & 0x00FF0000) >> 16), \
471 (int8)((l3 & 0x0000FF00) >> 8), (int8)((l3 & 0x000000FF) ), \
472 (int8)((l4 & 0xFF000000) >> 24), (int8)((l4 & 0x00FF0000) >> 16), \
473 (int8)((l4 & 0x0000FF00) >> 8), (int8)((l4 & 0x000000FF) ) \
474}
475
476//------------------------------------------------------------------------
477// GetPluginFactory
478//------------------------------------------------------------------------
516extern "C"
517{
518 SMTG_EXPORT_SYMBOL Steinberg::IPluginFactory* PLUGIN_API GetPluginFactory ();
519 typedef Steinberg::IPluginFactory* (PLUGIN_API *GetFactoryProc) ();
520}
Handling 16 Byte Globally Unique Identifiers.
Definition funknown.h:241
The basic interface of all interfaces.
Definition funknown.h:375
Basic interface to a plug-in component: IPluginBase.
Definition ipluginbase.h:37
virtual tresult PLUGIN_API terminate()=0
This function is called before the plug-in is unloaded and can be used for cleanups.
virtual tresult PLUGIN_API initialize(FUnknown *context)=0
The host passes a number of interfaces as context to initialize the plug-in class.
Version 2 of class factory supporting PClassInfo2: IPluginFactory2.
virtual tresult PLUGIN_API getClassInfo2(int32 index, PClassInfo2 *info)=0
Returns the class info (version 2) for a given index.
Version 3 of class factory supporting PClassInfoW: IPluginFactory3.
virtual tresult PLUGIN_API getClassInfoUnicode(int32 index, PClassInfoW *info)=0
Returns the unicode class info for a given index.
virtual tresult PLUGIN_API setHostContext(FUnknown *context)=0
Receives information about host.
Class factory that any plug-in defines for creating class instances: IPluginFactory.
virtual tresult PLUGIN_API getClassInfo(int32 index, PClassInfo *info)=0
Fill a PClassInfo structure with information about the class at the specified index.
virtual int32 PLUGIN_API countClasses()=0
Returns the number of exported classes by this factory.
virtual tresult PLUGIN_API getFactoryInfo(PFactoryInfo *info)=0
Fill a PFactoryInfo structure with information about the plug-in vendor.
virtual tresult PLUGIN_API createInstance(FIDString cid, FIDString _iid, void **obj)=0
Create a new class instance.
char TUID[16]
plain UID type
Definition funknown.h:209
SMTG_EXPORT_SYMBOL Steinberg::IPluginFactory *PLUGIN_API GetPluginFactory()
Plug-in entry point.
memcpy
memset
Version 2 of Basic Information about a class provided by the plug-in.
TUID cid
Class ID 16 Byte class GUID.
uint32 classFlags
flags used for a specific category, must be defined where category is defined
int32 cardinality
Cardinality of the class, set to kManyInstances (see PClassInfo::ClassCardinality)
Unicode Version of Basic Information about a class provided by the plug-in.
uint32 classFlags
flags used for a specific category, must be defined where category is defined
TUID cid
see PClassInfo
int32 cardinality
see PClassInfo
Basic Information about a class provided by the plug-in.
int32 cardinality
Cardinality of the class, set to kManyInstances (see PClassInfo::ClassCardinality)
TUID cid
Class ID 16 Byte class GUID.
char8 category[kCategorySize]
Class category, host uses this to categorize interfaces.
char8 name[kNameSize]
Class name, visible to the user.
Basic Information about the class factory of the plug-in.
Definition ipluginbase.h:63
int32 flags
(see FactoryFlags above)
Definition ipluginbase.h:97