@@ -780,22 +780,17 @@ public: | |||
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; | |||
@@ -1052,36 +1047,21 @@ public: | |||
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(); | |||
if ((effect->flags & effFlagsCanReplacing) != 0) | |||
{ | |||
try | |||
{ | |||
effect->processReplacing (effect, buffer.getArrayOfChannels(), buffer.getArrayOfChannels(), numSamples); | |||
} | |||
catch (...) | |||
{} | |||
effect->processReplacing (effect, buffer.getArrayOfChannels(), buffer.getArrayOfChannels(), numSamples); | |||
} | |||
else | |||
{ | |||
tempBuffer.setSize (effect->numOutputs, numSamples); | |||
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;) | |||
buffer.copyFrom (i, 0, tempBuffer.getSampleData (i), numSamples); | |||
@@ -1169,14 +1149,8 @@ public: | |||
{ | |||
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; | |||
@@ -1186,16 +1160,10 @@ public: | |||
{ | |||
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: | |||
//============================================================================== | |||
VSTPluginWindow (VSTPluginInstance& plugin_) | |||
: AudioProcessorEditor (&plugin_), | |||
VSTPluginWindow (VSTPluginInstance& plug) | |||
: AudioProcessorEditor (&plug), | |||
#if ! JUCE_MAC | |||
ComponentMovementWatcher (this), | |||
#endif | |||
plugin (plugin_), | |||
plugin (plug), | |||
isOpen (false), | |||
recursiveResize (false), | |||
pluginWantsKeys (false), | |||
@@ -2085,7 +2053,6 @@ public: | |||
if (--sizeCheckCount <= 0) | |||
{ | |||
sizeCheckCount = 10; | |||
checkPluginWindowSize(); | |||
} | |||
#endif | |||
@@ -2108,6 +2075,8 @@ public: | |||
//============================================================================== | |||
void mouseDown (const MouseEvent& e) | |||
{ | |||
(void) e; | |||
#if JUCE_LINUX | |||
if (pluginWindow == 0) | |||
return; | |||
@@ -2130,8 +2099,6 @@ public: | |||
sendEventToChild (&ev); | |||
#elif JUCE_WINDOWS | |||
(void) e; | |||
toFront (true); | |||
#endif | |||
} | |||
@@ -2398,11 +2365,9 @@ private: | |||
message, wParam, lParam); | |||
} | |||
return CallWindowProc ((WNDPROC) (w->originalWndProc), | |||
return CallWindowProc ((WNDPROC) w->originalWndProc, | |||
(HWND) w->pluginHWND, | |||
message, | |||
wParam, | |||
lParam); | |||
message, wParam, lParam); | |||
} | |||
} | |||
@@ -2569,8 +2534,8 @@ private: | |||
class InnerWrapperComponent : public CarbonViewWrapperComponent | |||
{ | |||
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.. | |||
jassert (owner != nullptr); | |||
@@ -28,16 +28,16 @@ class ProcessorParameterPropertyComp : public PropertyComponent, | |||
private Timer | |||
{ | |||
public: | |||
ProcessorParameterPropertyComp (const String& name, AudioProcessor& owner_, const int index_) | |||
ProcessorParameterPropertyComp (const String& name, AudioProcessor& p, const int index_) | |||
: PropertyComponent (name), | |||
owner (owner_), | |||
owner (p), | |||
index (index_), | |||
paramHasChanged (false), | |||
slider (owner_, index_) | |||
slider (p, index_) | |||
{ | |||
startTimer (100); | |||
addAndMakeVisible (&slider); | |||
owner_.addListener (this); | |||
owner.addListener (this); | |||
} | |||
~ProcessorParameterPropertyComp() | |||
@@ -77,8 +77,8 @@ private: | |||
class ParamSlider : public Slider | |||
{ | |||
public: | |||
ParamSlider (AudioProcessor& owner_, const int index_) | |||
: owner (owner_), | |||
ParamSlider (AudioProcessor& p, const int index_) | |||
: owner (p), | |||
index (index_) | |||
{ | |||
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); | |||
addAndMakeVisible (&panel); | |||
Array <PropertyComponent*> params; | |||
const int numParams = owner_->getNumParameters(); | |||
const int numParams = p->getNumParameters(); | |||
int totalHeight = 0; | |||
for (int i = 0; i < numParams; ++i) | |||
{ | |||
String name (owner_->getParameterName (i)); | |||
String name (p->getParameterName (i)); | |||
if (name.trim().isEmpty()) | |||
name = "Unnamed"; | |||
ProcessorParameterPropertyComp* const pc = new ProcessorParameterPropertyComp (name, *owner_, i); | |||
ProcessorParameterPropertyComp* const pc = new ProcessorParameterPropertyComp (name, *p, i); | |||
params.add (pc); | |||
totalHeight += pc->getPreferredHeight(); | |||
} | |||
@@ -644,7 +644,8 @@ ComponentPeer* Component::getPeer() const | |||
{ | |||
if (flags.hasHeavyweightPeerFlag) | |||
return ComponentPeer::getPeerFor (this); | |||
else if (parentComponent == nullptr) | |||
if (parentComponent == nullptr) | |||
return nullptr; | |||
return parentComponent->getPeer(); | |||
@@ -1147,8 +1147,8 @@ public: | |||
class AsyncRepaintMessage : public CallbackMessage | |||
{ | |||
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() | |||
@@ -98,9 +98,7 @@ public: | |||
// Check for the plugin creating its own floating window, and if there is one, | |||
// 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 | |||
ordered: NSWindowAbove]; | |||
@@ -112,7 +110,7 @@ public: | |||
{ kEventClassMouse, kEventMouseDown }, | |||
{ kEventClassMouse, kEventMouseMoved }, | |||
{ kEventClassMouse, kEventMouseDragged }, | |||
{ kEventClassMouse, kEventMouseUp}, | |||
{ kEventClassMouse, kEventMouseUp }, | |||
{ kEventClassWindow, kEventWindowDrawContent }, | |||
{ kEventClassWindow, kEventWindowShown }, | |||
{ kEventClassWindow, kEventWindowHidden } | |||
@@ -201,6 +199,18 @@ public: | |||
wr.bottom = (short) (wr.top + getHeight()); | |||
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); | |||
} | |||
@@ -269,7 +279,9 @@ public: | |||
SetEventParameter (event, kEventParamClickActivation, typeClickActivationResult, | |||
sizeof (ClickActivationResult), &howToHandleClick); | |||
HIViewSetNeedsDisplay (embeddedView, true); | |||
if (embeddedView != 0) | |||
HIViewSetNeedsDisplay (embeddedView, true); | |||
return noErr; | |||
} | |||
} | |||