3#include <pluginterfaces/vst/ivstaudioprocessor.h>
4#include <pluginterfaces/vst/ivstcomponent.h>
5#include <pluginterfaces/vst/ivsteditcontroller.h>
6#include <public.sdk/source/vst/hosting/hostclasses.h>
7#include <public.sdk/source/vst/utility/stringconvert.h>
12#include <pluginterfaces/vst/ivstunits.h>
44 :
size(sizeInCodeUnit)
48 memcpy(
v.
stringValue, value, sizeInCodeUnit *
sizeof(TChar));
77 sizeInCodeUnit =
size;
116 return kInvalidArgument;
118 list[aid] = std::make_unique<AudacityHostAttribute>(value);
125 return kInvalidArgument;
126 auto it =
list.find(aid);
127 if (it !=
list.end() && it->second)
129 value = it->second->intValue();
138 return kInvalidArgument;
140 list[aid] = std::make_unique<AudacityHostAttribute>(value);
147 return kInvalidArgument;
148 auto it =
list.find(aid);
149 if (it !=
list.end() && it->second)
151 value = it->second->floatValue();
160 return kInvalidArgument;
163 auto length = tstrlen(
string);
164 list[aid] = std::make_unique<AudacityHostAttribute>(
string, length + 1);
172 return kInvalidArgument;
174 auto it =
list.find(aid);
175 if (it !=
list.end() && it->second)
177 uint32 sizeInCodeUnit = 0;
178 const TChar* _string = it->second->stringValue(sizeInCodeUnit);
181 std::min<uint32>(sizeInCodeUnit *
sizeof(TChar), sizeInBytes));
192 return kInvalidArgument;
194 list[aid] = std::make_unique<AudacityHostAttribute>(data, sizeInBytes);
202 return kInvalidArgument;
203 auto it =
list.find(aid);
204 if (it !=
list.end() && it->second)
206 data = it->second->binaryValue(sizeInBytes);
213 DECLARE_FUNKNOWN_METHODS
220 auto it =
list.find(aid);
221 if (it !=
list.end())
225 std::map<std::string, std::unique_ptr<AudacityHostAttribute>>
list;
231class AudacityHostMessage :
public IMessage
234 AudacityHostMessage()
239 virtual ~AudacityHostMessage()
244 const char* PLUGIN_API getMessageID() SMTG_OVERRIDE
246 return mMessageId.c_str();
249 void PLUGIN_API setMessageID(
const char* messageID) SMTG_OVERRIDE
251 if (messageID !=
nullptr)
252 mMessageId = messageID;
257 IAttributeList* PLUGIN_API getAttributes() SMTG_OVERRIDE
259 if (!mAattributeList)
262 return mAattributeList.get();
265 DECLARE_FUNKNOWN_METHODS
267 std::string mMessageId;
268 IPtr<AudacityHostAttributeList> mAattributeList;
283Steinberg::tresult PLUGIN_API
284AudacityVst3HostApplication::queryInterface(
const char* _iid,
void** obj)
286 QUERY_INTERFACE(_iid, obj, FUnknown::iid, IHostApplication)
287 QUERY_INTERFACE(_iid, obj, IHostApplication::iid, IHostApplication)
288 QUERY_INTERFACE(_iid, obj, IPlugInterfaceSupport::iid, IPlugInterfaceSupport)
291 return Steinberg::kResultFalse;
294Steinberg::uint32 PLUGIN_API AudacityVst3HostApplication::addRef()
299Steinberg::uint32 PLUGIN_API AudacityVst3HostApplication::release()
304Steinberg::tresult PLUGIN_API
307 return VST3::StringConvert::convert(
"Audacity VST3 host application",
name) ?
308 Steinberg::kResultTrue :
309 Steinberg::kInternalError;
313 Steinberg::TUID cid, Steinberg::TUID _iid,
void** obj)
317 FUID classID(FUID::fromTUID(cid));
318 FUID interfaceID(FUID::fromTUID(_iid));
319 if (classID == Vst::IMessage::iid && interfaceID == Vst::IMessage::iid)
321 *obj =
safenew AudacityHostMessage;
325 classID == Vst::IAttributeList::iid &&
326 interfaceID == Vst::IAttributeList::iid)
336 const Steinberg::TUID _iid)
338 static auto supportedInterfaces = {
339 Steinberg::Vst::IComponent::iid,
340 Steinberg::Vst::IAudioProcessor::iid,
341 Steinberg::Vst::IEditController::iid,
342 Steinberg::Vst::IConnectionPoint::iid,
343 Steinberg::Vst::IUnitInfo::iid
346 auto uid = Steinberg::FUID::fromTUID(_iid);
348 std::find(supportedInterfaces.begin(), supportedInterfaces.end(), uid) !=
349 supportedInterfaces.end())
350 return Steinberg::kResultTrue;
351 return Steinberg::kResultFalse;
IMPLEMENT_FUNKNOWN_METHODS(RunLoop, Steinberg::Linux::IRunLoop, Steinberg::Linux::IRunLoop::iid)
union AudacityHostAttribute::v v
AudacityHostAttribute(int64 value)
AudacityHostAttribute(double value)
double floatValue() const
AudacityHostAttribute(const void *value, uint32 sizeInBytes)
const void * binaryValue(uint32 &sizeInBytes)
const TChar * stringValue(uint32 &sizeInCodeUnit)
AudacityHostAttribute(const TChar *value, uint32 sizeInCodeUnit)
std::map< std::string, std::unique_ptr< AudacityHostAttribute > > list
tresult PLUGIN_API getBinary(AttrID aid, const void *&data, uint32 &sizeInBytes) SMTG_OVERRIDE
tresult PLUGIN_API getInt(AttrID aid, int64 &value) SMTG_OVERRIDE
tresult PLUGIN_API getString(AttrID aid, TChar *string, uint32 sizeInBytes) SMTG_OVERRIDE
tresult PLUGIN_API setInt(AttrID aid, int64 value) SMTG_OVERRIDE
void removeAttrID(AttrID aid)
tresult PLUGIN_API getFloat(AttrID aid, double &value) SMTG_OVERRIDE
virtual ~AudacityHostAttributeList()
tresult PLUGIN_API setBinary(AttrID aid, const void *data, uint32 sizeInBytes) SMTG_OVERRIDE
AudacityHostAttributeList()
tresult PLUGIN_API setString(AttrID aid, const TChar *string) SMTG_OVERRIDE
tresult PLUGIN_API setFloat(AttrID aid, double value) SMTG_OVERRIDE
Steinberg::tresult PLUGIN_API isPlugInterfaceSupported(const Steinberg::TUID _iid) override
DECLARE_FUNKNOWN_METHODS AudacityVst3HostApplication()
static IHostApplication & Get()
Steinberg::tresult PLUGIN_API getName(Steinberg::Vst::String128 name) override
Steinberg::tresult PLUGIN_API createInstance(Steinberg::TUID cid, Steinberg::TUID _iid, void **obj) override
virtual ~AudacityVst3HostApplication()