COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :

Go Back   Cockos Incorporated Forums > Cockos and Friends Software Discussion > WDL users forum

Reply
 
Thread Tools Display Modes
Old 01-20-2017, 09:00 AM   #1
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 193
Default IPlug crash on FL when automating parameters (deadlock?)

Hi all.

I've noticed that when I automate a plugin's parameter from FL Studio and simultaneously move some knobs from plugin's GUI, the plugin totally crash.
It seems a deadlock.

I've tested and also noticed the same with many plugins made with IPlug, such as Scanner Vibrato (Tale, are you?)
Drumatic 4 till now seems to not suffer this problem.

Has anyone noticed (and so fixed) this problem?
I'm using WDL-OL version.

P.S. There are some plugins I've tested where automations from FL Studio doesn't works at all, such as PreAMPed (by random_id). Not sure if its intended. I'm just spot this out

Last edited by Nowhk; 01-20-2017 at 10:40 AM.
Nowhk is offline   Reply With Quote
Old 01-20-2017, 03:03 PM   #2
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: Holland
Posts: 2,789
Default

Hmm, interesting... I'm rather busy ATM, but I guess I will have to look into this at some point.
Tale is offline   Reply With Quote
Old 01-20-2017, 04:12 PM   #3
earlevel
Human being with feelings
 
Join Date: Dec 2015
Posts: 211
Default

My plugin is AAX-only at this time, but no problem fiddling with controls while they are automated.
earlevel is offline   Reply With Quote
Old 01-21-2017, 03:10 AM   #4
stw
Human being with feelings
 
Join Date: Apr 2012
Posts: 209
Default

Seems to work for my REFLEXplus. (at least here with FL 12 on WinXP.)
Maybe you want to try the demo on your machine:
https://www.stw-audio.com/downloads/
stw is offline   Reply With Quote
Old 01-21-2017, 06:19 AM   #5
random_id
Human being with feelings
 
random_id's Avatar
 
Join Date: May 2012
Location: PA, USA
Posts: 296
Default

I am not sure what I did with PreAMPed, but I will look when I get a chance.

Every now and then, users of my stuff report specific problems with certain hosts...and usually more than not, it is FL Studio (or Cubase).
__________________
Website: LVC-Audio
random_id is offline   Reply With Quote
Old 01-23-2017, 03:18 AM   #6
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 193
Default

Quote:
Originally Posted by stw View Post
Seems to work for my REFLEXplus. (at least here with FL 12 on WinXP.)
Maybe you want to try the demo on your machine:
https://www.stw-audio.com/downloads/
Nope, it also crashes there.
Try the attached file. Press Play and then tweak for a while another knob... it reaches a deadlock (or at least, a developer by Image-Line tell me this debugging FL Studio with my plugin).
He said: You could try putting the OnParamChange call (in VSTSetParameter) outside the lock. I think that would work., refered to this.

Didn't try yet, but I'm not sure about change those lines

In Drumatic 4 this just doesn't happens. The author (E-Phonic) tell me that maybe it was developed using a old version of WDL, which maybe doesn't contains this problem.

Any other clues?
Attached Files
File Type: zip reflex_test.zip (12.1 KB, 22 views)
Nowhk is offline   Reply With Quote
Old 01-23-2017, 03:48 AM   #7
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: Holland
Posts: 2,789
Default

Quote:
Originally Posted by Nowhk View Post
He said: You could try putting the OnParamChange call (in VSTSetParameter) outside the lock. I think that would work., refered to this.

Didn't try yet, but I'm not sure about change those lines
I guess that means FL Studio is calling VSTSetParameter() from the GUI thread... ?

Anyway, maybe something like thid would work then (and hopefully also still work in other hosts):

Code:
void VSTCALLBACK IPlugVST::VSTSetParameter(AEffect *pEffect, VstInt32 idx, float value)
{
  Trace(TRACELOC, "%d:%f", idx, value);
  IPlugVST* _this = (IPlugVST*) pEffect->object;
  bool change = false;
  {
    IMutexLock lock(_this);
    if (idx >= 0 && idx < _this->NParams())
    {
      if (_this->GetGUI())
      {
        _this->GetGUI()->SetParameterFromPlug(idx, value, true);
      }
      _this->GetParam(idx)->SetNormalized(value);
      change = true;
    }
  }
  if (change) _this->OnParamChange(idx);
}
Tale is offline   Reply With Quote
Old 01-23-2017, 03:56 AM   #8
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 193
Default

