Page 2 of 4
Re: VST SDK plugin example
Posted: Fri Apr 19, 2019 9:18 am
by Joris
I suppose the 32 bit version is probably not ready to be used, as I tried the plugin_x86.dll in different DAW's and nothing is shown. Only in Ableton I get a little black square surface with a name analyse.
So I still don't know what the vst should do. I only have 64 bit for osx and ubuntu, but the vst is not ment for those.
Re: VST SDK plugin example
Posted: Fri Apr 19, 2019 10:46 am
by sq4
Joris wrote:I suppose the 32 bit version is probably not ready to be used, as I tried the plugin_x86.dll in different DAW's and nothing is shown. Only in Ableton I get a little black square surface with a name analyse.
So I still don't know what the vst should do. I only have 64 bit for osx and ubuntu, but the vst is not ment for those.
The example implements only the bare bones of a VST.
A VST can have an editor, but it is not necessary.
Things like effEditOpen/effEditClose/effEditGetRect/effEditIdle are not yet implemented.
Re: VST SDK plugin example
Posted: Fri Apr 19, 2019 4:18 pm
by oreopa
sq4 wrote:oreopa wrote:
How about simple ASIO vst host next? :DDD (Just kidding about that one

Or...?

)
If you search for Asio you'll find an older topic of mine under my previous member name "eriansa".
I remember I had to write assembler for the x86 version due to calling conventions. Pure coding hell...
And (no offence intended) I think that was the reason that put me off... ASM

I'm fine with 6502

(I did a little 8086 code in dos, but thats all

). Maybe I'll revisit that topic...
sq4 wrote:Joris wrote:I suppose the 32 bit version is probably not ready to be used, as I tried the plugin_x86.dll in different DAW's and nothing is shown. Only in Ableton I get a little black square surface with a name analyse.
So I still don't know what the vst should do. I only have 64 bit for osx and ubuntu, but the vst is not ment for those.
The example implements only the bare bones of a VST.
A VST can have an editor, but it is not necessary.
Things like effEditOpen/effEditClose/effEditGetRect/effEditIdle are not yet implemented.
And that is what is quite cool about this example. You don't have to install a byte of Steinberg SDK to make VST - I didn't know this

. It even has a place holder for DSP experiments with the volume calculation (I guess we do ALL THE DSP at this point, and break into procedures if needed?).
What I need to find out next is how to query the sample rate and block size so as to make some smooth constant waveforms without breaks/glitches between blocks... Any hints?

Re: VST SDK plugin example
Posted: Fri Apr 19, 2019 6:33 pm
by sq4
oreopa wrote:
What I need to find out next is how to query the sample rate and block size so as to make some smooth constant waveforms without breaks/glitches between blocks... Any hints?

The host calls the plugin dispatcher with following opcodes :
effSetSampleRate and effSetBlockSize or even with effSetBlockSizeAndSampleRate.
Every host will do it on initialization, but the order can be different per host...
They can also be called on other events, p.e. when the blocksize/samplerate has been changed in the host.
Anyway, when you get those opcodes in your dispatcher, you must rebuild your waveforms.
Re: VST SDK plugin example
Posted: Fri Apr 19, 2019 6:41 pm
by sq4
oreopa wrote:
And that is what is quite cool about this example. You don't have to install a byte of Steinberg SDK to make VST - I didn't know this

. It even has a place holder for DSP experiments with the volume calculation (I guess we do ALL THE DSP at this point, and break into procedures if needed?).
You don't need the Steinberg SDK at all. Just some knowledge of C in order to rewrite it in PB.
TBH the VST2.x SDK if quite simple and straightforward.
The VST3 SDK is quite the opposite...
Anyway, to be sure, I did ask and got a license from Steinberg in order to publish VST 2.x plugins.
Re: VST SDK plugin example
Posted: Fri Apr 19, 2019 6:51 pm
by Aleks_Longard
In first post i add link to AEffect.pbi and AEffectX.pbi and example.
More examples with GUI i add later.
I have problems on my work and i don’t have free time to practice VST on PureBasic.
Happy coding!!!
oreopa
see this:
in DispatcherProc
Code: Select all
case effSetSampleRate
setSampleRate(opt)
case effSetBlockSize
setBlockSize(value)
in basic code:
Code: Select all
global samplerate
global blocksize
procedure setSampleRate(opt.f)
samplerate = opt
endprocedure
procedure setBlockSize(value.i)
blocksize = value
endprocedure
Re: VST SDK plugin example
Posted: Fri Apr 19, 2019 11:34 pm
by oreopa
Aleks_Longard wrote:In first post i add link to AEffect.pbi and AEffectX.pbi and example.
I did not notice, this is great! Thanks.
Aleks_Longard wrote:
oreopa
see this[...]
Perfect... I see now...
Aleks_Longard wrote:
I have problems on my work and i don’t have free time to practice VST on PureBasic.
You have kindly provided a very good start for further experiments. I really am grateful. Thank you. Good luck with work!
All the best.
Re: VST SDK plugin example
Posted: Sat Apr 20, 2019 12:25 am
by oreopa
sq4 wrote:oreopa wrote:
What I need to find out next is how to query the sample rate and block size so as to make some smooth constant waveforms without breaks/glitches between blocks... Any hints?

