1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Add a base clang-tidy configuration

This commit is contained in:
Tom Poole 2023-09-11 20:49:49 +01:00
parent 0dfaa98e86
commit 9b041f3d74
73 changed files with 484 additions and 279 deletions

View file

@ -85,7 +85,7 @@ public:
shouldMuteInput.addListener (this);
shouldMuteInput = ! isInterAppAudioConnected();
createPlugin();
handleCreatePlugin();
auto inChannels = (channelConfiguration.size() > 0 ? channelConfiguration[0].numIns
: processor->getMainBusNumInputChannels());
@ -117,24 +117,19 @@ public:
{
stopTimer();
deletePlugin();
handleDeletePlugin();
shutDownAudioDevices();
}
//==============================================================================
virtual void createPlugin()
{
processor = createPluginFilterOfType (AudioProcessor::wrapperType_Standalone);
processor->disableNonMainBuses();
processor->setRateAndBufferSizeDetails (44100, 512);
processorHasPotentialFeedbackLoop = (getNumInputChannels() > 0 && getNumOutputChannels() > 0);
handleCreatePlugin();
}
virtual void deletePlugin()
{
stopPlaying();
processor = nullptr;
handleDeletePlugin();
}
int getNumInputChannels() const
@ -428,6 +423,23 @@ public:
ScopedMessageBox messageBox;
private:
//==============================================================================
void handleCreatePlugin()
{
processor = createPluginFilterOfType (AudioProcessor::wrapperType_Standalone);
processor->disableNonMainBuses();
processor->setRateAndBufferSizeDetails (44100, 512);
processorHasPotentialFeedbackLoop = (getNumInputChannels() > 0 && getNumOutputChannels() > 0);
}
void handleDeletePlugin()
{
stopPlaying();
processor = nullptr;
}
//==============================================================================
/* This class can be used to ensure that audio callbacks use buffers with a
predictable maximum size.
@ -457,14 +469,14 @@ private:
}
void audioDeviceIOCallbackWithContext (const float* const* inputChannelData,
int numInputChannels,
[[maybe_unused]] int numInputChannels,
float* const* outputChannelData,
int numOutputChannels,
[[maybe_unused]] int numOutputChannels,
int numSamples,
const AudioIODeviceCallbackContext& context) override
{
jassertquiet ((int) storedInputChannels.size() == numInputChannels);
jassertquiet ((int) storedOutputChannels.size() == numOutputChannels);
jassert ((int) storedInputChannels.size() == numInputChannels);
jassert ((int) storedOutputChannels.size() == numOutputChannels);
int position = 0;
@ -901,7 +913,7 @@ private:
if (editor != nullptr)
{
editor->addComponentListener (this);
componentMovedOrResized (*editor, false, true);
handleMovedOrResized();
addAndMakeVisible (editor.get());
}
@ -929,20 +941,7 @@ private:
void resized() override
{
auto r = getLocalBounds();
if (shouldShowNotification)
notification.setBounds (r.removeFromTop (NotificationArea::height));
if (editor != nullptr)
{
const auto newPos = r.getTopLeft().toFloat().transformedBy (editor->getTransform().inverted());
if (preventResizingEditor)
editor->setTopLeftPosition (newPos.roundToInt());
else
editor->setBoundsConstrained (editor->getLocalArea (this, r.toFloat()).withPosition (newPos).toNearestInt());
}
handleResized();
}
ComponentBoundsConstrainer* getEditorConstrainer() const
@ -1023,7 +1022,7 @@ private:
notification.setVisible (shouldShowNotification);
#if JUCE_IOS || JUCE_ANDROID
resized();
handleResized();
#else
if (editor != nullptr)
{
@ -1045,7 +1044,25 @@ private:
}
//==============================================================================
void componentMovedOrResized (Component&, bool, bool) override
void handleResized()
{
auto r = getLocalBounds();
if (shouldShowNotification)
notification.setBounds (r.removeFromTop (NotificationArea::height));
if (editor != nullptr)
{
const auto newPos = r.getTopLeft().toFloat().transformedBy (editor->getTransform().inverted());
if (preventResizingEditor)
editor->setTopLeftPosition (newPos.roundToInt());
else
editor->setBoundsConstrained (editor->getLocalArea (this, r.toFloat()).withPosition (newPos).toNearestInt());
}
}
void handleMovedOrResized()
{
const ScopedValueSetter<bool> scope (preventResizingEditor, true);
@ -1058,6 +1075,11 @@ private:
}
}
void componentMovedOrResized (Component&, bool, bool) override
{
handleMovedOrResized();
}
Rectangle<int> getSizeToContainEditor() const
{
if (editor != nullptr)