Quote:
Originally Posted by Tale View Post
I guess that means FL Studio is calling VSTSetParameter() from the GUI thread... ?

Anyway, maybe something like thid would work then (and hopefully also still work in other hosts):

Code:
void VSTCALLBACK IPlugVST::VSTSetParameter(AEffect *pEffect, VstInt32 idx, float value)
{
  Trace(TRACELOC, "%d:%f", idx, value);
  IPlugVST* _this = (IPlugVST*) pEffect->object;
  bool change = false;
  {
    IMutexLock lock(_this);
    if (idx >= 0 && idx < _this->NParams())
    {
      if (_this->GetGUI())
      {
        _this->GetGUI()->SetParameterFromPlug(idx, value, true);
      }
      _this->GetParam(idx)->SetNormalized(value);
      change = true;
    }
  }
  if (change) _this->OnParamChange(idx);
}
Nope! Tried your code but it crashes in the same way. Maybe he is suggesting "remove the lock" (i.e. outside the lock) before calling OnParamChange inside VSTSetParameter? Would this lead some other problems?

He also said this to me: The problem is that FL has its own big lock for processing and another lock when it responds to parameter changes. This probably leads to the deadlock..

Which is the same of IPlug locking concept, right? One for audio, one for GUI...
Nowhk is offline   Reply With Quote
Old 01-23-2017, 06:05 AM   #9
stw
Human being with feelings
 
Join Date: Apr 2012
Posts: 209
Default

Quote:
Originally Posted by Nowhk View Post
Nope, it also crashes there.
Try the attached file. Press Play and then tweak for a while another knob...
I tried and this one also works fine here. Though i can't hear any sound (i guess because it's done with a newer version of FL) automation is moving and i can't get it to crash.
Projects created with my installed version (FL 12.0.2 32 bit on WinXP) play fine (playing output) and don't crash with automated REFLEXplus as well.
stw is offline   Reply With Quote
Old 01-23-2017, 06:09 AM   #10
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 193
Default

Quote:
Originally Posted by stw View Post
I tried and this one also works fine here. Though i can't hear any sound (i guess because it's done with a newer version of FL) automation is moving and i can't get it to crash.
Projects created with my installed version (FL 12.0.2 32 bit on WinXP) play fine (playing output) and don't crash with automated REFLEXplus as well.
It doesn't crash if you do nothing while is automating. But tweak some other knob while it is playing, and will crash. Thats the problem, not the automation itself (which work fine alone).

If you don't get this, Ill making a video demostrating it...
Nowhk is offline   Reply With Quote
Old 01-23-2017, 06:28 AM   #11
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 193
Default

Here's the video:

http://www.fastswf.com/wG0vlKw
Nowhk is offline   Reply With Quote
Old 01-23-2017, 06:43 AM   #12
stw
Human being with feelings
 
Join Date: Apr 2012
Posts: 209
Default

Quote:
Originally Posted by Nowhk View Post
I already believed you without the vid
But however even with excessive tweaking the automated or other knobs doesn't crash here. I'll try to get a screen capture of it later...
stw is offline   Reply With Quote
Old 01-23-2017, 06:47 AM   #13
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 193
Default

Quote:
Originally Posted by stw View Post
I already believed you without the vid
But however even with excessive tweaking the automated or other knobs doesn't crash here. I'll try to get a screen capture of it later...
Can you upload the project you are using which doesn't crash? (created over Win XP I guess...)
Nowhk is offline   Reply With Quote
Old 01-23-2017, 02:05 PM   #14
stw
Human being with feelings
 
Join Date: Apr 2012
Posts: 209
Default

Quote:
Originally Posted by Nowhk View Post
Can you upload the project you are using which doesn't crash? (created over Win XP I guess...)
as i said, your's doesn't crash here either!
I just installed the actual FL12 demo on a virtual windows 7 machine. Your project opens without any alert, but still there's no audio output though all meters are acting and all audio settings are the same as on other working projects. So it's quite the same as on my other DAW. But i'm no FL expert anyway so maybe i'm missing something here.
Just to repeat myself... i couldn't create any crashes neither with any new project nor with the one you provided. But since there's the same muted output oddity i wonder if there might be something wrong with your FL installation?
stw is offline   Reply With Quote
Old 01-23-2017, 02:44 PM   #15
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: Holland
Posts: 2,789
Default

