COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 04-04-2012, 01:16 AM   #1
olilarkin
Human being with feelings
 
olilarkin's Avatar
 
Join Date: Apr 2009
Location: Huddersfield, UK
Posts: 1,154
Default Threading etc.

So I am trying to get my head around the threading implications of IPlug, with a view to one day implementing some kind of non-blocking mechanism.

thinking aloud...

IPlugBase::mMutex is locked...

- during MyPlugin::ProcessDoubleReplacing()
- during MyPlugin::OnParamChange()
- during MyPlugin::Reset()

- whenever IPlugBase::SetParameterFromGUI() is called as a result of a call to IControl::SetDirty(true), i.e. whenever you interact with a control.

- (also behind the scenes when saving/restoring state) IPlugBase::SerializeParams() etc

IGraphics::mMutex is never locked at the moment since all the locking calls are commented out in the IGraphics methods.

I expect that the calls to IGraphics::SetControlFromPlug() and IGraphics::SetParameterFromPlug() from MyPlugin::ProcessDoubleReplacing() (or calls to IGraphics::HideControl() from MyPlugin::OnParamChange() ) are perhaps atomic on many machines(not sure about this). I guess Schwa decided it wasn't necessary to lock IGraphics::mMutex in order to prevent IGraphics:: Draw() trying to access data that was simultaneously being written by the processing thread. However, I suppose that if you want to share a larger chunk of data between audio and gui threads, it will be necessary for the IControl's Draw() method to obtain a lock on that data.

Whilst studying the IGraphics code I noticed IGraphics::SetParameterFromGUI() (as opposed to IPlugBase::SetParameterFromGUI() ) . Does anyone know what the following comment means?

Code:
// This is for when the gui needs to change a control value that it can't redraw 
// for context reasons.  If the gui has redrawn the control, use IPlug::SetParameterFromGUI.
what "context reasons". I don't think any of the stock IControls call IGraphics::SetParameterFromGUI()

oli
__________________
VirtualCZ | pMix | Endless Series | iPlug2 | Linkedin | Facebook
Available for Audio Dev tuition via Skype (IPlug/JUCE/C++)

Last edited by olilarkin; 04-04-2012 at 06:01 AM.
olilarkin 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 08:50 AM.


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