19 #ifndef _ardour_vst3_host_h_
20 #define _ardour_vst3_host_h_
32 #include "vst3/vst3.h"
34 #define QUERY_INTERFACE_IMPL(Interface) \
35 tresult PLUGIN_API queryInterface (const TUID _iid, void** obj) SMTG_OVERRIDE \
37 QUERY_INTERFACE (_iid, obj, FUnknown::iid, Interface) \
38 QUERY_INTERFACE (_iid, obj, Interface::iid, Interface) \
40 return kNoInterface; \
43 #if defined(__clang__)
44 # pragma clang diagnostic push
45 # pragma clang diagnostic ignored "-Wnon-virtual-dtor"
46 # pragma clang diagnostic ignored "-Wdelete-non-virtual-dtor"
47 # pragma clang diagnostic ignored "-Wdelete-non-abstract-non-virtual-dtor"
48 #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
49 # pragma GCC diagnostic push
50 # pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
51 # pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor"
97 memcpy (
v.
stringValue, value, _size * sizeof (Vst::TChar));
153 uint32 PLUGIN_API
addRef () SMTG_OVERRIDE;
157 std::atomic<
int> _cnt;
168 uint32 PLUGIN_API
addRef () SMTG_OVERRIDE
178 tresult PLUGIN_API
setInt (AttrID aid, int64 value) SMTG_OVERRIDE;
179 tresult PLUGIN_API
getInt (AttrID aid, int64& value) SMTG_OVERRIDE;
180 tresult PLUGIN_API
setFloat (AttrID aid,
double value) SMTG_OVERRIDE;
181 tresult PLUGIN_API
getFloat (AttrID aid,
double& value) SMTG_OVERRIDE;
182 tresult PLUGIN_API
setString (AttrID aid,
const Vst::TChar*
string) SMTG_OVERRIDE;
183 tresult PLUGIN_API
getString (AttrID aid, Vst::TChar*
string, uint32 size) SMTG_OVERRIDE;
184 tresult PLUGIN_API
setBinary (AttrID aid,
const void* data, uint32 size) SMTG_OVERRIDE;
185 tresult PLUGIN_API
getBinary (AttrID aid,
const void*& data, uint32& size) SMTG_OVERRIDE;
190 std::map<std::string, HostAttribute*>
list;
201 uint32 PLUGIN_API
addRef () SMTG_OVERRIDE
212 void PLUGIN_API setMessageID (const
char* messageID) SMTG_OVERRIDE;
213 Vst::IAttributeList* PLUGIN_API getAttributes () SMTG_OVERRIDE;
228 uint32 PLUGIN_API addRef () SMTG_OVERRIDE
239 tresult PLUGIN_API
connect (Vst::IConnectionPoint*) SMTG_OVERRIDE;
240 tresult PLUGIN_API
disconnect (Vst::IConnectionPoint*) SMTG_OVERRIDE;
241 tresult PLUGIN_API
notify (Vst::IMessage*) SMTG_OVERRIDE;
256 uint32 PLUGIN_API
addRef () SMTG_OVERRIDE
287 uint32 PLUGIN_API
addRef () SMTG_OVERRIDE
298 tresult PLUGIN_API
createInstance (TUID cid, TUID _iid,
void** obj) SMTG_OVERRIDE;
304 class LIBARDOUR_LOCAL Vst3ParamValueQueue :
public Vst::IParamValueQueue
309 uint32 PLUGIN_API addRef () SMTG_OVERRIDE
314 uint32 PLUGIN_API
release () SMTG_OVERRIDE
319 static const int maxNumPoints = 64;
321 Vst3ParamValueQueue ()
323 _values.reserve (maxNumPoints);
324 _id = Vst::kNoParamId;
327 Vst::ParamID PLUGIN_API getParameterId () SMTG_OVERRIDE
332 void setParameterId (Vst::ParamID
id)
338 int32 PLUGIN_API getPointCount () SMTG_OVERRIDE
340 return _values.size ();
343 tresult PLUGIN_API getPoint (int32 index, int32&, Vst::ParamValue&) SMTG_OVERRIDE;
344 tresult PLUGIN_API addPoint (int32, Vst::ParamValue, int32&) SMTG_OVERRIDE;
348 Value (Vst::ParamValue v, int32 offset)
350 , sampleOffset (offset)
353 Vst::ParamValue value;
357 std::vector<Value> _values;
361 class LIBARDOUR_LOCAL Vst3ParameterChanges :
public Vst::IParameterChanges
366 uint32 PLUGIN_API addRef () SMTG_OVERRIDE
371 uint32 PLUGIN_API
release () SMTG_OVERRIDE
376 Vst3ParameterChanges ()
381 void set_n_params (
int n)
388 _used_queue_count = 0;
391 int32 PLUGIN_API getParameterCount () SMTG_OVERRIDE
393 return _used_queue_count;
396 Vst::IParamValueQueue* PLUGIN_API getParameterData (int32 index) SMTG_OVERRIDE;
397 Vst::IParamValueQueue* PLUGIN_API addParameterData (Vst::ParamID
const&
id, int32& index) SMTG_OVERRIDE;
400 std::vector<Vst3ParamValueQueue> _queue;
401 int _used_queue_count;
409 _events.reserve (128);
414 uint32 PLUGIN_API addRef () SMTG_OVERRIDE
419 uint32 PLUGIN_API
release () SMTG_OVERRIDE
424 int32 PLUGIN_API PLUGIN_API getEventCount () SMTG_OVERRIDE
426 return _events.size ();
429 tresult PLUGIN_API getEvent (int32 index, Vst::Event& e) SMTG_OVERRIDE
431 if (index >= 0 && index < (int32)_events.size ()) {
439 tresult PLUGIN_API addEvent (Vst::Event& e) SMTG_OVERRIDE
441 _events.push_back (e);
451 std::vector<Vst::Event> _events;
454 class LIBARDOUR_LOCAL RAMStream :
public IBStream,
public ISizeableStream,
public Vst::IStreamAttributes
458 RAMStream (uint8_t* data,
size_t size);
459 RAMStream (std::string
const& fn);
461 virtual ~RAMStream ();
463 tresult PLUGIN_API queryInterface (
const TUID _iid,
void** obj) SMTG_OVERRIDE;
465 uint32 PLUGIN_API addRef () SMTG_OVERRIDE
470 uint32 PLUGIN_API
release () SMTG_OVERRIDE
476 tresult PLUGIN_API read (
void* buffer, int32 numBytes, int32* numBytesRead) SMTG_OVERRIDE;
477 tresult PLUGIN_API write (
void* buffer, int32 numBytes, int32* numBytesWritten) SMTG_OVERRIDE;
478 tresult PLUGIN_API seek (int64 pos, int32 mode, int64* result) SMTG_OVERRIDE;
479 tresult PLUGIN_API tell (int64* pos) SMTG_OVERRIDE;
482 tresult PLUGIN_API getStreamSize (int64&) SMTG_OVERRIDE;
483 tresult PLUGIN_API setStreamSize (int64) SMTG_OVERRIDE;
486 tresult PLUGIN_API getFileName (Vst::String128
name) SMTG_OVERRIDE;
487 Vst::IAttributeList* PLUGIN_API getAttributes () SMTG_OVERRIDE;
495 bool readonly ()
const
500 bool write_int32 (int32 i);
501 bool write_int64 (int64 i);
503 bool write_TUID (
const TUID& tuid);
505 bool read_int32 (int32& i);
506 bool read_int64 (int64& i);
508 bool read_TUID (TUID& tuid);
511 uint8_t
const* data ()
const
522 void hexdump (int64 max_len = 64)
const;
526 bool reallocate_buffer (int64 size,
bool exact);
528 template <
typename T>
532 read ((
void*)&t,
sizeof (T), &n_read);
533 return n_read ==
sizeof (T);
536 template <
typename T>
537 bool write_pod (
const T& t)
540 write (
const_cast<void*
> ((
const void*)&t),
sizeof (T), &written);
541 return written ==
sizeof (T);
550 HostAttributeList attribute_list;
556 ROMStream (IBStream& src, TSize offset, TSize size);
557 virtual ~ROMStream ();
559 tresult PLUGIN_API queryInterface (
const TUID _iid,
void** obj) SMTG_OVERRIDE;
561 uint32 PLUGIN_API addRef () SMTG_OVERRIDE
566 uint32 PLUGIN_API
release () SMTG_OVERRIDE
572 tresult PLUGIN_API read (
void* buffer, int32 numBytes, int32* numBytesRead) SMTG_OVERRIDE;
573 tresult PLUGIN_API write (
void* buffer, int32 numBytes, int32* numBytesWritten) SMTG_OVERRIDE;
574 tresult PLUGIN_API seek (int64 pos, int32 mode, int64* result) SMTG_OVERRIDE;
575 tresult PLUGIN_API tell (int64* pos) SMTG_OVERRIDE;
589 #if defined(__clang__)
590 #pragma clang diagnostic pop
591 #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
592 #pragma GCC diagnostic pop
~ConnectionProxy() SMTG_OVERRIDE
tresult PLUGIN_API notify(Vst::IMessage *) SMTG_OVERRIDE
tresult PLUGIN_API disconnect(Vst::IConnectionPoint *) SMTG_OVERRIDE
uint32 PLUGIN_API release() SMTG_OVERRIDE
tresult PLUGIN_API connect(Vst::IConnectionPoint *) SMTG_OVERRIDE
ConnectionProxy(IConnectionPoint *src)
tresult PLUGIN_API queryInterface(const TUID _iid, void **obj) SMTG_OVERRIDE
std::unique_ptr< PlugInterfaceSupport > _plug_interface_support
uint32 PLUGIN_API addRef() SMTG_OVERRIDE
tresult PLUGIN_API createInstance(TUID cid, TUID _iid, void **obj) SMTG_OVERRIDE
static Vst::IHostApplication * getHostContext()
virtual ~HostApplication()
tresult PLUGIN_API getName(Vst::String128 name) SMTG_OVERRIDE
uint32 PLUGIN_API release() SMTG_OVERRIDE
tresult PLUGIN_API setBinary(AttrID aid, const void *data, uint32 size) SMTG_OVERRIDE
virtual ~HostAttributeList()
tresult PLUGIN_API getBinary(AttrID aid, const void *&data, uint32 &size) SMTG_OVERRIDE
std::map< std::string, HostAttribute * > list
uint32 PLUGIN_API release() SMTG_OVERRIDE
tresult PLUGIN_API setString(AttrID aid, const Vst::TChar *string) SMTG_OVERRIDE
tresult PLUGIN_API setInt(AttrID aid, int64 value) SMTG_OVERRIDE
uint32 PLUGIN_API addRef() SMTG_OVERRIDE
void removeAttrID(AttrID aid)
tresult PLUGIN_API getFloat(AttrID aid, double &value) SMTG_OVERRIDE
tresult PLUGIN_API setFloat(AttrID aid, double value) SMTG_OVERRIDE
tresult PLUGIN_API getInt(AttrID aid, int64 &value) SMTG_OVERRIDE
tresult PLUGIN_API getString(AttrID aid, Vst::TChar *string, uint32 size) SMTG_OVERRIDE
double floatValue() const
HostAttribute(const void *value, uint32 size)
HostAttribute(int64 value)
const Vst::TChar * stringValue(uint32 &stringSize)
const void * binaryValue(uint32 &binarySize)
HostAttribute(HostAttribute const &other)
HostAttribute(const Vst::TChar *value, uint32 size)
HostAttribute(double value)
uint32 PLUGIN_API release() SMTG_OVERRIDE
const char *PLUGIN_API getMessageID() SMTG_OVERRIDE
uint32 PLUGIN_API addRef() SMTG_OVERRIDE
uint32 PLUGIN_API addRef() SMTG_OVERRIDE
uint32 PLUGIN_API release() SMTG_OVERRIDE
void addPlugInterfaceSupported(const TUID)
std::vector< FUID > _interfaces
tresult PLUGIN_API isPlugInterfaceSupported(const TUID) SMTG_OVERRIDE
uint32 PLUGIN_API release() SMTG_OVERRIDE
uint32 PLUGIN_API addRef() SMTG_OVERRIDE
GtkImageIconNameData name
static const int32 kClassIDSize
static const int32 kListOffsetPos
static const int32 kHeaderSize
std::string tchar_to_utf8(Vst::TChar const *s)
bool utf8_to_tchar(Vst::TChar *rv, const char *s, size_t l=0)
#define QUERY_INTERFACE_IMPL(Interface)