Browse Source

Rename vestige header and update it, adjust code as needed

tags/v1.9.11
falkTX FilipeCSnuk 6 years ago
parent
commit
8ac99a697e
4 changed files with 47 additions and 64 deletions
  1. +1
    -3
      source/backend/plugin/CarlaPluginVST2.cpp
  2. +34
    -29
      source/includes/vestige/vestige.h
  3. +10
    -22
      source/plugin/carla-vst.cpp
  4. +2
    -10
      source/utils/CarlaVstUtils.hpp

+ 1
- 3
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -901,9 +901,7 @@ public:
}

// check initial latency
char* const empty3Ptr = &fEffect->empty3[0];
int32_t initialDelay = *(int32_t*)empty3Ptr;
const uint32_t latency = (initialDelay > 0) ? static_cast<uint32_t>(initialDelay) : 0;
const uint32_t latency = (fEffect->initialDelay > 0) ? static_cast<uint32_t>(fEffect->initialDelay) : 0;

if (latency != 0)
{


source/includes/vestige/aeffectx.h → source/includes/vestige/vestige.h View File

@@ -1,9 +1,18 @@
/*
* aeffectx.h - simple header to allow VeSTige compilation and eventually work
* IMPORTANT: The author of Carla has no connection with the
* author of the VeSTige VST-compatibility header, has had no
* involvement in its creation.
*
* Copyright (c) 2006 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
* The VeSTige header is included in this package in the good-faith
* belief that it has been cleanly and legally reverse engineered
* without reference to the official VST SDK and without its
* developer(s) having agreed to the VST SDK license agreement.
*/

/*
* simple header to allow VeSTige compilation and eventually work
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
* Copyright (c) 2006 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
@@ -22,8 +31,8 @@
*
*/
#include <stdint.h>
#ifndef _AEFFECTX_H
#define _AEFFECTX_H
#ifndef _VESTIGE_H
#define _VESTIGE_H

#define CCONST(a, b, c, d)( ( ( (int) a ) << 24 ) | \
( ( (int) b ) << 16 ) | \
@@ -87,11 +96,11 @@
#define effFlagsIsSynth (1 << 8) // currently unused

#define effOpen 0
#define effClose 1 // currently unused
#define effSetProgram 2 // currently unused
#define effGetProgram 3 // currently unused
#define effGetProgramName 5 // currently unused
#define effGetParamName 8 // currently unused
#define effClose 1
#define effSetProgram 2
#define effGetProgram 3
#define effGetProgramName 5
#define effGetParamName 8
#define effSetSampleRate 10
#define effSetBlockSize 11
#define effMainsChanged 12
@@ -101,21 +110,16 @@
#define effEditIdle 19
#define effEditTop 20
#define effProcessEvents 25
// the next one from http://asseca.com/vst-24-specs/index.html
#define effGetPlugCategory 35
#define effGetEffectName 45
#define effGetVendorString 47
#define effGetProductString 48
#define effGetVendorVersion 49
#define effCanDo 51 // currently unused
/* from http://asseca.com/vst-24-specs/efIdle.html */
#define effCanDo 51
#define effIdle 53
/* from http://asseca.com/vst-24-specs/efGetParameterProperties.html */
#define effGetParameterProperties 56
#define effGetVstVersion 58 // currently unused
/* http://asseca.com/vst-24-specs/efShellGetNextPlugin.html */
#define effGetVstVersion 58
#define effShellGetNextPlugin 70
/* The next two were gleaned from http://www.kvraudio.com/forum/printview.php?t=143587&start=0 */
#define effStartProcess 71
#define effStopProcess 72

@@ -135,7 +139,13 @@

struct RemoteVstPlugin;

#define kVstTransportChanged 1
#define kVstTransportPlaying (1 << 1)
#define kVstTransportCycleActive (1 << 2)
#define kVstTransportRecording (1 << 3)

#define kVstAutomationWriting (1 << 6)
#define kVstAutomationReading (1 << 7)

#define kVstNanosValid (1 << 8)
#define kVstPpqPosValid (1 << 9)
@@ -190,11 +200,9 @@ struct _VstEvents
// 04
void *reserved;
// 08
VstEvent * events[];
VstEvent * events[2];
};

/* constants from http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=3740&sid=183f74631fee71a493316735e2b9f28b */

enum Vestige2StringConstants
{
VestigeMaxNameLen = 64,
@@ -205,8 +213,6 @@ enum Vestige2StringConstants
};


/* constants from http://asseca.com/vst-24-specs/efGetPlugCategory.html */

