From 20a6b96161134d01d28783f938e31a09cd4d01c2 Mon Sep 17 00:00:00 2001 From: Lukas W Date: Sun, 14 Jan 2018 23:03:10 +0100 Subject: [PATCH] Fix 64bit VSTs on Linux by fixing callback calling convention --- include/aeffectx.h | 15 +++++++++------ plugins/vst_base/RemoteVstPlugin.cpp | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/aeffectx.h b/include/aeffectx.h index b2f8f0c6d..133d925ac 100644 --- a/include/aeffectx.h +++ b/include/aeffectx.h @@ -28,6 +28,9 @@ #include +// Calling convention +#define VST_CALL_CONV __cdecl + #define CCONST(a, b, c, d)( ( ( (int32_t) a ) << 24 ) | \ ( ( (int32_t) b ) << 16 ) | \ ( ( (int32_t) c ) << 8 ) | \ @@ -205,13 +208,13 @@ public: // 00-03 int32_t magic; // dispatcher 04-07 - intptr_t (* dispatcher)( AEffect * , int32_t , int32_t , intptr_t, void * , float ); + intptr_t (VST_CALL_CONV * dispatcher)( AEffect * , int32_t , int32_t , intptr_t, void * , float ); // process, quite sure 08-0b - void (* process)( AEffect * , float * * , float * * , int32_t ); + void (VST_CALL_CONV * process)( AEffect * , float * * , float * * , int32_t ); // setParameter 0c-0f - void (* setParameter)( AEffect * , int32_t , float ); + void (VST_CALL_CONV * setParameter)( AEffect * , int32_t , float ); // getParameter 10-13 - float (* getParameter)( AEffect * , int32_t ); + float (VST_CALL_CONV * getParameter)( AEffect * , int32_t ); // programs 14-17 int32_t numPrograms; // Params 18-1b @@ -238,7 +241,7 @@ public: // Don't know 4c-4f char unknown1[4]; // processReplacing 50-53 - void (* processReplacing)( AEffect * , float * * , float * * , int ); + void (VST_CALL_CONV * processReplacing)( AEffect * , float * * , float * * , int ); } ; @@ -281,7 +284,7 @@ public: -typedef intptr_t (* audioMasterCallback)( AEffect * , int32_t, int32_t, intptr_t, void * , float ); +typedef intptr_t (VST_CALL_CONV * audioMasterCallback)( AEffect * , int32_t, int32_t, intptr_t, void * , float ); #endif diff --git a/plugins/vst_base/RemoteVstPlugin.cpp b/plugins/vst_base/RemoteVstPlugin.cpp index 6110cb253..ab3812ed4 100644 --- a/plugins/vst_base/RemoteVstPlugin.cpp +++ b/plugins/vst_base/RemoteVstPlugin.cpp @@ -331,7 +331,7 @@ private: } ; // callback used by plugin for being able to communicate with it's host - static intptr_t hostCallback( AEffect * _effect, int32_t _opcode, + static VST_CALL_CONV intptr_t hostCallback( AEffect * _effect, int32_t _opcode, int32_t _index, intptr_t _value, void * _ptr, float _opt ); @@ -819,7 +819,7 @@ bool RemoteVstPlugin::load( const std::string & _plugin_file ) return false; } - typedef AEffect * ( __cdecl * mainEntryPointer ) + typedef AEffect * ( VST_CALL_CONV * mainEntryPointer ) ( audioMasterCallback ); mainEntryPointer mainEntry = (mainEntryPointer) GetProcAddress( m_libInst, "VSTPluginMain" );