COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 10-24-2017, 06:28 AM   #1
JonOsterman
Human being with feelings
 
Join Date: Aug 2017
Posts: 50
Default Runtime Library & Multithread

Hi,

I might will need to change the runtime library of base, lice and IPlug from "Multi-Threaded" to "Multi-Threaded DLL" for my VST3 plugin. Is it a bad idea ? It would allow me to secure a FIFO
JonOsterman is offline   Reply With Quote
Old 10-24-2017, 07:26 AM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Somewhat bad idea, if you changed it to a "dll", the plugin will require that the end users have the exact needed runtime dlls installed on their machines. (And that tends to be somewhat of a pain to deal with.)

What do you mean by "secure a FIFO"?
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 10-24-2017, 07:47 AM   #3
JonOsterman
Human being with feelings
 
Join Date: Aug 2017
Posts: 50
Default

Quote:
Originally Posted by Xenakios View Post
What do you mean by "secure a FIFO"?
As my algorithm needs 5*512 samples to start working, I made a First-In First-Out Queue which store those buffers at start. Problem was that somehow Daws are taking more buffers than I got for the output and everything crash. So I'm looking into multi-threading possibilities
JonOsterman is offline   Reply With Quote
Old 10-24-2017, 07:54 AM   #4
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by JonOsterman View Post
As my algorithm needs 5*512 samples to start working, I made a First-In First-Out Queue which store those buffers at start. Problem was that somehow Daws are taking more buffers than I got for the output and everything crash. So I'm looking into multi-threading possibilities
At first thought, sounds like a horrible idea. You should probably simply output silent samples until you have enough data available for the host. If you can predict how long the initial silence lasts in samples, you could make your plugin report a latency amount for the host, so it can compensate for the delay.

Adding more threads just adds problems you have to deal with. Of course the runtime library itself doesn't make your code multithreaded, you will have to implement all that yourself. The non multithreaded runtime library options exists for some obscure legacy reasons, when you would know your code is going to be strictly single threaded, which doesn't even really work in a modern DAW/plugins context. So you must choose the multithreaded static or dll option anyway.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.

Last edited by Xenakios; 10-24-2017 at 08:06 AM.
Xenakios is offline   Reply With Quote
Old 10-24-2017, 08:03 AM   #5
JonOsterman
Human being with feelings
 
Join Date: Aug 2017
Posts: 50
Default

Quote:
Originally Posted by Xenakios View Post
You should probably simply output silent samples until you have enough data available for the host
Yeah sorry that's what I do, I didn't mentioned it.

Quote:
Originally Posted by Xenakios View Post
And in any case, didn't you notice how both the static runtime library and the dll runtime library say "multithreaded" on them? You should never be using the non-multithreaded runtime libraries in VST plugins anyway.
Ok, thing is that I don't know the difference beetween Multithreaded and Multithreaded DLL
JonOsterman is offline   Reply With Quote
Old 10-24-2017, 08:09 AM   #6
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by JonOsterman View Post
Ok, thing is that I don't know the difference beetween Multithreaded and Multithreaded DLL
"Multithreaded" statically links the runtime library into your plugin, which is what you will most likely want, so that the user doesn't have to install extra stuff before they can use your plugin.

"Multithreaded DLL" links the runtime library dynamically and the user will likely have to install the runtime libraries on their machine before they can use your plugin.

Neither option makes your plugin multithreaded. That's all up for you to implement. But I would recommend you find some other way than adding threads...Why doesn't outputting silence until you have valid data work? Wouldn't you just get glitches in the audio and not crashes, if your code is working correctly? Maybe you will just have to buffer more samples initially?
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.

Last edited by Xenakios; 10-24-2017 at 08:16 AM.
Xenakios is offline   Reply With Quote
Old 10-25-2017, 01:46 AM   #7
JonOsterman
Human being with feelings
 
Join Date: Aug 2017
Posts: 50
Default

Quote:
Originally Posted by Xenakios View Post
"Multithreaded" statically links the runtime library into your plugin, which is what you will most likely want, so that the user doesn't have to install extra stuff before they can use your plugin.

"Multithreaded DLL" links the runtime library dynamically and the user will likely have to install the runtime libraries on their machine before they can use your plugin.

Neither option makes your plugin multithreaded. That's all up for you to implement. But I would recommend you find some other way than adding threads...
I have 3 DLLs which I should integrate into the vst, I'll take a look on how to integrate them

Quote:
Originally Posted by Xenakios View Post
Why doesn't outputting silence until you have valid data work? Wouldn't you just get glitches in the audio and not crashes, if your code is working correctly? Maybe you will just have to buffer more samples initially?
I reworked it and now I just use a queue waiting to have enough buffers before working, seems to be ok for the moment. Thanks

Last edited by JonOsterman; 10-25-2017 at 02:09 AM.
JonOsterman is offline   Reply With Quote
Old 10-25-2017, 06:12 AM   #8
JonOsterman
Human being with feelings
 
Join Date: Aug 2017
Posts: 50
Default

Well I did not found where I can load the DLLs directly into my VST, instead of giving it to the DAWs in its directory. If anyone knows if it's possible ..
JonOsterman is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:37 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.