From 16211dbfb24a754d2e5ba80f0e54dd5bc98eb67e Mon Sep 17 00:00:00 2001 From: George Reales Date: Wed, 5 May 2021 19:52:29 +0200 Subject: [PATCH] Update juce_StandaloneFilterWindow.h --- .../Standalone/juce_StandaloneFilterWindow.h | 91 +++++++++---------- 1 file changed, 41 insertions(+), 50 deletions(-) diff --git a/Modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h b/Modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h index 493aa86..636dd18 100644 --- a/Modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h +++ b/Modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h @@ -2,17 +2,16 @@ ============================================================================== 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 licensing. - By using JUCE, you agree to the terms of both the JUCE 5 End-User License - Agreement and JUCE 5 Privacy Policy (both updated and effective as of the - 27th April 2017). + By using JUCE, you agree to the terms of both the JUCE 6 End-User License + Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020). - End User License Agreement: www.juce.com/juce-5-licence - Privacy Policy: www.juce.com/juce-5-privacy-policy + End User License Agreement: www.juce.com/juce-6-licence + Privacy Policy: www.juce.com/juce-privacy-policy Or: You may also use this code under the terms of the GPL v3 (see www.gnu.org/licenses). @@ -24,8 +23,10 @@ ============================================================================== */ -#if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client -extern juce::AudioProcessor* JUCE_API JUCE_CALLTYPE createPluginFilterOfType (juce::AudioProcessor::WrapperType type); +#pragma once + +#ifndef DOXYGEN + #include "../utility/juce_CreatePluginFilter.h" #endif namespace juce @@ -73,7 +74,7 @@ public: #if JUCE_ANDROID || JUCE_IOS bool shouldAutoOpenMidiDevices = true #else - bool shouldAutoOpenMidiDevices = true + bool shouldAutoOpenMidiDevices = false #endif ) @@ -123,15 +124,7 @@ public: //============================================================================== virtual void createPlugin() { - #if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client - 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.reset (createPluginFilterOfType (AudioProcessor::wrapperType_Standalone)); processor->disableNonMainBuses(); processor->setRateAndBufferSizeDetails (44100, 512); @@ -272,12 +265,8 @@ public: maxNumOutputs = jmax (0, bus->getDefaultLayout().size()); o.content.setOwned (new SettingsComponent (*this, deviceManager, maxNumInputs, maxNumOutputs)); -//#if JUCE_MAC o.content->setSize (500, 400); -//#endif -//#if ! JUCE_MAC -// o.content->setSize (500, 450); -//#endif + o.dialogTitle = TRANS("Audio/MIDI Settings"); o.dialogBackgroundColour = o.content->getLookAndFeel().findColour (ResizableWindow::backgroundColourId); o.escapeKeyTriggersCloseButton = true; @@ -376,7 +365,6 @@ public: return false; } - #if JUCE_MODULE_AVAILABLE_juce_gui_basics Image getIAAHostIcon (int size) { #if JUCE_IOS && JucePlugin_Enable_IAA @@ -388,7 +376,6 @@ public: return {}; } - #endif static StandalonePluginHolder* getInstance(); @@ -423,7 +410,7 @@ private: 0, maxAudioInputChannels, 0, maxAudioOutputChannels, true, - false, // disables MIDI Out // (pluginHolder.processor.get() != nullptr && pluginHolder.processor->producesMidi()), + (pluginHolder.processor.get() != nullptr && pluginHolder.processor->producesMidi()), true, false), shouldMuteLabel ("Feedback Loop:", "Feedback Loop:"), shouldMuteButton ("Mute audio input") @@ -586,13 +573,13 @@ public: #if JUCE_ANDROID || JUCE_IOS bool autoOpenMidiDevices = true #else - bool autoOpenMidiDevices = true + bool autoOpenMidiDevices = false #endif ) - : DocumentWindow ("", Colour::fromHSV (0.0f, 0.0f, 0.1f, 1.0f), DocumentWindow::minimiseButton | DocumentWindow::closeButton) - , menuBar(this) + : DocumentWindow (title, backgroundColour, DocumentWindow::minimiseButton | DocumentWindow::closeButton), + menuBar(this) #if ! JUCE_MAC - , optionsButton ("Settings") + , optionsButton ("Options") #endif { #if JUCE_IOS || JUCE_ANDROID @@ -709,20 +696,7 @@ public: 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) { @@ -745,9 +719,9 @@ public: void resized() override { DocumentWindow::resized(); - #if ! JUCE_MAC + #if ! JUCE_MAC optionsButton.setBounds (8, 6, 60, getTitleBarHeight() - 8); - #endif + #endif } virtual StandalonePluginHolder* getPluginHolder() { return pluginHolder.get(); } @@ -757,6 +731,22 @@ public: PopupMenu menu; 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, private Value::Listener, @@ -808,8 +798,9 @@ private: notification.setBounds (r.removeFromTop (NotificationArea::height)); if (editor != nullptr) - editor->setBounds (editor->getLocalArea (this, r) - .withPosition (r.getTopLeft().transformedBy (editor->getTransform().inverted()))); + editor->setBounds (editor->getLocalArea (this, r.toFloat()) + .withPosition (r.getTopLeft().toFloat().transformedBy (editor->getTransform().inverted())) + .toNearestInt()); } private: @@ -919,9 +910,9 @@ private: }; //============================================================================== - #if ! JUCE_MAC + #if ! JUCE_MAC TextButton optionsButton; - #endif + #endif JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StandaloneFilterWindow) };