Hello all!
I wrote a small example that works on Windows x86 / x64. I only tested at Cockos Reaper, in other DAWs it should work just as well.
Thanks a lot for helping Infratec and fixing my a few bugs with pointers.
There all translated basic include files and example VST plugin (no GUI).
https://www.dropbox.com/sh/j0vun0sg751f .. drVEa?dl=0
update link:
29.12.2019 vst window test.
EnableExplicit
Global channels.l = 2
Global paramvolume.f = 1.0
PrototypeC.i DispatcherProc(*effect, opcode.l, index.l, Value.i, *ptr, opt.f)
PrototypeC ProcessProc(*effect, *inputs.Float, *outputs.Float, sampleframes.l)
PrototypeC SetParameterProc(*effect, index.l, parameter.f)
PrototypeC.f GetParameterProc(*effect, index.l)
PrototypeC ProcessReplacingProc(*effect, *inputs.Float, *outputs.Float, sampleframes.l)
PrototypeC ProcessDoubleReplacingProc(*effect, *inputs.Double, *outputs.Double, sampleframes.l)
Structure AEffect Align #PB_Structure_AlignC
magic.l
dispatcher.DispatcherProc
process.ProcessProc
setParameter.SetParameterProc
getParameter.GetParameterProc
numPrograms.l
numParams.l
numInputs.l
numOutputs.l
flags.l
*resvd1
*resvd2
initialDelay.l
realQualities.l
offQualities.l
ioRatio.f
*Object
*user
uniqueID.l
version.l
processReplacing.ProcessReplacingProc
processDoubleReplacing.ProcessDoubleReplacingProc
Array future.b(56)
EndStructure
; constants
#kEffectMagic = $56737450
#effFlagsCanReplacing = 16
#kPlugCategEffect = 1
#kPlugCategSynth = 2
#kPlugCategAnalysis = 3
; AEffect constants
#effClose = 1
#effGetParamLabel = 6
#effGetParamDisplay = 7
#effGetParamName = 8
#effSetSampleRate = 10
#effSetBlockSize = 11;
#effGetPlugCategory = 35
#effGetEffectName = 45
#effGetVendorString = 47
#effGetProductString = 48
#effGetVendorVersion = 49
; string sizes
#kVstMaxParamStrLen = 8
#kVstMaxVendorStrLen = 64
#kVstMaxProductStrLen = 64
#kVstMaxEffectNameLen = 32
; other procedures
Procedure getParameterName(index.l, *text)
Select index
Case 0
PokeS(*text, 'Volume', #kVstMaxParamStrLen, #PB_Ascii)
EndSelect
EndProcedure
Procedure getParameterDisplay(index.l, *text)
Select index
Case 0
PokeS(*text, StrF(paramvolume, 4), 4, #PB_Ascii)
EndSelect
EndProcedure
; procedures for VST sdk
ProcedureC.i DispatcherProc(*d.AEffect, opcode.l, index.l, Value.i, *ptr, opt.f)
Protected result.i
Select opcode
Case #effClose
FreeStructure(*d)
Case #effGetParamDisplay
getParameterDisplay(index, *ptr)
Case #effGetParamName
getParameterName(index, *ptr)
Case #effGetPlugCategory
result = #kPlugCategEffect #kPlugCategAnalysis
Case #effGetEffectName
PokeS(*ptr, 'test plugin', #kVstMaxEffectNameLen, #PB_Ascii)
Case #effGetVendorString
PokeS(*ptr, 'Alex Longard', #kVstMaxVendorStrLen, #PB_Ascii)
Default
EndSelect
ProcedureReturn result
EndProcedure
ProcedureC ProcessReplacingProc(*ap.AEffect, *inputs, *outputs, sampleframes.l)
Protected *In1, *In2, *Out1, *Out2, i.l
*In1 = PeekI(*inputs)
*Out1 = PeekI(*outputs)
If channels = 2
*In2 = PeekI(*inputs + SizeOf(integer))
*Out2 = PeekI(*outputs + SizeOf(integer))
EndIf
For i = 0 To sampleframes - 1
PokeF(*Out1 + i * SizeOf(float), PeekF(*In1 + i * SizeOf(float)) * paramvolume)
If channels = 2
PokeF(*Out2 + i * SizeOf(float), PeekF(*In2 + i * SizeOf(float)) * paramvolume)
EndIf
Next i
EndProcedure
ProcedureC ProcessDoubleReplacingProc(*ap.AEffect, *inputs, *outputs, sampleframes.l)
EndProcedure
ProcedureC SetParameterProc(*asp.AEffect, index.l, value.f)
paramvolume = value
EndProcedure
ProcedureC.f GetParameterProc(*agp.AEffect, index.l)
ProcedureReturn paramvolume
EndProcedure
ProcedureCDLL VSTPluginMain(*audioMaster)
Protected *Aef.AEffect = AllocateStructure(AEffect)
*aefmagic = #kEffectMagic
*aefdispatcher = @DispatcherProc()
*aefsetParameter = @SetParameterProc()
*aefgetParameter = @GetParameterProc()
*aefnumParams = 1
*aefnumInputs = channels
*aefnumOutputs = channels
*aefflags = #effFlagsCanReplacing
*aefprocessReplacing = @ProcessReplacingProc()
; *aefprocessDoubleReplacing = @ProcessDoubleReplacingProc()
*aefuniqueID = 02081987
*aefversion = 1
*aefObject = 0
ProcedureReturn *aef
EndProcedure