2
0
Fork 0

Update juce_StandaloneFilterWindow.h

This commit is contained in:
George Reales 2021-05-05 19:52:29 +02:00
parent adb33c8c23
commit 16211dbfb2

View file

@ -2,17 +2,16 @@
============================================================================== ==============================================================================
This file is part of the JUCE library. This file is part of the JUCE library.
Copyright (c) 2017 - ROLI Ltd. Copyright (c) 2020 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source JUCE is an open source library subject to commercial or open-source
licensing. licensing.
By using JUCE, you agree to the terms of both the JUCE 5 End-User License By using JUCE, you agree to the terms of both the JUCE 6 End-User License
Agreement and JUCE 5 Privacy Policy (both updated and effective as of the Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
27th April 2017).
End User License Agreement: www.juce.com/juce-5-licence End User License Agreement: www.juce.com/juce-6-licence
Privacy Policy: www.juce.com/juce-5-privacy-policy Privacy Policy: www.juce.com/juce-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses). www.gnu.org/licenses).
@ -24,8 +23,10 @@
============================================================================== ==============================================================================
*/ */
#if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client #pragma once
extern juce::AudioProcessor* JUCE_API JUCE_CALLTYPE createPluginFilterOfType (juce::AudioProcessor::WrapperType type);
#ifndef DOXYGEN
#include "../utility/juce_CreatePluginFilter.h"
#endif #endif
namespace juce namespace juce
@ -73,7 +74,7 @@ public:
#if JUCE_ANDROID || JUCE_IOS #if JUCE_ANDROID || JUCE_IOS
bool shouldAutoOpenMidiDevices = true bool shouldAutoOpenMidiDevices = true
#else #else
bool shouldAutoOpenMidiDevices = true bool shouldAutoOpenMidiDevices = false
#endif #endif
) )
@ -123,15 +124,7 @@ public:
//============================================================================== //==============================================================================
virtual void createPlugin() virtual void createPlugin()
{ {
#if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client processor.reset (createPluginFilterOfType (AudioProcessor::wrapperType_Standalone));
processor.reset (::createPluginFilterOfType (AudioProcessor::wrapperType_Standalone));
#else
AudioProcessor::setTypeOfNextNewPlugin (AudioProcessor::wrapperType_Standalone);
processor.reset (createPluginFilter());
AudioProcessor::setTypeOfNextNewPlugin (AudioProcessor::wrapperType_Undefined);
#endif
jassert (processor != nullptr); // Your createPluginFilter() function must return a valid object!
processor->disableNonMainBuses(); processor->disableNonMainBuses();
processor->setRateAndBufferSizeDetails (44100, 512); processor->setRateAndBufferSizeDetails (44100, 512);
@ -272,12 +265,8 @@ public:
maxNumOutputs = jmax (0, bus->getDefaultLayout().size()); maxNumOutputs = jmax (0, bus->getDefaultLayout().size());
o.content.setOwned (new SettingsComponent (*this, deviceManager, maxNumInputs, maxNumOutputs)); o.content.setOwned (new SettingsComponent (*this, deviceManager, maxNumInputs, maxNumOutputs));
//#if JUCE_MAC
o.content->setSize (500, 400); o.content->setSize (500, 400);
//#endif
//#if ! JUCE_MAC
// o.content->setSize (500, 450);
//#endif
o.dialogTitle = TRANS("Audio/MIDI Settings"); o.dialogTitle = TRANS("Audio/MIDI Settings");
o.dialogBackgroundColour = o.content->getLookAndFeel().findColour (ResizableWindow::backgroundColourId); o.dialogBackgroundColour = o.content->getLookAndFeel().findColour (ResizableWindow::backgroundColourId);
o.escapeKeyTriggersCloseButton = true; o.escapeKeyTriggersCloseButton = true;
@ -376,7 +365,6 @@ public:
return false; return false;
} }
#if JUCE_MODULE_AVAILABLE_juce_gui_basics
Image getIAAHostIcon (int size) Image getIAAHostIcon (int size)
{ {
#if JUCE_IOS && JucePlugin_Enable_IAA #if JUCE_IOS && JucePlugin_Enable_IAA
@ -388,7 +376,6 @@ public:
return {}; return {};
} }
#endif
static StandalonePluginHolder* getInstance(); static StandalonePluginHolder* getInstance();
@ -423,7 +410,7 @@ private:
0, maxAudioInputChannels, 0, maxAudioInputChannels,
0, maxAudioOutputChannels, 0, maxAudioOutputChannels,
true, true,
false, // disables MIDI Out // (pluginHolder.processor.get() != nullptr && pluginHolder.processor->producesMidi()), (pluginHolder.processor.get() != nullptr && pluginHolder.processor->producesMidi()),
true, false), true, false),
shouldMuteLabel ("Feedback Loop:", "Feedback Loop:"), shouldMuteLabel ("Feedback Loop:", "Feedback Loop:"),
shouldMuteButton ("Mute audio input") shouldMuteButton ("Mute audio input")
@ -586,13 +573,13 @@ public:
#if JUCE_ANDROID || JUCE_IOS #if JUCE_ANDROID || JUCE_IOS
bool autoOpenMidiDevices = true bool autoOpenMidiDevices = true
#else #else
bool autoOpenMidiDevices = true bool autoOpenMidiDevices = false
#endif #endif
) )
: DocumentWindow ("", Colour::fromHSV (0.0f, 0.0f, 0.1f, 1.0f), DocumentWindow::minimiseButton | DocumentWindow::closeButton) : DocumentWindow (title, backgroundColour, DocumentWindow::minimiseButton | DocumentWindow::closeButton),
, menuBar(this) menuBar(this)
#if ! JUCE_MAC #if ! JUCE_MAC
, optionsButton ("Settings") , optionsButton ("Options")
#endif #endif
{ {
#if JUCE_IOS || JUCE_ANDROID #if JUCE_IOS || JUCE_ANDROID
@ -709,20 +696,7 @@ public:
void menuBarActivated (bool isActive) override {}; void menuBarActivated (bool isActive) override {};
void buttonClicked (Button*) override
{
pluginHolder->showAudioSettingsDialog();
// PopupMenu m;
// m.addItem (1, TRANS("Audio/MIDI Settings..."));
// m.addSeparator();
// m.addItem (2, TRANS("Save current state..."));
// m.addItem (3, TRANS("Load a saved state..."));
// m.addSeparator();
// m.addItem (4, TRANS("Reset to default state"));
// m.showMenuAsync (PopupMenu::Options(),ModalCallbackFunction::forComponent (menuCallback, this));
}
void handleMenuResult (int result) void handleMenuResult (int result)
{ {
@ -745,9 +719,9 @@ public:
void resized() override void resized() override
{ {
DocumentWindow::resized(); DocumentWindow::resized();
#if ! JUCE_MAC #if ! JUCE_MAC
optionsButton.setBounds (8, 6, 60, getTitleBarHeight() - 8); optionsButton.setBounds (8, 6, 60, getTitleBarHeight() - 8);
#endif #endif
} }
virtual StandalonePluginHolder* getPluginHolder() { return pluginHolder.get(); } virtual StandalonePluginHolder* getPluginHolder() { return pluginHolder.get(); }
@ -757,6 +731,22 @@ public:
PopupMenu menu; PopupMenu menu;
private: private:
void buttonClicked (Button*) override
{
pluginHolder->showAudioSettingsDialog();
//PopupMenu m;
//m.addItem (1, TRANS("Audio/MIDI Settings..."));
//m.addSeparator();
//m.addItem (2, TRANS("Save current state..."));
//m.addItem (3, TRANS("Load a saved state..."));
//m.addSeparator();
//m.addItem (4, TRANS("Reset to default state"));
//m.showMenuAsync (PopupMenu::Options(),
// ModalCallbackFunction::forComponent (menuCallback, this));
}
//============================================================================== //==============================================================================
class MainContentComponent : public Component, class MainContentComponent : public Component,
private Value::Listener, private Value::Listener,
@ -808,8 +798,9 @@ private:
notification.setBounds (r.removeFromTop (NotificationArea::height)); notification.setBounds (r.removeFromTop (NotificationArea::height));
if (editor != nullptr) if (editor != nullptr)
editor->setBounds (editor->getLocalArea (this, r) editor->setBounds (editor->getLocalArea (this, r.toFloat())
.withPosition (r.getTopLeft().transformedBy (editor->getTransform().inverted()))); .withPosition (r.getTopLeft().toFloat().transformedBy (editor->getTransform().inverted()))
.toNearestInt());
} }
private: private:
@ -919,9 +910,9 @@ private:
}; };
//============================================================================== //==============================================================================
#if ! JUCE_MAC #if ! JUCE_MAC
TextButton optionsButton; TextButton optionsButton;
#endif #endif
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StandaloneFilterWindow) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StandaloneFilterWindow)
}; };