enum VstPlugCategory
{
kPlugCategUnknown = 0,
@@ -226,7 +232,6 @@ enum VstPlugCategory

typedef struct _VstEvents VstEvents;

/* this struct taken from http://asseca.com/vst-24-specs/efGetParameterProperties.html */
struct _VstParameterProperties
{
float stepFloat; /* float step */
@@ -249,7 +254,6 @@ struct _VstParameterProperties

typedef struct _VstParameterProperties VstParameterProperties;

/* this enum taken from http://asseca.com/vst-24-specs/efGetParameterProperties.html */
enum VstParameterFlags
{
kVstParameterIsSwitch = 1 << 0, /* parameter is a switch (on/off) */
@@ -287,18 +291,19 @@ struct _AEffect
// Fill somewhere 28-2b
void *ptr1;
void *ptr2;
// Zeroes 2c-2f 30-33 34-37 38-3b
char empty3[4 + 4 + 4];
int initialDelay;
// Zeroes 30-33 34-37 38-3b
char empty2[4 + 4];
// 1.0f 3c-3f
float unkown_float;
// An object? pointer 40-43
void *ptr3;
void *object;
// Zeroes 44-47
void *user;
// Id 48-4b
int32_t uniqueID;
// Don't know 4c-4f
char unknown1[4];
// plugin version 4c-4f
int32_t version;
// processReplacing 50-53
void (* processReplacing) (struct _AEffect *, float **, float **, int);
};

+ 10
- 22
source/plugin/carla-vst.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Native Plugins
* Copyright (C) 2013-2017 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2013-2018 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -29,19 +29,7 @@
#include "water/files/File.h"

#include "CarlaMathUtils.hpp"

#include "vestige/aeffectx.h"
#define effFlagsProgramChunks (1 << 5)
#define effGetParamLabel 6
#define effGetChunk 23
#define effSetChunk 24
#define effGetPlugCategory 35
#define kPlugCategEffect 1
#define kPlugCategSynth 2
#define kVstVersion 2400
struct ERect {
int16_t top, left, bottom, right;
};
#include "CarlaVstUtils.hpp"

static uint32_t d_lastBufferSize = 0;
static double d_lastSampleRate = 0.0;
@@ -702,9 +690,9 @@ struct VstObject {
NativePlugin* plugin;
};

#define validObject effect != nullptr && effect->ptr3 != nullptr
#define validPlugin effect != nullptr && effect->ptr3 != nullptr && ((VstObject*)effect->ptr3)->plugin != nullptr
#define vstObjectPtr (VstObject*)effect->ptr3
#define validObject effect != nullptr && effect->object != nullptr
#define validPlugin effect != nullptr && effect->object != nullptr && ((VstObject*)effect->object)->plugin != nullptr
#define vstObjectPtr (VstObject*)effect->object
#define pluginPtr (vstObjectPtr)->plugin

static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t index, intptr_t value, void* ptr, float opt)
@@ -781,7 +769,7 @@ static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t
/* This code invalidates the object created in VSTPluginMain
* Probably not safe against all hosts */
obj->audioMaster = nullptr;
effect->ptr3 = nullptr;
effect->object = nullptr;
delete obj;
#endif

@@ -921,9 +909,8 @@ const AEffect* VSTPluginMain(audioMasterCallback audioMaster)
std::memset(effect, 0, sizeof(AEffect));

// vst fields
effect->magic = kEffectMagic;
int32_t* const version = (int32_t*)&effect->unknown1;
*version = CARLA_VERSION_HEX;
effect->magic = kEffectMagic;
effect->version = CARLA_VERSION_HEX;

static const int32_t uniqueId = CCONST('C', 'r', 'l', 'a');
#if CARLA_PLUGIN_SYNTH
@@ -980,7 +967,8 @@ const AEffect* VSTPluginMain(audioMasterCallback audioMaster)
obj->audioMaster = audioMaster;
obj->plugin = nullptr;

effect->ptr3 = obj;
// done
effect->object = obj;

return effect;
}


+ 2
- 10
source/utils/CarlaVstUtils.hpp View File

@@ -1,6 +1,6 @@
/*
* Carla VST utils
* Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -27,7 +27,7 @@
#define VST_2_4_EXTENSIONS 1
#define VST_FORCE_DEPRECATED 0

#include "vestige/aeffectx.h"
#include "vestige/vestige.h"
#define audioMasterGetOutputSpeakerArrangement audioMasterGetSpeakerArrangement
#define effFlagsProgramChunks (1 << 5)
#define effSetProgramName 4
@@ -81,13 +81,6 @@
#define effSetProcessPrecision 77
#define effGetNumMidiInputChannels 78
#define effGetNumMidiOutputChannels 79
#define kPlugCategSynth 2
#define kPlugCategAnalysis 3
#define kPlugCategMastering 4
#define kPlugCategRoomFx 6
#define kPlugCategRestoration 8
#define kPlugCategShell 10
#define kPlugCategGenerator 11
#define kVstAutomationOff 1
#define kVstAutomationReadWrite 4
#define kVstProcessLevelUnknown 0
@@ -95,7 +88,6 @@
#define kVstProcessLevelRealtime 2
#define kVstProcessLevelOffline 4
#define kVstProcessPrecision32 0
#define kVstTransportChanged 1
#define kVstVersion 2400
#define DECLARE_VST_DEPRECATED(idx) idx
#if defined(CARLA_OS_WIN) && defined(__cdecl)


Loading…
Cancel
Save