mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-22 01:34:21 +00:00
AudioPluginDemo fixes for AUv3 builds - don't add input bus and ensure that updateTrackProperties() is called on the message thread
This commit is contained in:
parent
ad241f8fec
commit
af6fc6b66a
1 changed files with 25 additions and 29 deletions
|
|
@ -176,10 +176,10 @@ class JuceDemoPluginAudioProcessor : public AudioProcessor
|
||||||
public:
|
public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
JuceDemoPluginAudioProcessor()
|
JuceDemoPluginAudioProcessor()
|
||||||
: AudioProcessor (getBusesProperties()),
|
: AudioProcessor (BusesProperties().withOutput ("Output", AudioChannelSet::stereo(), true)),
|
||||||
state (*this, nullptr, "state",
|
state (*this, nullptr, "state",
|
||||||
{ std::make_unique<AudioParameterFloat> ("gain", "Gain", NormalisableRange<float> (0.0f, 1.0f), 0.9f),
|
{ std::make_unique<AudioParameterFloat> ("gain", "Gain", NormalisableRange<float> (0.0f, 1.0f), 0.9f),
|
||||||
std::make_unique<AudioParameterFloat> ("delay", "Delay Feedback", NormalisableRange<float> (0.0f, 1.0f), 0.5f) })
|
std::make_unique<AudioParameterFloat> ("delay", "Delay Feedback", NormalisableRange<float> (0.0f, 1.0f), 0.5f) })
|
||||||
{
|
{
|
||||||
lastPosInfo.resetToDefault();
|
lastPosInfo.resetToDefault();
|
||||||
|
|
||||||
|
|
@ -194,20 +194,10 @@ public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
bool isBusesLayoutSupported (const BusesLayout& layouts) const override
|
bool isBusesLayoutSupported (const BusesLayout& layouts) const override
|
||||||
{
|
{
|
||||||
// Only mono/stereo and input/output must have same layout
|
|
||||||
const auto& mainOutput = layouts.getMainOutputChannelSet();
|
const auto& mainOutput = layouts.getMainOutputChannelSet();
|
||||||
const auto& mainInput = layouts.getMainInputChannelSet();
|
|
||||||
|
|
||||||
// input and output layout must either be the same or the input must be disabled altogether
|
// do not allow disabling the main output bus and only allow stereo and mono output
|
||||||
if (! mainInput.isDisabled() && mainInput != mainOutput)
|
if (mainOutput.isDisabled() || mainOutput.size() > 2)
|
||||||
return false;
|
|
||||||
|
|
||||||
// do not allow disabling the main buses
|
|
||||||
if (mainOutput.isDisabled())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// only allow stereo and mono
|
|
||||||
if (mainOutput.size() > 2)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -302,10 +292,22 @@ public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void updateTrackProperties (const TrackProperties& properties) override
|
void updateTrackProperties (const TrackProperties& properties) override
|
||||||
{
|
{
|
||||||
trackProperties = properties;
|
{
|
||||||
|
const ScopedLock sl (trackPropertiesLock);
|
||||||
|
trackProperties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
if (auto* editor = dynamic_cast<JuceDemoPluginAudioProcessorEditor*> (getActiveEditor()))
|
MessageManager::callAsync ([this]
|
||||||
editor->updateTrackProperties ();
|
{
|
||||||
|
if (auto* editor = dynamic_cast<JuceDemoPluginAudioProcessorEditor*> (getActiveEditor()))
|
||||||
|
editor->updateTrackProperties();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
TrackProperties getTrackProperties() const
|
||||||
|
{
|
||||||
|
const ScopedLock sl (trackPropertiesLock);
|
||||||
|
return trackProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
@ -324,9 +326,6 @@ public:
|
||||||
// Our plug-in's current state
|
// Our plug-in's current state
|
||||||
AudioProcessorValueTreeState state;
|
AudioProcessorValueTreeState state;
|
||||||
|
|
||||||
// Current track colour and name
|
|
||||||
TrackProperties trackProperties;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
/** This is the editor component that our filter will display. */
|
/** This is the editor component that our filter will display. */
|
||||||
|
|
@ -430,7 +429,7 @@ private:
|
||||||
|
|
||||||
void updateTrackProperties()
|
void updateTrackProperties()
|
||||||
{
|
{
|
||||||
auto trackColour = getProcessor().trackProperties.colour;
|
auto trackColour = getProcessor().getTrackProperties().colour;
|
||||||
auto& lf = getLookAndFeel();
|
auto& lf = getLookAndFeel();
|
||||||
|
|
||||||
backgroundColour = (trackColour == Colour() ? lf.findColour (ResizableWindow::backgroundColourId)
|
backgroundColour = (trackColour == Colour() ? lf.findColour (ResizableWindow::backgroundColourId)
|
||||||
|
|
@ -592,6 +591,9 @@ private:
|
||||||
|
|
||||||
Synthesiser synth;
|
Synthesiser synth;
|
||||||
|
|
||||||
|
CriticalSection trackPropertiesLock;
|
||||||
|
TrackProperties trackProperties;
|
||||||
|
|
||||||
void initialiseSynth()
|
void initialiseSynth()
|
||||||
{
|
{
|
||||||
auto numVoices = 8;
|
auto numVoices = 8;
|
||||||
|
|
@ -621,11 +623,5 @@ private:
|
||||||
lastPosInfo.resetToDefault();
|
lastPosInfo.resetToDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
static BusesProperties getBusesProperties()
|
|
||||||
{
|
|
||||||
return BusesProperties().withInput ("Input", AudioChannelSet::stereo(), true)
|
|
||||||
.withOutput ("Output", AudioChannelSet::stereo(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JuceDemoPluginAudioProcessor)
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JuceDemoPluginAudioProcessor)
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue