@@ -780,22 +780,17 @@ public: | |||||
if (effect != nullptr && effect->magic == kEffectMagic) | if (effect != nullptr && effect->magic == kEffectMagic) | ||||
{ | { | ||||
try | |||||
{ | |||||
#if JUCE_MAC | |||||
if (module->resFileId != 0) | |||||
UseResFile (module->resFileId); | |||||
#endif | |||||
#if JUCE_MAC | |||||
if (module->resFileId != 0) | |||||
UseResFile (module->resFileId); | |||||
#endif | |||||
// Must delete any editors before deleting the plugin instance! | |||||
jassert (getActiveEditor() == 0); | |||||
// Must delete any editors before deleting the plugin instance! | |||||
jassert (getActiveEditor() == 0); | |||||
_fpreset(); // some dodgy plugs fuck around with this | |||||
_fpreset(); // some dodgy plugs fuck around with this | |||||
module->closeEffect (effect); | |||||
} | |||||
catch (...) | |||||
{} | |||||
module->closeEffect (effect); | |||||
} | } | ||||
module = nullptr; | module = nullptr; | ||||
@@ -1052,36 +1047,21 @@ public: | |||||
jlimit (0, numSamples - 1, samplePosition)); | jlimit (0, numSamples - 1, samplePosition)); | ||||
} | } | ||||
try | |||||
{ | |||||
effect->dispatcher (effect, effProcessEvents, 0, 0, midiEventsToSend.events, 0); | |||||
} | |||||
catch (...) | |||||
{} | |||||
effect->dispatcher (effect, effProcessEvents, 0, 0, midiEventsToSend.events, 0); | |||||
} | } | ||||
_clearfp(); | _clearfp(); | ||||
if ((effect->flags & effFlagsCanReplacing) != 0) | if ((effect->flags & effFlagsCanReplacing) != 0) | ||||
{ | { | ||||
try | |||||
{ | |||||
effect->processReplacing (effect, buffer.getArrayOfChannels(), buffer.getArrayOfChannels(), numSamples); | |||||
} | |||||
catch (...) | |||||
{} | |||||
effect->processReplacing (effect, buffer.getArrayOfChannels(), buffer.getArrayOfChannels(), numSamples); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
tempBuffer.setSize (effect->numOutputs, numSamples); | tempBuffer.setSize (effect->numOutputs, numSamples); | ||||
tempBuffer.clear(); | tempBuffer.clear(); | ||||
try | |||||
{ | |||||
effect->process (effect, buffer.getArrayOfChannels(), tempBuffer.getArrayOfChannels(), numSamples); | |||||
} | |||||
catch (...) | |||||
{} | |||||
effect->process (effect, buffer.getArrayOfChannels(), tempBuffer.getArrayOfChannels(), numSamples); | |||||
for (int i = effect->numOutputs; --i >= 0;) | for (int i = effect->numOutputs; --i >= 0;) | ||||
buffer.copyFrom (i, 0, tempBuffer.getSampleData (i), numSamples); | buffer.copyFrom (i, 0, tempBuffer.getSampleData (i), numSamples); | ||||
@@ -1169,14 +1149,8 @@ public: | |||||
{ | { | ||||
if (effect != nullptr && isPositiveAndBelow (index, (int) effect->numParams)) | if (effect != nullptr && isPositiveAndBelow (index, (int) effect->numParams)) | ||||
{ | { | ||||
try | |||||
{ | |||||
const ScopedLock sl (lock); | |||||
return effect->getParameter (effect, index); | |||||
} | |||||
catch (...) | |||||
{ | |||||
} | |||||
const ScopedLock sl (lock); | |||||
return effect->getParameter (effect, index); | |||||
} | } | ||||
return 0.0f; | return 0.0f; | ||||
@@ -1186,16 +1160,10 @@ public: | |||||
{ | { | ||||
if (effect != nullptr && isPositiveAndBelow (index, (int) effect->numParams)) | if (effect != nullptr && isPositiveAndBelow (index, (int) effect->numParams)) | ||||
{ | { | ||||
try | |||||
{ | |||||
const ScopedLock sl (lock); | |||||
const ScopedLock sl (lock); | |||||
if (effect->getParameter (effect, index) != newValue) | |||||
effect->setParameter (effect, index, newValue); | |||||
} | |||||
catch (...) | |||||
{ | |||||
} | |||||
if (effect->getParameter (effect, index) != newValue) | |||||
effect->setParameter (effect, index, newValue); | |||||
} | } | ||||
} | } | ||||
@@ -1922,12 +1890,12 @@ class VSTPluginWindow : public AudioProcessorEditor, | |||||
{ | { | ||||
public: | public: | ||||
//============================================================================== | //============================================================================== | ||||
VSTPluginWindow (VSTPluginInstance& plugin_) | |||||
: AudioProcessorEditor (&plugin_), | |||||
VSTPluginWindow (VSTPluginInstance& plug) | |||||
: AudioProcessorEditor (&plug), | |||||
#if ! JUCE_MAC | #if ! JUCE_MAC | ||||
ComponentMovementWatcher (this), | ComponentMovementWatcher (this), | ||||
#endif | #endif | ||||
plugin (plugin_), | |||||
plugin (plug), | |||||
isOpen (false), | isOpen (false), | ||||
recursiveResize (false), | recursiveResize (false), | ||||
pluginWantsKeys (false), | pluginWantsKeys (false), | ||||
@@ -2085,7 +2053,6 @@ public: | |||||
if (--sizeCheckCount <= 0) | if (--sizeCheckCount <= 0) | ||||
{ | { | ||||
sizeCheckCount = 10; | sizeCheckCount = 10; | ||||
checkPluginWindowSize(); | checkPluginWindowSize(); | ||||
} | } | ||||
#endif | #endif | ||||
@@ -2108,6 +2075,8 @@ public: | |||||
//============================================================================== | //============================================================================== | ||||
void mouseDown (const MouseEvent& e) | void mouseDown (const MouseEvent& e) | ||||
{ | { | ||||
(void) e; | |||||
#if JUCE_LINUX | #if JUCE_LINUX | ||||
if (pluginWindow == 0) | if (pluginWindow == 0) | ||||
return; | return; | ||||
@@ -2130,8 +2099,6 @@ public: | |||||
sendEventToChild (&ev); | sendEventToChild (&ev); | ||||
#elif JUCE_WINDOWS | #elif JUCE_WINDOWS | ||||
(void) e; | |||||
toFront (true); | toFront (true); | ||||
#endif | #endif | ||||
} | } | ||||
@@ -2398,11 +2365,9 @@ private: | |||||
message, wParam, lParam); | message, wParam, lParam); | ||||
} | } | ||||
return CallWindowProc ((WNDPROC) (w->originalWndProc), | |||||
return CallWindowProc ((WNDPROC) w->originalWndProc, | |||||
(HWND) w->pluginHWND, | (HWND) w->pluginHWND, | ||||
message, | |||||
wParam, | |||||
lParam); | |||||
message, wParam, lParam); | |||||
} | } | ||||
} | } | ||||
@@ -2569,8 +2534,8 @@ private: | |||||
class InnerWrapperComponent : public CarbonViewWrapperComponent | class InnerWrapperComponent : public CarbonViewWrapperComponent | ||||
{ | { | ||||
public: | public: | ||||
InnerWrapperComponent (VSTPluginWindow& owner_) | |||||
: owner (owner_), alreadyInside (false) | |||||
InnerWrapperComponent (VSTPluginWindow& w) | |||||
: owner (w), alreadyInside (false) | |||||
{ | { | ||||
} | } | ||||
@@ -23,8 +23,8 @@ | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
AudioProcessorEditor::AudioProcessorEditor (AudioProcessor* const owner_) | |||||
: owner (owner_) | |||||
AudioProcessorEditor::AudioProcessorEditor (AudioProcessor* const p) | |||||
: owner (p) | |||||
{ | { | ||||
// the filter must be valid.. | // the filter must be valid.. | ||||
jassert (owner != nullptr); | jassert (owner != nullptr); | ||||
@@ -28,16 +28,16 @@ class ProcessorParameterPropertyComp : public PropertyComponent, | |||||
private Timer | private Timer | ||||
{ | { | ||||
public: | public: | ||||
ProcessorParameterPropertyComp (const String& name, AudioProcessor& owner_, const int index_) | |||||
ProcessorParameterPropertyComp (const String& name, AudioProcessor& p, const int index_) | |||||
: PropertyComponent (name), | : PropertyComponent (name), | ||||
owner (owner_), | |||||
owner (p), | |||||
index (index_), | index (index_), | ||||
paramHasChanged (false), | paramHasChanged (false), | ||||
slider (owner_, index_) | |||||
slider (p, index_) | |||||
{ | { | ||||
startTimer (100); | startTimer (100); | ||||
addAndMakeVisible (&slider); | addAndMakeVisible (&slider); | ||||
owner_.addListener (this); | |||||
owner.addListener (this); | |||||
} | } | ||||
~ProcessorParameterPropertyComp() | ~ProcessorParameterPropertyComp() | ||||
@@ -77,8 +77,8 @@ private: | |||||
class ParamSlider : public Slider | class ParamSlider : public Slider | ||||
{ | { | ||||
public: | public: | ||||
ParamSlider (AudioProcessor& owner_, const int index_) | |||||
: owner (owner_), | |||||
ParamSlider (AudioProcessor& p, const int index_) | |||||
: owner (p), | |||||
index (index_) | index (index_) | ||||
{ | { | ||||
setRange (0.0, 1.0, 0.0); | setRange (0.0, 1.0, 0.0); | ||||
@@ -118,26 +118,26 @@ private: | |||||
//============================================================================== | //============================================================================== | ||||
GenericAudioProcessorEditor::GenericAudioProcessorEditor (AudioProcessor* const owner_) | |||||
: AudioProcessorEditor (owner_) | |||||
GenericAudioProcessorEditor::GenericAudioProcessorEditor (AudioProcessor* const p) | |||||
: AudioProcessorEditor (p) | |||||
{ | { | ||||
jassert (owner_ != nullptr); | |||||
jassert (p != nullptr); | |||||
setOpaque (true); | setOpaque (true); | ||||
addAndMakeVisible (&panel); | addAndMakeVisible (&panel); | ||||
Array <PropertyComponent*> params; | Array <PropertyComponent*> params; | ||||
const int numParams = owner_->getNumParameters(); | |||||
const int numParams = p->getNumParameters(); | |||||
int totalHeight = 0; | int totalHeight = 0; | ||||
for (int i = 0; i < numParams; ++i) | for (int i = 0; i < numParams; ++i) | ||||
{ | { | ||||
String name (owner_->getParameterName (i)); | |||||
String name (p->getParameterName (i)); | |||||
if (name.trim().isEmpty()) | if (name.trim().isEmpty()) | ||||
name = "Unnamed"; | name = "Unnamed"; | ||||
ProcessorParameterPropertyComp* const pc = new ProcessorParameterPropertyComp (name, *owner_, i); | |||||
ProcessorParameterPropertyComp* const pc = new ProcessorParameterPropertyComp (name, *p, i); | |||||
params.add (pc); | params.add (pc); | ||||
totalHeight += pc->getPreferredHeight(); | totalHeight += pc->getPreferredHeight(); | ||||
} | } | ||||
@@ -644,7 +644,8 @@ ComponentPeer* Component::getPeer() const | |||||
{ | { | ||||
if (flags.hasHeavyweightPeerFlag) | if (flags.hasHeavyweightPeerFlag) | ||||
return ComponentPeer::getPeerFor (this); | return ComponentPeer::getPeerFor (this); | ||||
else if (parentComponent == nullptr) | |||||
if (parentComponent == nullptr) | |||||
return nullptr; | return nullptr; | ||||
return parentComponent->getPeer(); | return parentComponent->getPeer(); | ||||
@@ -1147,8 +1147,8 @@ public: | |||||
class AsyncRepaintMessage : public CallbackMessage | class AsyncRepaintMessage : public CallbackMessage | ||||
{ | { | ||||
public: | public: | ||||
AsyncRepaintMessage (NSViewComponentPeer* const peer_, const Rectangle<int>& rect_) | |||||
: peer (peer_), rect (rect_) | |||||
AsyncRepaintMessage (NSViewComponentPeer* const p, const Rectangle<int>& r) | |||||
: peer (p), rect (r) | |||||
{} | {} | ||||
void messageCallback() | void messageCallback() | ||||
@@ -98,9 +98,7 @@ public: | |||||
// Check for the plugin creating its own floating window, and if there is one, | // Check for the plugin creating its own floating window, and if there is one, | ||||
// we need to reparent it to make it visible.. | // we need to reparent it to make it visible.. | ||||
NSWindow* floatingChildWindow = [[carbonWindow childWindows] objectAtIndex: 0]; | |||||
if (floatingChildWindow != nil) | |||||
if (NSWindow* floatingChildWindow = [[carbonWindow childWindows] objectAtIndex: 0]) | |||||
[getOwnerWindow() addChildWindow: floatingChildWindow | [getOwnerWindow() addChildWindow: floatingChildWindow | ||||
ordered: NSWindowAbove]; | ordered: NSWindowAbove]; | ||||
@@ -112,7 +110,7 @@ public: | |||||
{ kEventClassMouse, kEventMouseDown }, | { kEventClassMouse, kEventMouseDown }, | ||||
{ kEventClassMouse, kEventMouseMoved }, | { kEventClassMouse, kEventMouseMoved }, | ||||
{ kEventClassMouse, kEventMouseDragged }, | { kEventClassMouse, kEventMouseDragged }, | ||||
{ kEventClassMouse, kEventMouseUp}, | |||||
{ kEventClassMouse, kEventMouseUp }, | |||||
{ kEventClassWindow, kEventWindowDrawContent }, | { kEventClassWindow, kEventWindowDrawContent }, | ||||
{ kEventClassWindow, kEventWindowShown }, | { kEventClassWindow, kEventWindowShown }, | ||||
{ kEventClassWindow, kEventWindowHidden } | { kEventClassWindow, kEventWindowHidden } | ||||
@@ -201,6 +199,18 @@ public: | |||||
wr.bottom = (short) (wr.top + getHeight()); | wr.bottom = (short) (wr.top + getHeight()); | ||||
SetWindowBounds (wrapperWindow, kWindowContentRgn, &wr); | SetWindowBounds (wrapperWindow, kWindowContentRgn, &wr); | ||||
// This group stuff is mainly a workaround for Mackie plugins like FinalMix.. | |||||
WindowGroupRef group = GetWindowGroup (wrapperWindow); | |||||
WindowRef attachedWindow; | |||||
if (GetIndexedWindow (group, 2, kWindowGroupContentsReturnWindows, &attachedWindow) == noErr) | |||||
{ | |||||
SelectWindow (attachedWindow); | |||||
ActivateWindow (attachedWindow, TRUE); | |||||
HideWindow (wrapperWindow); | |||||
} | |||||
ShowWindow (wrapperWindow); | ShowWindow (wrapperWindow); | ||||
} | } | ||||
@@ -269,7 +279,9 @@ public: | |||||
SetEventParameter (event, kEventParamClickActivation, typeClickActivationResult, | SetEventParameter (event, kEventParamClickActivation, typeClickActivationResult, | ||||
sizeof (ClickActivationResult), &howToHandleClick); | sizeof (ClickActivationResult), &howToHandleClick); | ||||
HIViewSetNeedsDisplay (embeddedView, true); | |||||
if (embeddedView != 0) | |||||
HIViewSetNeedsDisplay (embeddedView, true); | |||||
return noErr; | return noErr; | ||||
} | } | ||||
} | } | ||||