The host calls the plugin dispatcher with following opcodes :
effSetSampleRate and effSetBlockSize or even with effSetBlockSizeAndSampleRate.
Every host will do it on initialization, but the order can be different per host...
They can also be called on other events, p.e. when the blocksize/samplerate has been changed in the host.
Anyway, when you get those opcodes in your dispatcher, you must rebuild your waveforms.
Perfect explanation. Im just not getting the full mechanics of the VST flow... It's seems the host is handling all the things like when to fill the next buffer/block in time for gapless playback... Thats what ProcessReplacing is for, right? (I know its recommended to implement ProcessReplacingDouble also, but we can skip that fact for now....)... Actually I see: ProcessReplacingProc(*ap.AEffect, *inputs, *outputs, sampleframes.l)... "sampleframes" is the amount of sample frames to fill till the VST mech calls ProcessReplacing again, right? Duh... I missed that
Thanx for help.
Re: VST SDK plugin example
Posted: Sat Apr 20, 2019 7:32 am
by Aleks_Longard
Oreopa
Thanks! Happy experements!
I update link and all include files.
Re: VST SDK plugin example
Posted: Sat Apr 20, 2019 10:53 am
by sq4
@Aleks_Longard
You do a "Freestructure(*AEffect)" on effClose.
In a well defined SDK one would assume that this is correct, but it isn't.
Some hosts will call effOpen/effClose and then again effOpen (see p.e. on a VST scan).
This will lead to an IMA.
You should also implement "ProcedureCDLL main(*callback)" for older hosts.
Let "ProcedureCDLL VstPluginMain()" call "main()".
Re: VST SDK plugin example
Posted: Sat Apr 20, 2019 3:08 pm
by Aleks_Longard
Hello Sq4,
I wrote an example of a plugin for my interest.
And i do not plan to write plugins on PB in the future.
If anyone is interested in this thing, I will be glad that my sdk translation will be useful to anyone.
I shared the example of a plugin for people to see what is possible to write on PB without an OOP style, only I wrote and will write in C++, since they use this language in my work and I work with VST developer who writes only in C++.
Re: VST SDK plugin example
Posted: Sat Apr 20, 2019 5:58 pm
by oreopa
Is it possible to get a handle from a purebasic native canvasgadget (maybe canvasgadget in borderless window?) to use as the GUI for a plugin? And furthermore can we then just use the mouse input handling of the canvasgadget to make the complete gui?
I guess its could be a problem eventually with GUI + DSP and only one thread, but I'm trying to ignore this for now
If I could use a canvasgadget, I think that would be ideal for the gui part.
Re: VST SDK plugin example
Posted: Sat Apr 20, 2019 6:08 pm
by Aleks_Longard
Hello Oreopa,
i'm already slowly writing an example with a GUI using canvasgadget, another option I thought of.
Cheers!
Re: VST SDK plugin example
Posted: Sat Apr 20, 2019 11:56 pm
by oreopa
Aleks_Longard wrote:Hello Oreopa,
i'm already slowly writing an example with a GUI using canvasgadget, another option I thought of.
Cheers!
Very nice... I really look forwards to it... Just one simple on off switch would be a perfect start.
I know VST spec allows for gui/input stuff, but to use PB native stuff where possible would be better! (I do not mind doing all the redraw/input logic/gui stuff by hand... i masochistically love that part also).
I tried some things already on effOpen and making hasEditor = 1... using handle of a windowed canvas gadget... but i guess its more complex than that...
I find this VST fun stuff a LOT of fun at the moment. It's long been my dream to start making my own vst effects, synths and also MIDI manipulators/sequencing/arp plugs... I'm a musician, and VST never works perfectly to my own satisfaction...

Theres a lot to learn, but doing it in PB is a pleasure with your translations. Again, thanx.
Report back soon

Re: VST SDK plugin example
Posted: Sun Apr 21, 2019 2:04 am
by Kuron
oreopa wrote:Aleks_Longard wrote:... VST never works perfectly to my own satisfaction...
I could not agree, more.