summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-10-03 19:56:30 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-10-03 19:56:30 +0000
commitf81821c68e66db3b7952f922d4a0a549317aaf22 (patch)
treead4f12e9c354a1ca09361e872c9a272d548d444c /libs/ardour
parent63cf87beb79270a55485f9b3ff344b234fb78545 (diff)
update vestige header; fix 64 bit issues
git-svn-id: svn://localhost/ardour2/branches/3.0@10185 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/session.h8
-rwxr-xr-xlibs/ardour/ardour/vestige/aeffectx.h364
-rwxr-xr-xlibs/ardour/lxvst_plugin.cc48
-rwxr-xr-xlibs/ardour/session_lxvst.cc19
-rwxr-xr-xlibs/ardour/vstfxinfofile.cc20
5 files changed, 180 insertions, 279 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index e41ea5a625..d6edaf6a0e 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -744,10 +744,10 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
/*Native linuxVST support*/
- static long lxvst_callback (AEffect* effect,
- long opcode,
- long index,
- long value,
+ static intptr_t lxvst_callback (AEffect* effect,
+ int32_t opcode,
+ int32_t index,
+ intptr_t value,
void* ptr,
float opt);
diff --git a/libs/ardour/ardour/vestige/aeffectx.h b/libs/ardour/ardour/vestige/aeffectx.h
index dda128f45e..14ecb5ea6e 100755
--- a/libs/ardour/ardour/vestige/aeffectx.h
+++ b/libs/ardour/ardour/vestige/aeffectx.h
@@ -21,130 +21,108 @@
* Boston, MA 02110-1301 USA.
*
*/
-
-
+#include <stdint.h>
#ifndef _AEFFECTX_H
#define _AEFFECTX_H
-#include <stdint.h>
+#define CCONST(a, b, c, d)( ( ( (int) a ) << 24 ) | \
+ ( ( (int) b ) << 16 ) | \
+ ( ( (int) c ) << 8 ) | \
+ ( ( (int) d ) << 0 ) )
-#define audioMasterAutomate 0
-#define audioMasterVersion 1
-#define audioMasterCurrentId 2
-#define audioMasterIdle 3
-#define audioMasterPinConnected 4
+const int audioMasterAutomate = 0;
+const int audioMasterVersion = 1;
+const int audioMasterCurrentId = 2;
+const int audioMasterIdle = 3;
+const int audioMasterPinConnected = 4;
// unsupported? 5
-#define audioMasterWantMidi 6
-#define audioMasterGetTime 7
-#define audioMasterProcessEvents 8
-#define audioMasterSetTime 9
-#define audioMasterTempoAt 10
-#define audioMasterGetNumAutomatableParameters 11
-#define audioMasterGetParameterQuantization 12
-#define audioMasterIOChanged 13
-#define audioMasterNeedIdle 14
-#define audioMasterSizeWindow 15
-#define audioMasterGetSampleRate 16
-#define audioMasterGetBlockSize 17
-#define audioMasterGetInputLatency 18
-#define audioMasterGetOutputLatency 19
-#define audioMasterGetPreviousPlug 20
-#define audioMasterGetNextPlug 21
-#define audioMasterWillReplaceOrAccumulate 22
-#define audioMasterGetCurrentProcessLevel 23
-#define audioMasterGetAutomationState 24
-#define audioMasterOfflineStart 25
-#define audioMasterOfflineRead 26
-#define audioMasterOfflineWrite 27
-#define audioMasterOfflineGetCurrentPass 28
-#define audioMasterOfflineGetCurrentMetaPass 29
-#define audioMasterSetOutputSampleRate 30
+const int audioMasterWantMidi = 6;
+const int audioMasterGetTime = 7;
+const int audioMasterProcessEvents = 8;
+const int audioMasterSetTime = 9;
+const int audioMasterTempoAt = 10;
+const int audioMasterGetNumAutomatableParameters = 11;
+const int audioMasterGetParameterQuantization = 12;
+const int audioMasterIOChanged = 13;
+const int audioMasterNeedIdle = 14;
+const int audioMasterSizeWindow = 15;
+const int audioMasterGetSampleRate = 16;
+const int audioMasterGetBlockSize = 17;
+const int audioMasterGetInputLatency = 18;
+const int audioMasterGetOutputLatency = 19;
+const int audioMasterGetPreviousPlug = 20;
+const int audioMasterGetNextPlug = 21;
+const int audioMasterWillReplaceOrAccumulate = 22;
+const int audioMasterGetCurrentProcessLevel = 23;
+const int audioMasterGetAutomationState = 24;
+const int audioMasterOfflineStart = 25;
+const int audioMasterOfflineRead = 26;
+const int audioMasterOfflineWrite = 27;
+const int audioMasterOfflineGetCurrentPass = 28;
+const int audioMasterOfflineGetCurrentMetaPass = 29;
+const int audioMasterSetOutputSampleRate = 30;
// unsupported? 31
-#define audioMasterGetSpeakerArrangement 31 // deprecated in 2.4?
-#define audioMasterGetVendorString 32
-#define audioMasterGetProductString 33
-#define audioMasterGetVendorVersion 34
-#define audioMasterVendorSpecific 35
-#define audioMasterSetIcon 36
-#define audioMasterCanDo 37
-#define audioMasterGetLanguage 38
-#define audioMasterOpenWindow 39
-#define audioMasterCloseWindow 40
-#define audioMasterGetDirectory 41
-#define audioMasterUpdateDisplay 42
-#define audioMasterBeginEdit 43
-#define audioMasterEndEdit 44
-#define audioMasterOpenFileSelector 45
-#define audioMasterCloseFileSelector 46// currently unused
-#define audioMasterEditFile 47// currently unused
-#define audioMasterGetChunkFile 48// currently unused
-#define audioMasterGetInputSpeakerArrangement 49 // currently unused
-
-#define effFlagsHasEditor 1
-// very likely
-#define effFlagsCanReplacing (1 << 4)
-// currently unused
-#define effFlagsIsSynth (1 << 8)
-
-#define effOpen 0
-//currently unused
-#define effClose 1
-// currently unused
-#define effSetProgram 2
-// currently unused
-#define effGetProgram 3
-// currently unused
-#define effGetProgramName 5
-#define effGetParamLabel 6
-// currently unused
-#define effGetParamName 8
-// this is a guess
-#define effSetSampleRate 10
-#define effSetBlockSize 11
-#define effMainsChanged 12
-#define effEditGetRect 13
-#define effEditOpen 14
-#define effEditClose 15
-#define effEditIdle 19
-#define effProcessEvents 25
-#define effGetEffectName 45
-// missing
-#define effGetParameterProperties 47
-#define effGetVendorString 47
-#define effGetProductString 48
-#define effGetVendorVersion 49
-// currently unused
-#define effCanDo 51
-// currently unused
-#define effGetVstVersion 58
-
-#ifdef WORDS_BIGENDIAN
-// "VstP"
-#define kEffectMagic 0x50747356
-#else
-// "PtsV"
-#define kEffectMagic 0x56737450
-#endif
-
-#define kVstLangEnglish 1
-#define kVstMidiType 1
-#define kVstTransportPlaying (1 << 1)
-
-/* validity flags for a VstTimeINfo structure this info comes from the web */
-
-#define kVstNanosValid (1 << 8)
-#define kVstPpqPosValid (1 << 9)
-#define kVstTempoValid (1 << 10)
-#define kVstBarsValid (1 << 11)
-#define kVstCyclePosValid (1 << 12)
-#define kVstTimeSigValid (1 << 13)
-#define kVstSmpteValid (1 << 14)
-#define kVstClockValid (1 << 15)
-
-#define kVstTransportChanged 1
-
-typedef struct VstMidiEvent
+const int audioMasterGetSpeakerArrangement = 31; // deprecated in 2.4?
+const int audioMasterGetVendorString = 32;
+const int audioMasterGetProductString = 33;
+const int audioMasterGetVendorVersion = 34;
+const int audioMasterVendorSpecific = 35;
+const int audioMasterSetIcon = 36;
+const int audioMasterCanDo = 37;
+const int audioMasterGetLanguage = 38;
+const int audioMasterOpenWindow = 39;
+const int audioMasterCloseWindow = 40;
+const int audioMasterGetDirectory = 41;
+const int audioMasterUpdateDisplay = 42;
+const int audioMasterBeginEdit = 43;
+const int audioMasterEndEdit = 44;
+const int audioMasterOpenFileSelector = 45;
+const int audioMasterCloseFileSelector = 46; // currently unused
+const int audioMasterEditFile = 47; // currently unused
+const int audioMasterGetChunkFile = 48; // currently unused
+const int audioMasterGetInputSpeakerArrangement = 49; // currently unused
+
+const int effFlagsHasEditor = 1;
+const int effFlagsCanReplacing = 1 << 4; // very likely
+const int effFlagsIsSynth = 1 << 8; // currently unused
+
+const int effOpen = 0;
+const int effClose = 1; // currently unused
+const int effSetProgram = 2; // currently unused
+const int effGetProgram = 3; // currently unused
+const int effGetProgramName = 5; // currently unused
+const int effGetParamName = 8; // currently unused
+const int effSetSampleRate = 10;
+const int effSetBlockSize = 11;
+const int effMainsChanged = 12;
+const int effEditGetRect = 13;
+const int effEditOpen = 14;
+const int effEditClose = 15;
+const int effEditIdle = 19;
+const int effEditTop = 20;
+const int effProcessEvents = 25;
+const int effGetEffectName = 45;
+const int effGetParameterProperties = 47; // missing
+const int effGetVendorString = 47;
+const int effGetProductString = 48;
+const int effGetVendorVersion = 49;
+const int effCanDo = 51; // currently unused
+const int effGetVstVersion = 58; // currently unused
+
+const int kEffectMagic = CCONST( 'V', 's', 't', 'P' );
+const int kVstLangEnglish = 1;
+const int kVstMidiType = 1;
+const int kVstParameterUsesFloatStep = 1 << 2;
+const int kVstTempoValid = 1 << 10;
+const int kVstTransportPlaying = 1 << 1;
+
+
+class RemoteVstPlugin;
+
+
+class VstMidiEvent
{
+public:
// 00
int type;
// 04
@@ -168,87 +146,69 @@ typedef struct VstMidiEvent
// 1f?
char reserved2;
-} VstMidiEvent;
+} ;
-typedef struct VstEvent
+class VstEvent
{
char dump[sizeof( VstMidiEvent )];
-} VstEvent ;
+} ;
-typedef struct VstEvents
+class VstEvents
{
+public:
// 00
int numEvents;
// 04
- int reserved;
+ void *reserved;
// 08
VstEvent * events[];
-} VstEvents;
-/* constants from http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=3740&sid=183f74631fee71a493316735e2b9f28b */
+} ;
-enum Vestige2StringConstants
-{
- VestigeMaxNameLen = 64,
- VestigeMaxLabelLen = 64,
- VestigeMaxShortLabelLen = 8,
- VestigeMaxCategLabelLen = 24,
- VestigeMaxFileNameLen = 100
-};
-
-/* this struct taken from http://asseca.com/vst-24-specs/efGetParameterProperties.html */
-struct VstParameterProperties
-{
- float stepFloat; /* float step */
- float smallStepFloat; /* small float step */
- float largeStepFloat; /* large float step */
- char label[VestigeMaxLabelLen]; /* parameter label */
- int32_t flags; /* @see VstParameterFlags */
- int32_t minInteger; /* integer minimum */
- int32_t maxInteger; /* integer maximum */
- int32_t stepInteger; /* integer step */
- int32_t largeStepInteger; /* large integer step */
- char shortLabel[VestigeMaxShortLabelLen]; /* short label, recommended: 6 + delimiter */
- int16_t displayIndex; /* index where this parameter should be displayed (starting with 0) */
- int16_t category; /* 0: no category, else group index + 1 */
- int16_t numParametersInCategory; /* number of parameters in category */
- int16_t reserved; /* zero */
- char categoryLabel[VestigeMaxCategLabelLen]; /* category label, e.g. "Osc 1" */
- char future[16]; /* reserved for future use */
-};
-
-/* this enum taken from http://asseca.com/vst-24-specs/efGetParameterProperties.html */
-enum VstParameterFlags
+
+
+
+// Not finished, neither really used
+class VstParameterProperties
{
- kVstParameterIsSwitch = 1 << 0, /* parameter is a switch (on/off) */
- kVstParameterUsesIntegerMinMax = 1 << 1, /* minInteger, maxInteger valid */
- kVstParameterUsesFloatStep = 1 << 2, /* stepFloat, smallStepFloat, largeStepFloat valid */
- kVstParameterUsesIntStep = 1 << 3, /* stepInteger, largeStepInteger valid */
- kVstParameterSupportsDisplayIndex = 1 << 4, /* displayIndex valid */
- kVstParameterSupportsDisplayCategory = 1 << 5, /* category, etc. valid */
- kVstParameterCanRamp = 1 << 6 /* set if parameter value can ramp up/down */
-};
-
-typedef struct AEffect
+public:
+ float stepFloat;
+ char label[64];
+ int flags;
+ int minInteger;
+ int maxInteger;
+ int stepInteger;
+ char shortLabel[8];
+ int category;
+ char categoryLabel[24];
+ char empty[128];
+
+} ;
+
+
+
+
+class AEffect
{
- // Never use c++!!!
+public:
+ // Never use virtual functions!!!
// 00-03
int magic;
// dispatcher 04-07
- int (* dispatcher)( struct AEffect * , int , int , int , void * , float );
+ intptr_t (* dispatcher)( AEffect * , int , int , intptr_t, void * , float );
// process, quite sure 08-0b
- void (* process)( struct AEffect * , float * * , float * * , int );
+ void (* process)( AEffect * , float * * , float * * , int );
// setParameter 0c-0f
- void (* setParameter)( struct AEffect * , int , float );
+ void (* setParameter)( AEffect * , int , float );
// getParameter 10-13
- float (* getParameter)( struct AEffect * , int );
+ float (* getParameter)( AEffect * , int );
// programs 14-17
int numPrograms;
// Params 18-1b
@@ -260,57 +220,55 @@ typedef struct AEffect
// flags 24-27
int flags;
// Fill somewhere 28-2b
- void * user;
+ void *ptr1;
+ void *ptr2;
// Zeroes 2c-2f 30-33 34-37 38-3b
- char empty3[4 + 4 + 4 + 4];
+ char empty3[4 + 4 + 4];
// 1.0f 3c-3f
float unkown_float;
// An object? pointer 40-43
- char empty4[4];
+ void *ptr3;
// Zeroes 44-47
- char empty5[4];
+ void *user;
// Id 48-4b
- char unused_id[4];
+ int32_t uniqueID;
// Don't know 4c-4f
char unknown1[4];
// processReplacing 50-53
- void (* processReplacing)( struct AEffect * , float * * , float * * , int );
+ void (* processReplacing)( AEffect * , float * * , float * * , int );
- int uniqueID;
+} ;
-} AEffect;
-
-typedef struct VstTimeInfo
+class VstTimeInfo
{
- /* info from online documentation of VST provided by Steinberg */
-
- double samplePos;
- double sampleRate;
- double nanoSeconds;
- double ppqPos;
- double tempo;
- double barStartPos;
- double cycleStartPos;
- double cycleEndPos;
- double timeSigNumerator;
- double timeSigDenominator;
- long smpteOffset;
- long smpteFrameRate;
- long samplesToNextClock;
- long flags;
-
-} VstTimeInfo;
+public:
+ // 00
+ double samplePos;
+ // 08
+ double sampleRate;
+ // unconfirmed 10 18
+ char empty1[8 + 8];
+ // 20?
+ double tempo;
+ // unconfirmed 28 30 38
+ char empty2[8 + 8 + 8];
+ // 40?
+ int timeSigNumerator;
+ // 44?
+ int timeSigDenominator;
+ // unconfirmed 48 4c 50
+ char empty3[4 + 4 + 4];
+ // 54
+ int flags;
+} ;
-typedef long int (* audioMasterCallback)( AEffect * , long int , long int ,
- long int , void * , float );
-// we don't use it, may be noise
-#define VSTCALLBACK
+typedef intptr_t (* audioMasterCallback)( AEffect * , int32_t, int32_t, intptr_t, void * , float );
#endif
diff --git a/libs/ardour/lxvst_plugin.cc b/libs/ardour/lxvst_plugin.cc
index d42679742b..26136b4589 100755
--- a/libs/ardour/lxvst_plugin.cc
+++ b/libs/ardour/lxvst_plugin.cc
@@ -40,7 +40,7 @@
#include <lrdf.h>
/*Include for the new native vst engine - vstfx.h*/
-
+#include <stdint.h>
#include <ardour/vstfx.h>
#include "pbd/compose.h"
@@ -547,38 +547,8 @@ LXVSTPlugin::connect_and_run (BufferSet& bufs,
}
/* we already know it can support processReplacing */
-
-#ifdef LXVST_32BIT
- _plugin->processReplacing (_plugin, ins, outs, nframes);
-#endif
-#if defined LXVST_64BIT && defined VESTIGE_HEADER
-
- /* Vestige doesn't work for 64Bit - some of the AEffect struct member types
- appear not to be correct which throws the data alignment. We have two choices
-
- 1) Fix Vestige - preferable from a technical standpoint, but perhaps
- not viable without affecting its 'clean room' status
-
- 2) Correct for the alignment error - a bit of a kludge, but it can work,
- assuming the following data types / sizes on x86-64
-
- char 1Byte : Byte aligned
- int 4Bytes : 4Byte aligned
- long 8Bytes : 8Byte aligned
- pointers 8Bytes : 8Byte aligned
-
- This gives an offset of 8 Bytes - inclusive of padding
- to translate to the correct address for processReplacing
- */
-
- ((AEffect*)(((char*)(_plugin)) + 8))->processReplacing(_plugin, ins, outs, nframes);
-
-#elif defined LXVST_64BIT
-
- _plugin->processReplacing(_plugin, ins, outs, nframes);
-
-#endif
+ _plugin->processReplacing (_plugin, ins, outs, nframes);
return 0;
}
@@ -600,23 +570,9 @@ LXVSTPlugin::unique_id() const
{
char buf[32];
-#if defined LXVST_64BIT && defined VESTIGE_HEADER
- /*The vestige header appears not to have correct data
- alignment in AEffect struct for 64Bit, possibly due
- to incorrect data types - see previous comments*/
-
- snprintf (buf, sizeof (buf), "%d", *((int32_t*) &((AEffect*)(((char*)(_plugin)) + 12))->unused_id));
-
-#elif defined LXVST_32BIT && defined VESTIGE_HEADER
-
- snprintf (buf, sizeof (buf), "%d", *((int32_t*) &_plugin->unused_id));
-
-#else
-
snprintf (buf, sizeof (buf), "%d", _plugin->uniqueID);
-#endif
return string (buf);
}
diff --git a/libs/ardour/session_lxvst.cc b/libs/ardour/session_lxvst.cc
index 17c81e753f..ea70e7985b 100755
--- a/libs/ardour/session_lxvst.cc
+++ b/libs/ardour/session_lxvst.cc
@@ -24,7 +24,7 @@
#include <stdbool.h>
#include <cstdio>
-
+#include <stdint.h>
#include <ardour/vstfx.h>
#include <ardour/vestige/aeffectx.h>
@@ -45,10 +45,10 @@ static int debug_callbacks = -1;
using namespace ARDOUR;
-long Session::lxvst_callback (AEffect* effect,
- long opcode,
- long index,
- long value,
+intptr_t Session::lxvst_callback (AEffect* effect,
+ int32_t opcode,
+ int32_t index,
+ intptr_t value,
void* ptr,
float opt)
{
@@ -65,13 +65,13 @@ long Session::lxvst_callback (AEffect* effect,
{
plug = (LXVSTPlugin*) (effect->user);
session = &plug->session();
- SHOW_CALLBACK ("am callback 0x%x, opcode = %ld, plugin = \"%s\" ", (unsigned int)pthread_self(), opcode, plug->name());
+ SHOW_CALLBACK ("am callback 0x%x, opcode = %d, plugin = \"%s\" ", (unsigned int)pthread_self(), opcode, plug->name());
}
else
{
plug = 0;
session = 0;
- SHOW_CALLBACK ("am callback 0x%x, opcode = %ld", (unsigned int)pthread_self(), opcode);
+ SHOW_CALLBACK ("am callback 0x%x, opcode = %d", (unsigned int)pthread_self(), opcode);
}
switch(opcode){
@@ -136,12 +136,13 @@ long Session::lxvst_callback (AEffect* effect,
_timeInfo.tempo = t.beats_per_minute ();
_timeInfo.flags |= (kVstTempoValid);
}
- if (value & (kVstBarsValid)) {
+ // NOTE: 'kVstBarsValid' is no longer defined in vestige headers -- I have no idea how important this is
+ /*if (value & (kVstBarsValid)) {
const Meter& m (session->tempo_map().meter_at (session->transport_frame()));
_timeInfo.timeSigNumerator = m.beats_per_bar ();
_timeInfo.timeSigDenominator = m.note_divisor ();
_timeInfo.flags |= (kVstBarsValid);
- }
+ }*/
if (session->transport_speed() != 0.0f) {
_timeInfo.flags |= kVstTransportPlaying;
diff --git a/libs/ardour/vstfxinfofile.cc b/libs/ardour/vstfxinfofile.cc
index 076cdad55f..502f4dd601 100755
--- a/libs/ardour/vstfxinfofile.cc
+++ b/libs/ardour/vstfxinfofile.cc
@@ -249,23 +249,8 @@ static VSTFXInfo* vstfx_info_from_plugin(VSTFX *vstfx)
info->creator = strdup (creator);
}
-#if defined LXVST_64BIT && defined VESTIGE_HEADER
-
- /*On 64Bit the data alignment in AEffect struct is
- incorrect using vestige. see lxvst_plugin.cc*/
-
- info->UniqueID = *((int32_t *) &((AEffect*)(((char*)(plugin)) + 12))->unused_id);
-
-#elif defined LXVST_32BIT && defined VESTIGE_HEADER
-
- info->UniqueID = *((int32_t *) &plugin->unused_id);
-
-#else
-
info->UniqueID = plugin->uniqueID;
-#endif
-
info->Category = strdup("None"); // FIXME:
info->numInputs = plugin->numInputs;
info->numOutputs = plugin->numOutputs;
@@ -288,7 +273,8 @@ static VSTFXInfo* vstfx_info_from_plugin(VSTFX *vstfx)
plugin->dispatcher (plugin, effGetParamName, i, 0, name, 0);
info->ParamNames[i] = strdup(name);
- plugin->dispatcher (plugin, effGetParamLabel, i, 0, label, 0);
+ //NOTE: 'effGetParamLabel' is no longer defined in vestige headers
+ //plugin->dispatcher (plugin, effGetParamLabel, i, 0, label, 0);
info->ParamLabels[i] = strdup(label);
}
return info;
@@ -297,7 +283,7 @@ static VSTFXInfo* vstfx_info_from_plugin(VSTFX *vstfx)
/* A simple 'dummy' audiomaster callback which should be ok,
we will only be instantiating the plugin in order to get its info*/
-static long simple_master_callback(struct AEffect *, long opcode, long, long, void *, float)
+static long simple_master_callback(struct AEffect *, int32_t opcode, int32_t, intptr_t, void *, float)
{
if (opcode == audioMasterVersion)