Skip to content

Commit

Permalink
[vst3] Multiple fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Mar 15, 2024
1 parent 675616e commit 69aeaeb
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 53 deletions.
5 changes: 4 additions & 1 deletion include/avnd/binding/vst3/helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,23 @@ template <std::size_t M>
auto setStr(TChar (&field)[M], std::wstring_view text)
{
std::copy_n(text.data(), text.size(), field);
field[text.size()] = 0;
}
#else
#define u16 u""
template <std::size_t M>
auto setStr(TChar (&field)[M], std::u16string_view text)
{
std::copy_n(text.data(), text.size(), field);
field[text.size()] = 0;
}
#endif

template <std::size_t M>
auto setStr(TChar (&field)[M], std::string_view text)
{
avnd::utf8_to_utf16(text.data(), text.data() + text.size(), field);
field[text.size()] = 0;
}

inline Steinberg::tresult isProjectState(Steinberg::IBStream* state)
Expand All @@ -56,7 +59,7 @@ inline Steinberg::tresult isProjectState(Steinberg::IBStream* state)
== kResultTrue)
{
UString128 tmp(string);
char ascii[128];
char ascii[128] = {};
tmp.toAscii(ascii, 128);
if(!strncmp(ascii, StateType::kProject, strlen(StateType::kProject)))
{
Expand Down
110 changes: 58 additions & 52 deletions include/avnd/binding/vst3/prototype.cpp.in
Original file line number Diff line number Diff line change
@@ -1,92 +1,98 @@
/* SPDX-License-Identifier: GPL-3.0-or-later */

#include <@AVND_MAIN_FILE@>

#include <avnd/binding/vst3/audio_effect.hpp>
#include <avnd/binding/vst3/configure.hpp>

#include <avnd/common/export.hpp>

// clang-format off
#include <@AVND_MAIN_FILE@>

bool InitModule ()
{
return true;
}

bool DeinitModule ()
{
return true;
}

extern "C"
AVND_EXPORTED_SYMBOL Steinberg::IPluginFactory* GetPluginFactory()
// Needed everywhere
bool InitModule() { return true; }
bool DeinitModule() { return true; }
#if __APPLE__
extern "C" AVND_EXPORTED_SYMBOL bool BundleEntry() { return true; }
extern "C" AVND_EXPORTED_SYMBOL bool BundleExit() { return true; }
extern "C" AVND_EXPORTED_SYMBOL bool bundleEntry() { return true; }
extern "C" AVND_EXPORTED_SYMBOL bool bundleExit() { return true; }
#elif _WIN32
extern "C" AVND_EXPORTED_SYMBOL bool InitDll() { return true; }
extern "C" AVND_EXPORTED_SYMBOL bool ExitDll() { return true; }
#elif __linux__
extern "C" AVND_EXPORTED_SYMBOL bool ModuleEntry() { return true; }
extern "C" AVND_EXPORTED_SYMBOL bool ModuleExit() { return true; }
#endif

extern "C" AVND_EXPORTED_SYMBOL Steinberg::IPluginFactory* GetPluginFactory()
{
using type = decltype(avnd::configure<stv3::config, @AVND_MAIN_CLASS@ >())::type;
using type = decltype(avnd::configure<stv3::config, @AVND_MAIN_CLASS@>())::type;
// return new stv3::factory<type>{};

using component_t = stv3::Component<type>;
using controller_t = stv3::Controller<type>;
static stv3::factory<type, component_t, controller_t> fact;
return &fact;
}

namespace Steinberg {
namespace Vst {
// clang-format on
namespace Steinberg
{
namespace Vst
{

//----VST 3.0--------------------------------
DEF_CLASS_IID (IComponent)
DEF_CLASS_IID (IAudioProcessor)
DEF_CLASS_IID (IUnitData)
DEF_CLASS_IID (IProgramListData)
DEF_CLASS_IID(IComponent)
DEF_CLASS_IID(IAudioProcessor)
DEF_CLASS_IID(IUnitData)
DEF_CLASS_IID(IProgramListData)

DEF_CLASS_IID (IEditController)
DEF_CLASS_IID (IUnitInfo)
DEF_CLASS_IID(IEditController)
DEF_CLASS_IID(IUnitInfo)

DEF_CLASS_IID (IConnectionPoint)
DEF_CLASS_IID(IConnectionPoint)

DEF_CLASS_IID (IComponentHandler)
DEF_CLASS_IID (IUnitHandler)
DEF_CLASS_IID(IComponentHandler)
DEF_CLASS_IID(IUnitHandler)

DEF_CLASS_IID (IParamValueQueue)
DEF_CLASS_IID (IParameterChanges)
DEF_CLASS_IID(IParamValueQueue)
DEF_CLASS_IID(IParameterChanges)

DEF_CLASS_IID (IEventList)
DEF_CLASS_IID (IMessage)
DEF_CLASS_IID(IEventList)
DEF_CLASS_IID(IMessage)

DEF_CLASS_IID (IHostApplication)
DEF_CLASS_IID (IAttributeList)
DEF_CLASS_IID(IHostApplication)
DEF_CLASS_IID(IAttributeList)

//----VST 3.0.1--------------------------------
DEF_CLASS_IID (IMidiMapping)
DEF_CLASS_IID(IMidiMapping)

//----VST 3.0.2--------------------------------

//----VST 3.1----------------------------------
DEF_CLASS_IID (IComponentHandler2)
DEF_CLASS_IID (IEditController2)
DEF_CLASS_IID (IAudioPresentationLatency)
DEF_CLASS_IID (IVst3ToVst2Wrapper)
DEF_CLASS_IID (IVst3ToAUWrapper)
DEF_CLASS_IID(IComponentHandler2)
DEF_CLASS_IID(IEditController2)
DEF_CLASS_IID(IAudioPresentationLatency)
DEF_CLASS_IID(IVst3ToVst2Wrapper)
DEF_CLASS_IID(IVst3ToAUWrapper)

//----VST 3.5----------------------------------
DEF_CLASS_IID (INoteExpressionController)
DEF_CLASS_IID (IKeyswitchController)
DEF_CLASS_IID (IEditControllerHostEditing)
DEF_CLASS_IID(INoteExpressionController)
DEF_CLASS_IID(IKeyswitchController)
DEF_CLASS_IID(IEditControllerHostEditing)

//----VST 3.6----------------------------------
DEF_CLASS_IID (IStreamAttributes)
DEF_CLASS_IID(IStreamAttributes)

//----VST 3.6.5--------------------------------
DEF_CLASS_IID (IUnitHandler2)
DEF_CLASS_IID(IUnitHandler2)

//----VST 3.6.8--------------------------------
DEF_CLASS_IID (IComponentHandlerBusActivation)
DEF_CLASS_IID (IVst3ToAAXWrapper)

DEF_CLASS_IID (IVst3WrapperMPESupport)
DEF_CLASS_IID(IComponentHandlerBusActivation)
DEF_CLASS_IID(IVst3ToAAXWrapper)

DEF_CLASS_IID(IVst3WrapperMPESupport)

//----VST 3.7-----------------------------------
DEF_CLASS_IID (IProcessContextRequirements)
DEF_CLASS_IID (IProgress)
}}
DEF_CLASS_IID(IProcessContextRequirements)
DEF_CLASS_IID(IProgress)
}
}

0 comments on commit 69aeaeb

Please sign in to comment.