I wonder if 32 vs 64-bit has anything to do with this... I have seen some weird behavior with this before in FL Studio.
Tale is offline   Reply With Quote
Old 01-23-2017, 03:23 PM   #16
stw
Human being with feelings
 
Join Date: Apr 2012
Posts: 209
Default

Quote:
Originally Posted by Tale View Post
I wonder if 32 vs 64-bit has anything to do with this... I have seen some weird behavior with this before in FL Studio.
Yes maybe. My installations are all 32bit BTW
stw is offline   Reply With Quote
Old 01-24-2017, 03:30 AM   #17
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 193
Default

Quote:
Originally Posted by stw View Post
as i said, your's doesn't crash here either!
I just installed the actual FL12 demo on a virtual windows 7 machine. Your project opens without any alert, but still there's no audio output though all meters are acting and all audio settings are the same as on other working projects. So it's quite the same as on my other DAW. But i'm no FL expert anyway so maybe i'm missing something here.
I made that project while I was at work: the Master volume is all down, that's why you don't hear any audio:



Quote:
Originally Posted by stw View Post
Just to repeat myself... i couldn't create any crashes neither with any new project nor with the one you provided. But since there's the same muted output oddity i wonder if there might be something wrong with your FL installation?
I guess all is ok as installation, I use it since 2004! Either the one by the FL developer "reflex" (which crash IPlug as well).
Muted audio shouldn't matter at all, because it crash in both cases.

Not sure why you are not seeing this crash. It happens to all people I've asked to try. Maybe the way on which Win XP (or virtual machine) handle the GUI interactions. Or ASIO? Who knows! But trust me: it happens

Quote:
Originally Posted by Tale View Post
I wonder if 32 vs 64-bit has anything to do with this... I have seen some weird behavior with this before in FL Studio.
Tried both:

- FL Studio 12.4.1 32-Bit and Martinic Scanner Vibrato_v1.0.1 32 Bit
- FL Studio 12.4.1 64-Bit and Martinic Scanner Vibrato_v1.0.1 64 Bit

and its the same. Thus, I don't think is a 32-64 bit problem.
Nowhk is offline   Reply With Quote
Old 01-24-2017, 09:17 AM   #18
stw
Human being with feelings
 
Join Date: Apr 2012
Posts: 209
Default

Quote:
Originally Posted by Nowhk View Post
I made that project while I was at work: the Master volume is all down, that's why you don't hear any audio:

...haha so call me a FL noob.

Anyway, just to let you see it:

http://sendvid.com/rqfaxsgg

FL 12.4.1 32bit Win7
stw is offline   Reply With Quote
Old 01-24-2017, 09:28 AM   #19
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 193
Default

Quote:
Originally Posted by stw View Post
...haha so call me a FL noob.
No matter :P

Quote:
Originally Posted by stw View Post
FL 12.4.1 32bit Win7
Virtual machine?
Nowhk is offline   Reply With Quote
Old 01-24-2017, 09:39 AM   #20
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: Holland
Posts: 2,789
Default

BTW, lock/crash confirmed with FL Studio v12.2 (build 3) - 32Bit and Scanner Vibrato x86 on Win10 Pro x64. But I don't have time to look into this right now...
Tale is offline   Reply With Quote
Old 01-24-2017, 10:35 AM   #21
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 193
Default

Quote:
Originally Posted by Tale View Post
BTW, lock/crash confirmed with FL Studio v12.2 (build 3) - 32Bit and Scanner Vibrato x86 on Win10 Pro x64. But I don't have time to look into this right now...
Take your time and don't worry, I'll wait you
Nowhk is offline   Reply With Quote
Old 01-24-2017, 11:15 AM   #22
stw
Human being with feelings
 
Join Date: Apr 2012
Posts: 209
Default

Quote:
Originally Posted by Nowhk View Post
Virtual machine?
Yes...
stw is offline   Reply With Quote
Old 01-24-2017, 12:19 PM   #23
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 193
Default

Quote:
Originally Posted by stw View Post
Yes...
It could be how the VM handle the GUI. Can you test it on a real machine with real installation?
Nowhk is offline   Reply With Quote
Old 01-28-2017, 06:38 AM   #24
Youlean
Human being with feelings
 
Youlean's Avatar
 
Join Date: May 2015
Location: Serbia
Posts: 399
Default

