1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-29 02:40:05 +00:00

Standalone plug-in: Fixed a compile error for older macOS deployment targets

This commit is contained in:
hogliux 2017-05-31 10:51:09 +01:00 committed by tpoole
parent 810e11d96c
commit 1f40db45a5
2 changed files with 23 additions and 12 deletions

View file

@ -81,12 +81,16 @@ public:
virtual StandaloneFilterWindow* createWindow()
{
#ifdef JucePlugin_PreferredChannelConfigurations
StandalonePluginHolder::PluginInOuts channels[] = { JucePlugin_PreferredChannelConfigurations };
#endif
return new StandaloneFilterWindow (getApplicationName(),
LookAndFeel::getDefaultLookAndFeel().findColour (ResizableWindow::backgroundColourId),
appProperties.getUserSettings(),
false, {}, nullptr
#ifdef JucePlugin_PreferredChannelConfigurations
, { JucePlugin_PreferredChannelConfigurations }
, juce::Array<StandalonePluginHolder::PluginInOuts> (channels, juce::numElementsInArray (channels))
#endif
);
}

View file

@ -40,6 +40,10 @@ class StandalonePluginHolder : private AudioIODeviceCallback
#endif
{
public:
//==============================================================================
struct PluginInOuts { short numIns, numOuts; };
//==============================================================================
/** Creates an instance of the default plugin.
The settings object can be a PropertySet that the class should use to store its
@ -58,7 +62,7 @@ public:
bool takeOwnershipOfSettings = true,
const String& preferredDefaultDeviceName = String(),
const AudioDeviceManager::AudioDeviceSetup* preferredSetupOptions = nullptr,
const std::initializer_list<const short[2]>& constrainToConfiguration = {})
const Array<PluginInOuts>& constrainToConfiguration = Array<PluginInOuts>())
: settings (settingsToUse, takeOwnershipOfSettings),
channelConfiguration (constrainToConfiguration),
@ -100,10 +104,10 @@ public:
processor->disableNonMainBuses();
processor->setRateAndBufferSizeDetails (44100, 512);
int inChannels = (channelConfiguration.size() > 0 ? (*channelConfiguration.begin())[0]
int inChannels = (channelConfiguration.size() > 0 ? channelConfiguration[0].numIns
: processor->getMainBusNumInputChannels());
int outChannels = (channelConfiguration.size() > 0 ? (*channelConfiguration.begin())[1]
int outChannels = (channelConfiguration.size() > 0 ? channelConfiguration[0].numOuts
: processor->getMainBusNumOutputChannels());
processorHasPotentialFeedbackLoop = (inChannels > 0 && outChannels > 0);
@ -224,9 +228,9 @@ public:
if (channelConfiguration.size() > 0)
{
auto defaultConfig = *channelConfiguration.begin();
totalInChannels = defaultConfig[0];
totalOutChannels = defaultConfig[1];
auto defaultConfig = channelConfiguration.getReference (0);
totalInChannels = defaultConfig.numIns;
totalOutChannels = defaultConfig.numOuts;
}
o.content.setOwned (new SettingsComponent (*this, deviceManager,
@ -278,9 +282,9 @@ public:
if (channelConfiguration.size() > 0)
{
auto defaultConfig = *channelConfiguration.begin();
totalInChannels = defaultConfig[0];
totalOutChannels = defaultConfig[1];
auto defaultConfig = channelConfiguration.getReference (0);
totalInChannels = defaultConfig.numIns;
totalOutChannels = defaultConfig.numOuts;
}
deviceManager.initialise (totalInChannels,
@ -354,7 +358,7 @@ public:
ScopedPointer<AudioProcessor> processor;
AudioDeviceManager deviceManager;
AudioProcessorPlayer player;
std::initializer_list<const short[2]> channelConfiguration;
Array<PluginInOuts> channelConfiguration;
// avoid feedback loop by default
bool processorHasPotentialFeedbackLoop = true;
@ -532,6 +536,9 @@ class StandaloneFilterWindow : public DocumentWindow,
public ButtonListener // (can't use Button::Listener due to VC2005 bug)
{
public:
//==============================================================================
typedef StandalonePluginHolder::PluginInOuts PluginInOuts;
//==============================================================================
/** Creates a window with a given title and colour.
The settings object can be a PropertySet that the class should use to
@ -544,7 +551,7 @@ public:
bool takeOwnershipOfSettings,
const String& preferredDefaultDeviceName = String(),
const AudioDeviceManager::AudioDeviceSetup* preferredSetupOptions = nullptr,
const std::initializer_list<const short[2]>& constrainToConfiguration = {})
const Array<PluginInOuts>& constrainToConfiguration = Array<PluginInOuts> ())
: DocumentWindow (title, backgroundColour, DocumentWindow::minimiseButton | DocumentWindow::closeButton),
optionsButton ("Options")
{