From 35be6475bbb31b29cee75e96e95889b884d4dd05 Mon Sep 17 00:00:00 2001 From: Daniel Walz Date: Fri, 28 Jul 2023 12:48:44 +0200 Subject: [PATCH] Fixed Vanilla test --- .clang-format | 79 +++++++++++++++++++ Examples/Vanilla/Source/PluginProcessor.cpp | 18 ++++- Examples/Vanilla/Source/PluginProcessor.h | 10 +-- .../General/foleys_MagicProcessor.h | 2 + 4 files changed, 101 insertions(+), 8 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..dae6f733 --- /dev/null +++ b/.clang-format @@ -0,0 +1,79 @@ +--- +BasedOnStyle: WebKit +AccessModifierOffset: '-4' +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: 'true' +AlignConsecutiveAssignments: 'true' +AlignConsecutiveDeclarations: 'true' +AlignEscapedNewlines: Right +AlignOperands: 'true' +AlignTrailingComments: 'true' +AllowAllConstructorInitializersOnNextLine: 'true' +AllowAllParametersOfDeclarationOnNextLine: 'false' +AllowShortBlocksOnASingleLine: 'false' +AllowShortCaseLabelsOnASingleLine: 'true' +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: 'false' +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: 'false' +AlwaysBreakTemplateDeclarations: 'Yes' +BinPackArguments: 'true' +BinPackParameters: 'true' +BreakAfterJavaFieldAnnotations: 'false' +BreakBeforeBinaryOperators: NonAssignment +BreakBeforeBraces: Allman +BreakBeforeTernaryOperators: 'false' +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeComma +BreakStringLiterals: 'true' +ColumnLimit: '160' +CompactNamespaces: 'true' +ConstructorInitializerAllOnOneLineOrOnePerLine: 'true' +ConstructorInitializerIndentWidth: '2' +ContinuationIndentWidth: '2' +Cpp11BracedListStyle: 'false' +DerivePointerAlignment: 'false' +DisableFormat: 'false' +ExperimentalAutoDetectBinPacking: 'false' +FixNamespaceComments: 'true' +IncludeBlocks: Regroup +IndentCaseLabels: 'true' +IndentPPDirectives: BeforeHash +IndentWidth: '4' +IndentWrappedFunctionNames: 'true' +KeepEmptyLinesAtTheStartOfBlocks: 'true' +Language: Cpp +MaxEmptyLinesToKeep: '2' +NamespaceIndentation: None +PenaltyBreakBeforeFirstCallParameter: '100' +PenaltyBreakComment: '100' +PenaltyBreakFirstLessLess: '0' +PenaltyBreakString: '100' +PenaltyExcessCharacter: '1' +PenaltyReturnTypeOnItsOwnLine: '20' +PointerAlignment: Left +ReflowComments: 'false' +SortIncludes: 'true' +SortUsingDeclarations: 'true' +SpaceAfterCStyleCast: 'true' +SpaceAfterLogicalNot: 'false' +SpaceAfterTemplateKeyword: 'false' +SpaceBeforeAssignmentOperators: 'true' +SpaceBeforeCpp11BracedList: 'true' +SpaceBeforeCtorInitializerColon: 'true' +SpaceBeforeInheritanceColon: 'true' +SpaceBeforeParens: NonEmptyParentheses +SpaceBeforeRangeBasedForLoopColon: 'false' +SpaceInEmptyParentheses: 'false' +SpacesBeforeTrailingComments: '2' +SpacesInAngles: 'false' +SpacesInCStyleCastParentheses: 'false' +SpacesInContainerLiterals: 'false' +SpacesInSquareBrackets: 'false' +Standard: Auto +TabWidth: '4' +UseTab: Never + +... diff --git a/Examples/Vanilla/Source/PluginProcessor.cpp b/Examples/Vanilla/Source/PluginProcessor.cpp index 5da01fb2..6bdaeae8 100644 --- a/Examples/Vanilla/Source/PluginProcessor.cpp +++ b/Examples/Vanilla/Source/PluginProcessor.cpp @@ -1,12 +1,24 @@ #include "PluginProcessor.h" +VanillaAudioProcessor::VanillaAudioProcessor() + : foleys::MagicProcessor ( + juce::AudioProcessor::BusesProperties().withInput ("Intput", juce::AudioChannelSet::stereo(), true).withOutput ("Output", juce::AudioChannelSet::stereo(), true)) +{ +} +void VanillaAudioProcessor::processBlock (juce::AudioBuffer& buffer, juce::MidiBuffer&) +{ + for (int channel = getTotalNumInputChannels(); channel < getTotalNumOutputChannels(); ++channel) + buffer.clear (channel, 0, buffer.getNumChannels()); -VanillaAudioProcessor::VanillaAudioProcessor() : foleys::MagicProcessor(juce::AudioProcessor::BusesProperties() - .withOutput ("Output", juce::AudioChannelSet::stereo(), true)) -{} + buffer.clear(); +} +bool VanillaAudioProcessor::isBusesLayoutSupported (const juce::AudioProcessor::BusesLayout& layout) const +{ + return (layout.getMainInputChannelSet() == layout.getMainOutputChannelSet()); +} //============================================================================== // This creates new instances of the plugin.. diff --git a/Examples/Vanilla/Source/PluginProcessor.h b/Examples/Vanilla/Source/PluginProcessor.h index 40d81296..4f9a25d1 100644 --- a/Examples/Vanilla/Source/PluginProcessor.h +++ b/Examples/Vanilla/Source/PluginProcessor.h @@ -8,12 +8,12 @@ class VanillaAudioProcessor : public foleys::MagicProcessor public: VanillaAudioProcessor(); - void prepareToPlay ([[maybe_unused]]double sampleRate, [[maybe_unused]]int expectedNumSamples) override {} - void processBlock (juce::AudioBuffer&, juce::MidiBuffer&) override {} - void releaseResources() override {} + void prepareToPlay ([[maybe_unused]] double sampleRate, [[maybe_unused]] int expectedNumSamples) override { } + void processBlock (juce::AudioBuffer&, juce::MidiBuffer&) override; + void releaseResources() override { } - double getTailLengthSeconds() const override { return 0.0; } + bool isBusesLayoutSupported (const juce::AudioProcessor::BusesLayout& layout) const override; private: - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VanillaAudioProcessor) + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VanillaAudioProcessor) }; diff --git a/modules/foleys_gui_magic/General/foleys_MagicProcessor.h b/modules/foleys_gui_magic/General/foleys_MagicProcessor.h index 424d32ab..b43fad82 100644 --- a/modules/foleys_gui_magic/General/foleys_MagicProcessor.h +++ b/modules/foleys_gui_magic/General/foleys_MagicProcessor.h @@ -106,6 +106,8 @@ class MagicProcessor : public juce::AudioProcessor void getStateInformation (juce::MemoryBlock& destData) override; void setStateInformation (const void* data, int sizeInBytes) override; + double getTailLengthSeconds() const override { return 0.0; } + //============================================================================== int getNumPrograms() override { return 1; } int getCurrentProgram() override { return 0; }