There is definitely deadlock happening there. If you disable all mutexes it doesn't happen. I will investigate this.
Youlean is online now   Reply With Quote
Old 01-28-2017, 12:14 PM   #25
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 193
Default

Quote:
Originally Posted by Youlean View Post
There is definitely deadlock happening there. If you disable all mutexes it doesn't happen. I will investigate this.
Nice Can't believe nobody noticed this before. Maybe few IPlug developer test it on FL Studio.

However, yes, without locks the problem vanish, but this introduce some more problems
Nowhk is offline   Reply With Quote
Old 01-28-2017, 12:14 PM   #26
earlevel
Human being with feelings
 
Join Date: Dec 2015
Posts: 211
Default

Quote:
Originally Posted by Youlean View Post
There is definitely deadlock happening there. If you disable all mutexes it doesn't happen. I will investigate this.
Oh...maybe I should point out—since I said that my plugin doesn't hang—that I modified the mutex scheme a bit...

I think I pointed out in a thread a few months back (yes, here: http://forum.cockos.com/showthread.php?t=175123), that although the framework implies that OnParamChange needs to manage the lock, it's already locked before OnParamChange is called.

In my case, I needed to perform some brief muting while switching effects models, to avoid clicks, and needed to allow the audio thread to proceed—and it became obvious that I couldn't manage the lock. I modified IPlug to unlock before calling OnParamChange.

Maybe it was coded that way to avoid any chance of race conditions, but maybe that's the cause of your deadlock, somehow, perhaps tied to how FL Studio manages plugins and automation. One thing's for sure, if parameter change depends on any processing in the audio thread to continue, you will get a deadlock with stock IPlug.
earlevel is offline   Reply With Quote
Old 01-29-2017, 10:38 AM   #27
stw
Human being with feelings
 
Join Date: Apr 2012
Posts: 209
Default

Quote:
Originally Posted by Nowhk View Post
It could be how the VM handle the GUI. Can you test it on a real machine with real installation?
Meanwhile i installed FL12 on a "real" PC and can confirm the oddity...
stw is offline   Reply With Quote
Old 02-09-2017, 01:48 AM   #28
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 193
Default

I found why this happens on FL Studio (still not sure how to fix it though).

Check this: Notify about parameter changes - Normally this is on so FL Studio is notified precisely what plugin controls you have been touching, and the police can be alerted. This data is also used for Last tweaked parameter linking and the undo history (when 'General Settings > Undo knob tweaks' is selected). As some badly behaved plugins continuously send parameter change messages to FL Studio this will reset the 'Last tweaked parameter' value and make it impossible select and link some target of your choice.

If you disable this option, it will works without crash/deadlock.
Not sure why IPlug send continuously those CC midi message, if so.

Any idea?
Nowhk is offline   Reply With Quote
Old 03-17-2017, 12:50 PM   #29
Eeli
Human being with feelings
 
Join Date: Mar 2017
Posts: 1
Default

Hi! Any progress on this, anyone? I came across this issue just a few days ago so it was cool to find some discussion on it.

In my plugin (Windows 64-bit VST), I tried taking OnParamChange out of the lock as suggested here, to no effect. However, turning off the "Notify about parameter changes" in FL "resolved" the issue as Nowhk pointed out, so I made this change in IPlug:

Code:
void IPlugBase::SetParameterFromGUI(int idx, double normalizedValue)
{
/* // Original: 
  Trace(TRACELOC, "%d:%f", idx, normalizedValue);
  WDL_MutexLock lock(&mMutex);
  GetParam(idx)->SetNormalized(normalizedValue);
  InformHostOfParamChange(idx, normalizedValue);
  OnParamChange(idx);
  */

	Trace(TRACELOC, "%d:%f", idx, normalizedValue);
	{ WDL_MutexLock lock(&mMutex);
	GetParam(idx)->SetNormalized(normalizedValue);
	OnParamChange(idx);
	}
	InformHostOfParamChange(idx, normalizedValue);
}
That is, I took InformHostOfParamChange outside the lock, and now the plug seems to run smoothly in FL (haven't tried any other host!). Can someone tell me if and why this is a bad idea?
Eeli is offline   Reply With Quote
Old 03-20-2017, 05:27 AM   #30
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 193
Default

Nice try! Not even sure if this can introduce even more troubles. Any clues? I don't think this will lead any troubles, since there isn't audio sync between plug gui and DAW...
Nowhk 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 07:47 AM.


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