diff --git a/libs/ardour/ardour/vst3_host.h b/libs/ardour/ardour/vst3_host.h index afc4755f2a..5ccb53d9f3 100644 --- a/libs/ardour/ardour/vst3_host.h +++ b/libs/ardour/ardour/vst3_host.h @@ -343,7 +343,7 @@ protected: std::vector _events; }; -class LIBARDOUR_LOCAL RAMStream : public IBStream +class LIBARDOUR_LOCAL RAMStream : public IBStream, public ISizeableStream, public Vst::IStreamAttributes { public: RAMStream (); @@ -352,7 +352,7 @@ public: virtual ~RAMStream (); - QUERY_INTERFACE_IMPL (IBStream) + tresult PLUGIN_API queryInterface (const TUID _iid, void** obj) SMTG_OVERRIDE; uint32 PLUGIN_API addRef () SMTG_OVERRIDE { return 1; } uint32 PLUGIN_API release () SMTG_OVERRIDE { return 1; } @@ -362,6 +362,14 @@ public: tresult PLUGIN_API seek (int64 pos, int32 mode, int64* result) SMTG_OVERRIDE; tresult PLUGIN_API tell (int64* pos) SMTG_OVERRIDE; + /* ISizeableStream API */ + tresult PLUGIN_API getStreamSize (int64&) SMTG_OVERRIDE; + tresult PLUGIN_API setStreamSize (int64) SMTG_OVERRIDE; + + /* IStreamAttributes API */ + tresult PLUGIN_API getFileName (Vst::String128 name) SMTG_OVERRIDE; + Vst::IAttributeList* PLUGIN_API getAttributes () SMTG_OVERRIDE; + /* convenience API for state I/O */ void rewind () { _pos = 0; } bool readonly () const { return _readonly; } @@ -404,6 +412,8 @@ private: int64 _alloc; int64 _pos; bool _readonly; + + HostAttributeList attribute_list; }; #if defined(__clang__) diff --git a/libs/ardour/vst3_host.cc b/libs/ardour/vst3_host.cc index 58cca6c724..507e22a6f1 100644 --- a/libs/ardour/vst3_host.cc +++ b/libs/ardour/vst3_host.cc @@ -35,6 +35,7 @@ DEF_CLASS_IID (IPluginFactory) DEF_CLASS_IID (IPluginFactory2) DEF_CLASS_IID (IPlugFrame) DEF_CLASS_IID (IPlugView) +DEF_CLASS_IID (ISizeableStream) DEF_CLASS_IID (Vst::IAttributeList) DEF_CLASS_IID (Vst::IAudioProcessor) DEF_CLASS_IID (Vst::IAutomationState) @@ -54,6 +55,7 @@ DEF_CLASS_IID (Vst::IParameterChanges) DEF_CLASS_IID (Vst::IParamValueQueue) DEF_CLASS_IID (Vst::IPlugInterfaceSupport) DEF_CLASS_IID (Vst::IProgramListData) +DEF_CLASS_IID (Vst::IStreamAttributes) DEF_CLASS_IID (Vst::IUnitData) DEF_CLASS_IID (Vst::IUnitInfo) @@ -510,6 +512,20 @@ RAMStream::~RAMStream () free (_data); } +tresult +RAMStream::queryInterface (const TUID _iid, void** obj) +{ + QUERY_INTERFACE (_iid, obj, FUnknown::iid, IBStream) + QUERY_INTERFACE (_iid, obj, IBStream::iid, IBStream) + QUERY_INTERFACE (_iid, obj, FUnknown::iid, ISizeableStream) + QUERY_INTERFACE (_iid, obj, ISizeableStream::iid, ISizeableStream) + QUERY_INTERFACE (_iid, obj, FUnknown::iid, Vst::IStreamAttributes) + QUERY_INTERFACE (_iid, obj, Vst::IStreamAttributes::iid, Vst::IStreamAttributes) + + *obj = nullptr; + return kNoInterface; +} + bool RAMStream::reallocate_buffer (int64 size, bool exact) { @@ -748,6 +764,34 @@ RAMStream::read_TUID (TUID& tuid) return true; } +tresult +RAMStream::getStreamSize (int64& size) +{ + size = _alloc; + return kResultTrue; +} + +tresult +RAMStream::setStreamSize (int64 size) +{ + if (_readonly) { + return kResultFalse; + } + return reallocate_buffer (size, true) ? kResultOk : kOutOfMemory; +} + +tresult +RAMStream::getFileName (Vst::String128 name) +{ + return kNotImplemented; +} + +Vst::IAttributeList* +RAMStream::getAttributes () +{ + return &attribute_list; +} + #ifndef NDEBUG #include