Browse Source

Fixed VST hosting compile error. Stopped the ApplicationProperties class being a singleton - instead, just create and use an instance of it in your apps.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
2100e68adc
14 changed files with 64 additions and 100 deletions
  1. +4
    -3
      extras/audio plugin host/Source/FilterGraph.cpp
  2. +6
    -7
      extras/audio plugin host/Source/HostStartup.cpp
  3. +17
    -25
      extras/audio plugin host/Source/MainHostWindow.cpp
  4. +1
    -1
      extras/audio plugin host/Source/MainHostWindow.h
  5. +7
    -8
      juce_amalgamated.cpp
  6. +8
    -12
      juce_amalgamated.h
  7. +0
    -5
      src/application/juce_ApplicationProperties.cpp
  8. +5
    -11
      src/application/juce_ApplicationProperties.h
  9. +2
    -4
      src/audio/audio_file_formats/juce_AudioFormatManager.h
  10. +0
    -13
      src/audio/plugin_client/Standalone/juce_StandaloneFilterWindow.cpp
  11. +5
    -3
      src/audio/plugin_client/Standalone/juce_StandaloneFilterWindow.h
  12. +8
    -6
      src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp
  13. +1
    -1
      src/core/juce_StandardHeader.h
  14. +0
    -1
      src/text/juce_LocalisedStrings.h

+ 4
- 3
extras/audio plugin host/Source/FilterGraph.cpp View File

