flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > VSTi and VSTfx plugins

Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 06 Jul 2023, 09:54
i am trying hard to find the vst example in asm on this forum but nothing seems to be there.

i don't really remember when or where it was, maybe on another website or here.

the goal is to develop a set of libs to make vst instruments and fx able to run with any DAW, and at least the major ones.

the template will let any programmer to add fucntions, effects, synths and so on by just coding the functions.

for the moment, i 've got this, but it don't works. it is adapted from a non working example found in random place.

the next step is to find an easy to understand documentation about the VST specs.

Code:
format PE GUI 4.0 DLL

include 'win32a.inc'

section '.text' code readable executable

proc VSTPluginMain
        mov     eax, AEffect
        ret
endp

dispatcher:
        ret

process:
        jmp processReplacing
        ret

setParameter:
        ret

getParameter:
        ret

processReplacing:
        push    ebp
        mov     ebp, esp
        jmp     .L2
.L3:
        mov     eax, [ebp+16]
        mov     eax, [eax]
        mov     edx, [ebp+20]
        sal     edx, 2
        lea     edx, [eax+edx]
        mov     eax, [ebp+12]
        mov     eax, [eax]
        mov     ecx, [ebp+20]
        sal     ecx, 2
        add     eax, ecx
        fld     dword[eax]
        fld     dword[one_half_float]
        fmulp   st1, st0
        fstp    dword[edx]
.L2:
        cmp     dword[ebp+20], 0
        setg    al
        sub     dword[ebp+20], 1
        test    al, al
        jne     .L3
        pop     ebp
        ret

processDoubleReplacing:
        ret

section '.data' data readable writeable

one_half_float:
        dd 0.5
AEffect:
        db 'PtsV'       ;//VstInt32 magic;                      ///< must be #kEffectMagic ('VstP')
        dd dispatcher   ;AEffectDispatcherProc dispatcher;
        dd process      ;AEffectProcessProc DECLARE_VST_DEPRECATED (process);
        dd setParameter ;AEffectSetParameterProc setParameter;
        dd getParameter ;AEffectGetParameterProc getParameter;
        dd 0 ;VstInt32 numPrograms;   ///< number of programs
        dd 0 ;VstInt32 numParams;               ///< all programs are assumed to have numParams parameters
        dd 1 ;VstInt32 numInputs;               ///< number of audio inputs
        dd 1 ;VstInt32 numOutputs;      ///< number of audio outputs
        dd 1 shl 4 ;| 1 << 12    ;VstInt32 flags;                        ///< @see VstAEffectFlags
        dd 0    ;VstIntPtr resvd1;              ///< reserved for Host, must be 0
        dd 0    ;VstIntPtr resvd2;              ///< reserved for Host, must be 0
        dd 0    ;VstInt32 initialDelay; ///< for algorithms which need input in the first place (Group delay or latency in Samples). This value should be initialized in a resume state.
        dd 0    ;VstInt32 DECLARE_VST_DEPRECATED (realQualities);       ///< \deprecated unused member
        dd 0    ;VstInt32 DECLARE_VST_DEPRECATED (offQualities);                ///< \deprecated unused member
        dd 0.0   ;float    DECLARE_VST_DEPRECATED (ioRatio);                     ///< \deprecated unused member
        dd 0x1337babe   ;void* object;                  ///< #AudioEffect class pointer
        dd 0    ;void* user;                            ///< user-defined pointer
        dd 'MSAV'       ;VstInt32 uniqueID;             ///< registered unique identifier (register it at Steinberg 3rd party support Web). This is used to identify a plug-in during save+load of preset and project.
        dd 1337 ;VstInt32 version;              ///< plug-in version (example 1100 for version 1.1.0.0)
        dd processReplacing     ;AEffectProcessProc processReplacing;
        dd processDoubleReplacing       ;AEffectProcessDoubleProc processDoubleReplacing;
        rb 56

section '.edata' export data readable

  export 'vst.DLL',\
         VSTPluginMain,'VSTPluginMain'
    


let's go?!
Post 06 Jul 2023, 09:54
View user's profile Send private message Visit poster's website Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 2493
Furs 06 Jul 2023, 13:23
Your code is for VST2.4, VST3 is completely different. What doesn't work though? Does processReplacing get called?

Also if you don't want to support processDoubleReplacing just set it to NULL, don't just make it a no-op. Some DAWs ignore the flag that say it supports it, and always use it if available.

Needless to say this is just for examples, I hope, since it uses static hardcoded memory so only one plugin instance will work.
Post 06 Jul 2023, 13:23
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 06 Jul 2023, 14:12
i am just starting to leanr womething about vst. i still don't know anything.
Post 06 Jul 2023, 14:12
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4016
Location: vpcmpistri
bitRAKE 06 Jul 2023, 16:04
[regarding assembly VST work]
ABox2 has a VST plugin interface, Google has discontinued their sites feature, but there are some captures on the wayback machine.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 06 Jul 2023, 16:04
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 07 Jul 2023, 13:35
thanks, just by trying to convert it to fasm, i should still get a lot of usefull tricks about sound programming
Post 07 Jul 2023, 13:35
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.