- port to minGw
git-svn-id: http://moon:8086/svn/software/trunk/projects/JaySynth@235 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
|
||||
Permission is granted to use this software under the terms of either:
|
||||
a) the GPL v2 (or any later version)
|
||||
b) the Affero GPL v3
|
||||
|
||||
Details of these licenses can be found at: www.gnu.org/licenses
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.juce.com for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
AudioPluginFormat::AudioPluginFormat() noexcept {}
|
||||
AudioPluginFormat::~AudioPluginFormat() {}
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
|
||||
Permission is granted to use this software under the terms of either:
|
||||
a) the GPL v2 (or any later version)
|
||||
b) the Affero GPL v3
|
||||
|
||||
Details of these licenses can be found at: www.gnu.org/licenses
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.juce.com for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef JUCE_AUDIOPLUGINFORMAT_H_INCLUDED
|
||||
#define JUCE_AUDIOPLUGINFORMAT_H_INCLUDED
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
The base class for a type of plugin format, such as VST, AudioUnit, LADSPA, etc.
|
||||
|
||||
@see AudioFormatManager
|
||||
*/
|
||||
class JUCE_API AudioPluginFormat
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Destructor. */
|
||||
virtual ~AudioPluginFormat();
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the format name.
|
||||
E.g. "VST", "AudioUnit", etc.
|
||||
*/
|
||||
virtual String getName() const = 0;
|
||||
|
||||
/** This tries to create descriptions for all the plugin types available in
|
||||
a binary module file.
|
||||
|
||||
The file will be some kind of DLL or bundle.
|
||||
|
||||
Normally there will only be one type returned, but some plugins
|
||||
(e.g. VST shells) can use a single DLL to create a set of different plugin
|
||||
subtypes, so in that case, each subtype is returned as a separate object.
|
||||
*/
|
||||
virtual void findAllTypesForFile (OwnedArray<PluginDescription>& results,
|
||||
const String& fileOrIdentifier) = 0;
|
||||
|
||||
/** Tries to recreate a type from a previously generated PluginDescription.
|
||||
@see PluginDescription::createInstance
|
||||
*/
|
||||
virtual AudioPluginInstance* createInstanceFromDescription (const PluginDescription& desc,
|
||||
double initialSampleRate,
|
||||
int initialBufferSize) = 0;
|
||||
|
||||
/** Should do a quick check to see if this file or directory might be a plugin of
|
||||
this format.
|
||||
|
||||
This is for searching for potential files, so it shouldn't actually try to
|
||||
load the plugin or do anything time-consuming.
|
||||
*/
|
||||
virtual bool fileMightContainThisPluginType (const String& fileOrIdentifier) = 0;
|
||||
|
||||
/** Returns a readable version of the name of the plugin that this identifier refers to. */
|
||||
virtual String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) = 0;
|
||||
|
||||
/** Returns true if this plugin's version or date has changed and it should be re-checked. */
|
||||
virtual bool pluginNeedsRescanning (const PluginDescription&) = 0;
|
||||
|
||||
/** Checks whether this plugin could possibly be loaded.
|
||||
It doesn't actually need to load it, just to check whether the file or component
|
||||
still exists.
|
||||
*/
|
||||
virtual bool doesPluginStillExist (const PluginDescription& desc) = 0;
|
||||
|
||||
/** Returns true if this format needs to run a scan to find its list of plugins. */
|
||||
virtual bool canScanForPlugins() const = 0;
|
||||
|
||||
/** Searches a suggested set of directories for any plugins in this format.
|
||||
The path might be ignored, e.g. by AUs, which are found by the OS rather
|
||||
than manually.
|
||||
*/
|
||||
virtual StringArray searchPathsForPlugins (const FileSearchPath& directoriesToSearch,
|
||||
bool recursive) = 0;
|
||||
|
||||
/** Returns the typical places to look for this kind of plugin.
|
||||
|
||||
Note that if this returns no paths, it means that the format doesn't search in
|
||||
files or folders, e.g. AudioUnits.
|
||||
*/
|
||||
virtual FileSearchPath getDefaultLocationsToSearch() = 0;
|
||||
|
||||
protected:
|
||||
//==============================================================================
|
||||
AudioPluginFormat() noexcept;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioPluginFormat)
|
||||
};
|
||||
|
||||
|
||||
#endif // JUCE_AUDIOPLUGINFORMAT_H_INCLUDED
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
|
||||
Permission is granted to use this software under the terms of either:
|
||||
a) the GPL v2 (or any later version)
|
||||
b) the Affero GPL v3
|
||||
|
||||
Details of these licenses can be found at: www.gnu.org/licenses
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.juce.com for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
AudioPluginFormatManager::AudioPluginFormatManager() {}
|
||||
AudioPluginFormatManager::~AudioPluginFormatManager() {}
|
||||
|
||||
//==============================================================================
|
||||
void AudioPluginFormatManager::addDefaultFormats()
|
||||
{
|
||||
#if JUCE_DEBUG
|
||||
// you should only call this method once!
|
||||
for (int i = formats.size(); --i >= 0;)
|
||||
{
|
||||
#if JUCE_PLUGINHOST_VST
|
||||
jassert (dynamic_cast <VSTPluginFormat*> (formats[i]) == nullptr);
|
||||
#endif
|
||||
|
||||
#if JUCE_PLUGINHOST_VST3
|
||||
jassert (dynamic_cast <VST3PluginFormat*> (formats[i]) == nullptr);
|
||||
#endif
|
||||
|
||||
#if JUCE_PLUGINHOST_AU && JUCE_MAC
|
||||
jassert (dynamic_cast <AudioUnitPluginFormat*> (formats[i]) == nullptr);
|
||||
#endif
|
||||
|
||||
#if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX
|
||||
jassert (dynamic_cast <LADSPAPluginFormat*> (formats[i]) == nullptr);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if JUCE_PLUGINHOST_AU && JUCE_MAC
|
||||
formats.add (new AudioUnitPluginFormat());
|
||||
#endif
|
||||
|
||||
#if JUCE_PLUGINHOST_VST
|
||||
formats.add (new VSTPluginFormat());
|
||||
#endif
|
||||
|
||||
#if JUCE_PLUGINHOST_VST3
|
||||
formats.add (new VST3PluginFormat());
|
||||
#endif
|
||||
|
||||
#if JUCE_PLUGINHOST_LADSPA && JUCE_LINUX
|
||||
formats.add (new LADSPAPluginFormat());
|
||||
#endif
|
||||
}
|
||||
|
||||
int AudioPluginFormatManager::getNumFormats()
|
||||
{
|
||||
return formats.size();
|
||||
}
|
||||
|
||||
AudioPluginFormat* AudioPluginFormatManager::getFormat (const int index)
|
||||
{
|
||||
return formats [index];
|
||||
}
|
||||
|
||||
void AudioPluginFormatManager::addFormat (AudioPluginFormat* const format)
|
||||
{
|
||||
formats.add (format);
|
||||
}
|
||||
|
||||
AudioPluginInstance* AudioPluginFormatManager::createPluginInstance (const PluginDescription& description, double rate,
|
||||
int blockSize, String& errorMessage) const
|
||||
{
|
||||
for (int i = 0; i < formats.size(); ++i)
|
||||
if (AudioPluginInstance* result = formats.getUnchecked(i)->createInstanceFromDescription (description, rate, blockSize))
|
||||
return result;
|
||||
|
||||
errorMessage = doesPluginStillExist (description) ? TRANS ("This plug-in failed to load correctly")
|
||||
: TRANS ("This plug-in file no longer exists");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool AudioPluginFormatManager::doesPluginStillExist (const PluginDescription& description) const
|
||||
{
|
||||
for (int i = 0; i < formats.size(); ++i)
|
||||
if (formats.getUnchecked(i)->getName() == description.pluginFormatName)
|
||||
return formats.getUnchecked(i)->doesPluginStillExist (description);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
|
||||
Permission is granted to use this software under the terms of either:
|
||||
a) the GPL v2 (or any later version)
|
||||
b) the Affero GPL v3
|
||||
|
||||
Details of these licenses can be found at: www.gnu.org/licenses
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.juce.com for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef JUCE_AUDIOPLUGINFORMATMANAGER_H_INCLUDED
|
||||
#define JUCE_AUDIOPLUGINFORMATMANAGER_H_INCLUDED
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
This maintains a list of known AudioPluginFormats.
|
||||
|
||||
@see AudioPluginFormat
|
||||
*/
|
||||
class JUCE_API AudioPluginFormatManager
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
AudioPluginFormatManager();
|
||||
|
||||
/** Destructor. */
|
||||
~AudioPluginFormatManager();
|
||||
|
||||
//==============================================================================
|
||||
/** Adds any formats that it knows about, e.g. VST.
|
||||
*/
|
||||
void addDefaultFormats();
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the number of types of format that are available.
|
||||
|
||||
Use getFormat() to get one of them.
|
||||
*/
|
||||
int getNumFormats();
|
||||
|
||||
/** Returns one of the available formats.
|
||||
|
||||
@see getNumFormats
|
||||
*/
|
||||
AudioPluginFormat* getFormat (int index);
|
||||
|
||||
//==============================================================================
|
||||
/** Adds a format to the list.
|
||||
|
||||
The object passed in will be owned and deleted by the manager.
|
||||
*/
|
||||
void addFormat (AudioPluginFormat* format);
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/** Tries to load the type for this description, by trying all the formats
|
||||
that this manager knows about.
|
||||
|
||||
The caller is responsible for deleting the object that is returned.
|
||||
|
||||
If it can't load the plugin, it returns nullptr and leaves a message in the
|
||||
errorMessage string.
|
||||
*/
|
||||
AudioPluginInstance* createPluginInstance (const PluginDescription& description,
|
||||
double initialSampleRate,
|
||||
int initialBufferSize,
|
||||
String& errorMessage) const;
|
||||
|
||||
/** Checks that the file or component for this plugin actually still exists.
|
||||
|
||||
(This won't try to load the plugin)
|
||||
*/
|
||||
bool doesPluginStillExist (const PluginDescription& description) const;
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
OwnedArray<AudioPluginFormat> formats;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioPluginFormatManager)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // JUCE_AUDIOPLUGINFORMATMANAGER_H_INCLUDED
|
||||
Reference in New Issue
Block a user