@@ -24,6 +24,7 @@
*/
#include "../JuceLibraryCode/JuceHeader.h"
#include "MainHostWindow.h"
#include "FilterGraph.h"
#include "InternalFilters.h"
#include "GraphEditorPanel.h"
@@ -265,7 +266,7 @@ const String FilterGraph::saveDocument (const File& file)
const File FilterGraph::getLastDocumentOpened()
{
RecentlyOpenedFilesList recentFiles;
recentFiles.restoreFromString (ApplicationProperties::getInstance()->getUserSettings()
recentFiles.restoreFromString (appProperties->getUserSettings()
->getValue ("recentFilterGraphFiles"));
return recentFiles.getFile (0);
@@ -274,12 +275,12 @@ const File FilterGraph::getLastDocumentOpened()
void FilterGraph::setLastDocumentOpened (const File& file)
{
RecentlyOpenedFilesList recentFiles;
recentFiles.restoreFromString (ApplicationProperties::getInstance()->getUserSettings()
recentFiles.restoreFromString (appProperties->getUserSettings()
->getValue ("recentFilterGraphFiles"));
recentFiles.addFile (file);
ApplicationProperties::getInstance()->getUserSettings()
appProperties->getUserSettings()
->setValue ("recentFilterGraphFiles", recentFiles.toString());
}


+ 6
- 7
extras/audio plugin host/Source/HostStartup.cpp View File

@@ -32,7 +32,8 @@
#endif
ApplicationCommandManager* commandManager = 0;
ApplicationCommandManager* commandManager = nullptr;
ApplicationProperties* appProperties = nullptr;
//==============================================================================
@@ -44,10 +45,6 @@ public:
{
}
~PluginHostApp()
{
}
void initialise (const String& commandLine)
{
// initialise our settings file..
@@ -57,7 +54,8 @@ public:
options.filenameSuffix = "settings";
options.osxLibrarySubFolder = "Preferences";
ApplicationProperties::getInstance()->setStorageParameters (options);
appProperties = new ApplicationProperties();
appProperties->setStorageParameters (options);
commandManager = new ApplicationCommandManager();
@@ -85,9 +83,10 @@ public:
void shutdown()
{
mainWindow = 0;
ApplicationProperties::getInstance()->closeFiles();
appProperties->closeFiles();
deleteAndZero (commandManager);
deleteAndZero (appProperties);
}
void systemRequestedQuit()


+ 17
- 25
extras/audio plugin host/Source/MainHostWindow.cpp View File

@@ -38,24 +38,24 @@ public:
{
currentPluginListWindow = this;
const File deadMansPedalFile (ApplicationProperties::getInstance()->getUserSettings()
const File deadMansPedalFile (appProperties->getUserSettings()
->getFile().getSiblingFile ("RecentlyCrashedPluginsList"));
setContentOwned (new PluginListComponent (knownPluginList,
deadMansPedalFile,
ApplicationProperties::getInstance()->getUserSettings()), true);
appProperties->getUserSettings()), true);
setResizable (true, false);
setResizeLimits (300, 400, 800, 1500);
setTopLeftPosition (60, 60);
restoreWindowStateFromString (ApplicationProperties::getInstance()->getUserSettings()->getValue ("listWindowPos"));
restoreWindowStateFromString (appProperties->getUserSettings()->getValue ("listWindowPos"));
setVisible (true);
}
~PluginListWindow()
{
ApplicationProperties::getInstance()->getUserSettings()->setValue ("listWindowPos", getWindowStateAsString());
appProperties->getUserSettings()->setValue ("listWindowPos", getWindowStateAsString());
clearContentComponent();
@@ -79,7 +79,7 @@ MainHostWindow::MainHostWindow()
: DocumentWindow (JUCEApplication::getInstance()->getApplicationName(), Colours::lightgrey,
DocumentWindow::allButtons)
{
XmlElement* const savedAudioState = ApplicationProperties::getInstance()->getUserSettings()
XmlElement* const savedAudioState = appProperties->getUserSettings()
->getXmlValue ("audioDeviceState");
deviceManager.initialise (256, 256, savedAudioState, true);
@@ -92,24 +92,19 @@ MainHostWindow::MainHostWindow()
setContentOwned (new GraphDocumentComponent (&deviceManager), false);
restoreWindowStateFromString (ApplicationProperties::getInstance()->getUserSettings()->getValue ("mainWindowPos"));
restoreWindowStateFromString (appProperties->getUserSettings()->getValue ("mainWindowPos"));
setVisible (true);
InternalPluginFormat internalFormat;
internalFormat.getAllTypes (internalTypes);
XmlElement* const savedPluginList = ApplicationProperties::getInstance()
->getUserSettings()
->getXmlValue ("pluginList");
ScopedPointer<XmlElement> savedPluginList (appProperties->getUserSettings()->getXmlValue ("pluginList"));
if (savedPluginList != 0)
{
if (savedPluginList != nullptr)
knownPluginList.recreateFromXml (*savedPluginList);
delete savedPluginList;
}
pluginSortMethod = (KnownPluginList::SortMethod) ApplicationProperties::getInstance()->getUserSettings()
pluginSortMethod = (KnownPluginList::SortMethod) appProperties->getUserSettings()
->getIntValue ("pluginSortMethod", KnownPluginList::sortByManufacturer);
knownPluginList.addChangeListener (this);
@@ -137,7 +132,7 @@ MainHostWindow::~MainHostWindow()
knownPluginList.removeChangeListener (this);
ApplicationProperties::getInstance()->getUserSettings()->setValue ("mainWindowPos", getWindowStateAsString());
appProperties->getUserSettings()->setValue ("mainWindowPos", getWindowStateAsString());
clearContentComponent();
}
@@ -168,12 +163,11 @@ void MainHostWindow::changeListenerCallback (ChangeBroadcaster*)
if (savedPluginList != 0)
{
ApplicationProperties::getInstance()->getUserSettings()
->setValue ("pluginList", savedPluginList);
appProperties->getUserSettings()->setValue ("pluginList", savedPluginList);
delete savedPluginList;
ApplicationProperties::getInstance()->saveIfNeeded();
appProperties->saveIfNeeded();
}
}
@@ -194,7 +188,7 @@ const PopupMenu MainHostWindow::getMenuForIndex (int topLevelMenuIndex, const St
menu.addCommandItem (commandManager, CommandIDs::open);
RecentlyOpenedFilesList recentFiles;
recentFiles.restoreFromString (ApplicationProperties::getInstance()->getUserSettings()
recentFiles.restoreFromString (appProperties->getUserSettings()
->getValue ("recentFilterGraphFiles"));
PopupMenu recentFilesMenu;
@@ -252,7 +246,7 @@ void MainHostWindow::menuItemSelected (int menuItemID, int /*topLevelMenuIndex*/
else if (menuItemID >= 100 && menuItemID < 200)
{
RecentlyOpenedFilesList recentFiles;
recentFiles.restoreFromString (ApplicationProperties::getInstance()->getUserSettings()
recentFiles.restoreFromString (appProperties->getUserSettings()
->getValue ("recentFilterGraphFiles"));
if (graphEditor != 0 && graphEditor->graph.saveIfNeededAndUserAgrees() == FileBasedDocument::savedOk)
@@ -271,8 +265,7 @@ void MainHostWindow::menuItemSelected (int menuItemID, int /*topLevelMenuIndex*/
else if (menuItemID == 204)
pluginSortMethod = KnownPluginList::sortByFileSystemLocation;
ApplicationProperties::getInstance()->getUserSettings()
->setValue ("pluginSortMethod", (int) pluginSortMethod);
appProperties->getUserSettings()->setValue ("pluginSortMethod", (int) pluginSortMethod);
}
else
{
@@ -447,12 +440,11 @@ void MainHostWindow::showAudioSettings()
XmlElement* const audioState = deviceManager.createStateXml();
ApplicationProperties::getInstance()->getUserSettings()
->setValue ("audioDeviceState", audioState);
appProperties->getUserSettings()->setValue ("audioDeviceState", audioState);
delete audioState;
ApplicationProperties::getInstance()->getUserSettings()->saveIfNeeded();
appProperties->getUserSettings()->saveIfNeeded();
GraphDocumentComponent* const graphEditor = getGraphEditor();


+ 1
- 1
extras/audio plugin host/Source/MainHostWindow.h View File

@@ -42,7 +42,7 @@ namespace CommandIDs
}
extern ApplicationCommandManager* commandManager;
extern ApplicationProperties* appProperties;
//==============================================================================
/**


+ 7
- 8
juce_amalgamated.cpp View File

@@ -19907,8 +19907,6 @@ END_JUCE_NAMESPACE
/*** Start of inlined file: juce_ApplicationProperties.cpp ***/
BEGIN_JUCE_NAMESPACE

juce_ImplementSingleton (ApplicationProperties)

ApplicationProperties::ApplicationProperties()
: commonSettingsAreReadOnly (0)
{
@@ -19917,7 +19915,6 @@ ApplicationProperties::ApplicationProperties()
ApplicationProperties::~ApplicationProperties()
{
closeFiles();
clearSingletonInstance();
}

void ApplicationProperties::setStorageParameters (const PropertiesFile::Options& newOptions)
@@ -34104,11 +34101,6 @@ END_JUCE_NAMESPACE
#else
#include <Cocoa/Cocoa.h>
#include <Carbon/Carbon.h>

static bool makeFSRefFromPath (FSRef* destFSRef, const String& path)
{
return FSPathMakeRef (reinterpret_cast <const UInt8*> (path.toUTF8().getAddress()), destFSRef, 0) == noErr;
}
#endif

#if ! (JUCE_MAC && JUCE_64BIT)
@@ -34119,6 +34111,13 @@ BEGIN_JUCE_NAMESPACE

#endif

#if JUCE_MAC
static bool makeFSRefFromPath (FSRef* destFSRef, const String& path)
{
return FSPathMakeRef (reinterpret_cast <const UInt8*> (path.toUTF8().getAddress()), destFSRef, 0) == noErr;
}
#endif

#undef PRAGMA_ALIGN_SUPPORTED
#define VST_FORCE_DEPRECATED 0



+ 8
- 12
juce_amalgamated.h View File

@@ -73,7 +73,7 @@ namespace JuceDummyNamespace {}
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 54
#define JUCE_BUILDNUMBER 20
#define JUCE_BUILDNUMBER 21

/** Current Juce version number.

@@ -35029,8 +35029,7 @@ private:
/**
Manages a collection of properties.

This is a slightly higher-level wrapper for PropertiesFile, which can be used
as a singleton.
This is a slightly higher-level wrapper for managing PropertiesFile objects.

It holds two different PropertiesFile objects internally, one for user-specific
settings (stored in your user directory), and one for settings that are common to
@@ -35040,13 +35039,13 @@ private:
getUserSettings() and getCommonSettings() methods. It also has a few handy
methods like testWriteAccess() to check that the files can be saved.

If you're using one of these as a singleton, then your app's start-up code should
first of all call setStorageParameters() to tell it the parameters to use to create
the properties files.
After creating an instance of an ApplicationProperties object, you should first
of all call setStorageParameters() to tell it the parameters to use to create
its files.

@see PropertiesFile
*/
class JUCE_API ApplicationProperties : public DeletedAtShutdown
class JUCE_API ApplicationProperties
{
public:

@@ -35061,8 +35060,6 @@ public:
/** Destructor. */
~ApplicationProperties();

juce_DeclareSingleton (ApplicationProperties, false);

/** Gives the object the information it needs to create the appropriate properties files.
See the PropertiesFile::Options class for details about what options you need to set.
*/
@@ -37272,9 +37269,8 @@ private:
A class for keeping a list of available audio formats, and for deciding which
one to use to open a given file.

You can either use this class as a singleton object, or create instances of it
yourself. Once created, use its registerFormat() method to tell it which
formats it should use.
After creating an AudioFormatManager object, you should call registerFormat()
or registerBasicFormats() to give it a list of format types that it can use.

@see AudioFormat
*/


+ 0
- 5
src/application/juce_ApplicationProperties.cpp View File

@@ -32,10 +32,6 @@ BEGIN_JUCE_NAMESPACE
#include "../text/juce_LocalisedStrings.h"
//==============================================================================
juce_ImplementSingleton (ApplicationProperties)
//==============================================================================
ApplicationProperties::ApplicationProperties()
: commonSettingsAreReadOnly (0)
@@ -45,7 +41,6 @@ ApplicationProperties::ApplicationProperties()
ApplicationProperties::~ApplicationProperties()
{
closeFiles();
clearSingletonInstance();
}
//==============================================================================


+ 5
- 11
src/application/juce_ApplicationProperties.h View File

@@ -27,8 +27,6 @@
#define __JUCE_APPLICATIONPROPERTIES_JUCEHEADER__
#include "../utilities/juce_PropertiesFile.h"
#include "../utilities/juce_DeletedAtShutdown.h"
#include "../core/juce_Singleton.h"
#include "../memory/juce_ScopedPointer.h"
@@ -36,8 +34,7 @@
/**
Manages a collection of properties.
This is a slightly higher-level wrapper for PropertiesFile, which can be used
as a singleton.
This is a slightly higher-level wrapper for managing PropertiesFile objects.
It holds two different PropertiesFile objects internally, one for user-specific
settings (stored in your user directory), and one for settings that are common to
@@ -47,13 +44,13 @@
getUserSettings() and getCommonSettings() methods. It also has a few handy
methods like testWriteAccess() to check that the files can be saved.
If you're using one of these as a singleton, then your app's start-up code should
first of all call setStorageParameters() to tell it the parameters to use to create
the properties files.
After creating an instance of an ApplicationProperties object, you should first
of all call setStorageParameters() to tell it the parameters to use to create
its files.
@see PropertiesFile
*/
class JUCE_API ApplicationProperties : public DeletedAtShutdown
class JUCE_API ApplicationProperties
{
public:
//==============================================================================
@@ -68,9 +65,6 @@ public:
/** Destructor. */
~ApplicationProperties();
//==============================================================================
juce_DeclareSingleton (ApplicationProperties, false);
//==============================================================================
/** Gives the object the information it needs to create the appropriate properties files.
See the PropertiesFile::Options class for details about what options you need to set.


+ 2
- 4
src/audio/audio_file_formats/juce_AudioFormatManager.h View File

@@ -27,7 +27,6 @@
#define __JUCE_AUDIOFORMATMANAGER_JUCEHEADER__
#include "juce_AudioFormat.h"
#include "../../core/juce_Singleton.h"
#include "../../containers/juce_OwnedArray.h"
@@ -36,9 +35,8 @@
A class for keeping a list of available audio formats, and for deciding which
one to use to open a given file.
You can either use this class as a singleton object, or create instances of it
yourself. Once created, use its registerFormat() method to tell it which
formats it should use.
After creating an AudioFormatManager object, you should call registerFormat()
or registerBasicFormats() to give it a list of format types that it can use.
@see AudioFormat
*/


+ 0
- 13
src/audio/plugin_client/Standalone/juce_StandaloneFilterWindow.cpp View File

@@ -217,19 +217,6 @@ void StandaloneFilterWindow::loadState()
}
//==============================================================================
PropertySet* StandaloneFilterWindow::getGlobalSettings()
{
/* If you want this class to store the plugin's settings, you can set up an
ApplicationProperties object and use this method as it is, or override this
method to return your own custom PropertySet.
If using this method without changing it, you'll probably need to call
ApplicationProperties::setStorageParameters() in your plugin's constructor to
tell it where to save the file.
*/
return ApplicationProperties::getInstance()->getUserSettings();
}
void StandaloneFilterWindow::showAudioSettingsDialog()
{
AudioDeviceSelectorComponent selectorComp (*deviceManager,


+ 5
- 3
src/audio/plugin_client/Standalone/juce_StandaloneFilterWindow.h View File

@@ -60,11 +60,13 @@ public:
/** Shows the audio properties dialog box modally. */
virtual void showAudioSettingsDialog();
/** Returns the property set to use for storing the app's last state.
/** Implement this method to return the property set that should be used for storing
the plugin's state.
This will be used to store the audio set-up and the filter's last state.
This will be used to store the audio set-up and the filter's last state. You may want
to return an ApplicationProperties object.
*/
virtual PropertySet* getGlobalSettings();
virtual PropertySet* getGlobalSettings() = 0;
//==============================================================================
/** @internal */


+ 8
- 6
src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp View File

@@ -52,11 +52,6 @@
#else
#include <Cocoa/Cocoa.h>
#include <Carbon/Carbon.h>
static bool makeFSRefFromPath (FSRef* destFSRef, const String& path)
{
return FSPathMakeRef (reinterpret_cast <const UInt8*> (path.toUTF8().getAddress()), destFSRef, 0) == noErr;
}
#endif
//==============================================================================
@@ -80,7 +75,14 @@ BEGIN_JUCE_NAMESPACE
#include "../../../application/juce_Application.h"
#if JUCE_MAC && JUCE_SUPPORT_CARBON
#include "../../../native/mac/juce_mac_CarbonViewWrapperComponent.h"
#include "../../../native/mac/juce_mac_CarbonViewWrapperComponent.h"
#endif
#if JUCE_MAC
static bool makeFSRefFromPath (FSRef* destFSRef, const String& path)
{
return FSPathMakeRef (reinterpret_cast <const UInt8*> (path.toUTF8().getAddress()), destFSRef, 0) == noErr;
}
#endif
//==============================================================================


+ 1
- 1
src/core/juce_StandardHeader.h View File

@@ -33,7 +33,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 54
#define JUCE_BUILDNUMBER 20
#define JUCE_BUILDNUMBER 21
/** Current Juce version number.


+ 0
- 1
src/text/juce_LocalisedStrings.h View File

@@ -27,7 +27,6 @@
#define __JUCE_LOCALISEDSTRINGS_JUCEHEADER__
#include "juce_StringPairArray.h"
#include "../core/juce_Singleton.h"
#include "../io/files/juce_File.h"


Loading…
Cancel
Save