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"
102 memcpy (
v.
stringValue, value, _size * sizeof (Vst::TChar));
158 uint32 PLUGIN_API
addRef () SMTG_OVERRIDE;
162 std::atomic<
int> _cnt;
173 uint32 PLUGIN_API
addRef () SMTG_OVERRIDE
183 tresult PLUGIN_API
setInt (AttrID aid, int64 value) SMTG_OVERRIDE;
184 tresult PLUGIN_API
getInt (AttrID aid, int64& value) SMTG_OVERRIDE;
185 tresult PLUGIN_API
setFloat (AttrID aid,
double value) SMTG_OVERRIDE;
186 tresult PLUGIN_API
getFloat (AttrID aid,
double& value) SMTG_OVERRIDE;
187 tresult PLUGIN_API
setString (AttrID aid,
const Vst::TChar*
string) SMTG_OVERRIDE;
188 tresult PLUGIN_API
getString (AttrID aid, Vst::TChar*
string, uint32 size) SMTG_OVERRIDE;
189 tresult PLUGIN_API
setBinary (AttrID aid,
const void* data, uint32 size) SMTG_OVERRIDE;
190 tresult PLUGIN_API
getBinary (AttrID aid,
const void*& data, uint32& size) SMTG_OVERRIDE;
195 std::map<std::string, HostAttribute*>
list;
206 uint32 PLUGIN_API
addRef () SMTG_OVERRIDE
217 void PLUGIN_API setMessageID (const
char* messageID) SMTG_OVERRIDE;
218 Vst::IAttributeList* PLUGIN_API getAttributes () SMTG_OVERRIDE;
233 uint32 PLUGIN_API addRef () SMTG_OVERRIDE
244 tresult PLUGIN_API
connect (Vst::IConnectionPoint*) SMTG_OVERRIDE;
245 tresult PLUGIN_API
disconnect (Vst::IConnectionPoint*) SMTG_OVERRIDE;
246 tresult PLUGIN_API
notify (Vst::IMessage*) SMTG_OVERRIDE;
261 uint32 PLUGIN_API
addRef () SMTG_OVERRIDE
295 uint32 PLUGIN_API
addRef () SMTG_OVERRIDE
306 tresult PLUGIN_API
createInstance (TUID cid, TUID _iid,
void** obj) SMTG_OVERRIDE;
321 class LIBARDOUR_LOCAL Vst3ParamValueQueue :
public Vst::IParamValueQueue
326 uint32 PLUGIN_API addRef () SMTG_OVERRIDE
331 uint32 PLUGIN_API
release () SMTG_OVERRIDE
336 static const int maxNumPoints = 64;
338 Vst3ParamValueQueue ()
340 _values.reserve (maxNumPoints);
341 _id = Vst::kNoParamId;
344 Vst::ParamID PLUGIN_API getParameterId () SMTG_OVERRIDE
349 void setParameterId (Vst::ParamID
id)
355 int32 PLUGIN_API getPointCount () SMTG_OVERRIDE
357 return _values.size ();
360 tresult PLUGIN_API getPoint (int32 index, int32&, Vst::ParamValue&) SMTG_OVERRIDE;
361 tresult PLUGIN_API addPoint (int32, Vst::ParamValue, int32&) SMTG_OVERRIDE;
365 Value (Vst::ParamValue v, int32 offset)
367 , sampleOffset (offset)
370 Vst::ParamValue value;
374 std::vector<Value> _values;
378 class LIBARDOUR_LOCAL Vst3ParameterChanges :
public Vst::IParameterChanges
383 uint32 PLUGIN_API addRef () SMTG_OVERRIDE
388 uint32 PLUGIN_API
release () SMTG_OVERRIDE
393 Vst3ParameterChanges ()
398 void set_n_params (
int n)
405 _used_queue_count = 0;
408 int32 PLUGIN_API getParameterCount () SMTG_OVERRIDE
410 return _used_queue_count;
413 Vst::IParamValueQueue* PLUGIN_API getParameterData (int32 index) SMTG_OVERRIDE;
414 Vst::IParamValueQueue* PLUGIN_API addParameterData (Vst::ParamID
const&
id, int32& index) SMTG_OVERRIDE;
417 std::vector<Vst3ParamValueQueue> _queue;
418 int _used_queue_count;
426 _events.reserve (128);
431 uint32 PLUGIN_API addRef () SMTG_OVERRIDE
436 uint32 PLUGIN_API
release () SMTG_OVERRIDE
441 int32 PLUGIN_API PLUGIN_API getEventCount () SMTG_OVERRIDE
443 return _events.size ();
446 tresult PLUGIN_API getEvent (int32 index, Vst::Event& e) SMTG_OVERRIDE
448 if (index >= 0 && index < (int32)_events.size ()) {
456 tresult PLUGIN_API addEvent (Vst::Event& e) SMTG_OVERRIDE
458 _events.push_back (e);
468 std::vector<Vst::Event> _events;
471 class LIBARDOUR_LOCAL RAMStream :
public IBStream,
public ISizeableStream,
public Vst::IStreamAttributes
475 RAMStream (uint8_t* data,
size_t size);
476 RAMStream (std::string
const& fn);
478 virtual ~RAMStream ();
480 tresult PLUGIN_API queryInterface (
const TUID _iid,
void** obj) SMTG_OVERRIDE;
482 uint32 PLUGIN_API addRef () SMTG_OVERRIDE
487 uint32 PLUGIN_API
release () SMTG_OVERRIDE
493 tresult PLUGIN_API read (
void* buffer, int32 numBytes, int32* numBytesRead) SMTG_OVERRIDE;
494 tresult PLUGIN_API write (
void* buffer, int32 numBytes, int32* numBytesWritten) SMTG_OVERRIDE;
495 tresult PLUGIN_API seek (int64 pos, int32 mode, int64* result) SMTG_OVERRIDE;
496 tresult PLUGIN_API tell (int64* pos) SMTG_OVERRIDE;
499 tresult PLUGIN_API getStreamSize (int64&) SMTG_OVERRIDE;
500 tresult PLUGIN_API setStreamSize (int64) SMTG_OVERRIDE;
503 tresult PLUGIN_API getFileName (Vst::String128
name) SMTG_OVERRIDE;
504 Vst::IAttributeList* PLUGIN_API getAttributes () SMTG_OVERRIDE;
512 bool readonly ()
const
517 bool write_int32 (int32 i);
518 bool write_int64 (int64 i);
520 bool write_TUID (
const TUID& tuid);
522 bool read_int32 (int32& i);
523 bool read_int64 (int64& i);
525 bool read_TUID (TUID& tuid);
528 uint8_t
const* data ()
const
539 void hexdump (int64 max_len = 64)
const;
543 bool reallocate_buffer (int64 size,
bool exact);
545 template <
typename T>
549 read ((
void*)&t,
sizeof (T), &n_read);
550 return n_read ==
sizeof (T);
553 template <
typename T>
554 bool write_pod (
const T& t)
557 write (
const_cast<void*
> ((
const void*)&t),
sizeof (T), &written);
558 return written ==
sizeof (T);
567 HostAttributeList attribute_list;
573 ROMStream (IBStream& src, TSize offset, TSize size);
574 virtual ~ROMStream ();
576 tresult PLUGIN_API queryInterface (
const TUID _iid,
void** obj) SMTG_OVERRIDE;
578 uint32 PLUGIN_API addRef () SMTG_OVERRIDE
583 uint32 PLUGIN_API
release () SMTG_OVERRIDE
589 tresult PLUGIN_API read (
void* buffer, int32 numBytes, int32* numBytesRead) SMTG_OVERRIDE;
590 tresult PLUGIN_API write (
void* buffer, int32 numBytes, int32* numBytesWritten) SMTG_OVERRIDE;
591 tresult PLUGIN_API seek (int64 pos, int32 mode, int64* result) SMTG_OVERRIDE;
592 tresult PLUGIN_API tell (int64* pos) SMTG_OVERRIDE;
606 #if defined(__clang__)
607 #pragma clang diagnostic pop
608 #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
609 #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)
static HostApplication * theHostContext()
tresult PLUGIN_API queryInterface(const TUID _iid, void **obj) SMTG_OVERRIDE
tresult PLUGIN_API getContextInfoValue(int32 &, FIDString) SMTG_OVERRIDE
std::unique_ptr< PlugInterfaceSupport > _plug_interface_support
void set_session(ARDOUR::Session *)
uint32 PLUGIN_API addRef() SMTG_OVERRIDE
tresult PLUGIN_API createInstance(TUID cid, TUID _iid, void **obj) SMTG_OVERRIDE
static Vst::IHostApplication * getHostContext()
tresult PLUGIN_API getContextInfoString(Vst::TChar *, int32, FIDString) SMTG_OVERRIDE
virtual ~HostApplication()
tresult PLUGIN_API getName(Vst::String128 name) SMTG_OVERRIDE
uint32 PLUGIN_API release() SMTG_OVERRIDE
ARDOUR::Session * _session
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
Glib::ustring tchar_to_ustring(Vst::TChar const *s)
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)