diff --git a/Editor/foleys_PropertiesEditor.cpp b/Editor/foleys_PropertiesEditor.cpp
index b81078e5..a151828c 100644
--- a/Editor/foleys_PropertiesEditor.cpp
+++ b/Editor/foleys_PropertiesEditor.cpp
@@ -179,7 +179,10 @@ void PropertiesEditor::createNewClass()
if (auto* editor = dlg.getTextEditor (editorID))
{
auto name = editor->getText().replaceCharacters (".&$@ ", "---__");
- builder.getStylesheet().addNewStyleClass (name, &undo);
+ auto newNode = builder.getStylesheet().addNewStyleClass (name, &undo);
+ auto index = newNode.getParent().indexOf (newNode);
+ updatePopupMenu();
+ nodeSelect.setSelectedId (3000 + index);
}
}
@@ -188,6 +191,7 @@ void PropertiesEditor::deleteClass (const juce::String& name)
auto& stylesheet = builder.getStylesheet();
stylesheet.deleteStyleClass (name, &undo);
builder.removeStyleClassReferences (builder.getGuiRootNode(), name);
+ updatePopupMenu();
}
//==============================================================================
diff --git a/Editor/foleys_StyleColourPropertyComponent.cpp b/Editor/foleys_StyleColourPropertyComponent.cpp
index f32d769f..05894481 100644
--- a/Editor/foleys_StyleColourPropertyComponent.cpp
+++ b/Editor/foleys_StyleColourPropertyComponent.cpp
@@ -254,9 +254,9 @@ juce::Colour StyleColourPropertyComponent::ColourPanel::ColourSelectorWithSwatch
return swatchColours [size_t (index)];
}
-void StyleColourPropertyComponent::ColourPanel::ColourSelectorWithSwatches::setSwatchColour (int index, const juce::Colour& colour)
+void StyleColourPropertyComponent::ColourPanel::ColourSelectorWithSwatches::setSwatchColour (int index, const juce::Colour& newColour)
{
- swatchColours [size_t (index)] = colour;
+ swatchColours [size_t (index)] = newColour;
}
void StyleColourPropertyComponent::ColourPanel::ColourSelectorWithSwatches::loadSwatches()
@@ -281,8 +281,8 @@ void StyleColourPropertyComponent::ColourPanel::ColourSelectorWithSwatches::save
coloursNode->deleteAllChildElements();
for (int i = 0; i < int (swatchColours.size()); ++i)
{
- auto* node = coloursNode->createNewChildElement (IDs::colour);
- node->addTextElement (swatchColours [size_t (i)].toDisplayString (true));
+ auto* colourNode = coloursNode->createNewChildElement (IDs::colour);
+ colourNode->addTextElement (swatchColours [size_t (i)].toDisplayString (true));
}
p->setValue (IDs::swatches, coloursNode.get());
diff --git a/Editor/foleys_StyleGradientPropertyComponent.cpp b/Editor/foleys_StyleGradientPropertyComponent.cpp
index 93e860ba..4ff5b29a 100644
--- a/Editor/foleys_StyleGradientPropertyComponent.cpp
+++ b/Editor/foleys_StyleGradientPropertyComponent.cpp
@@ -240,9 +240,9 @@ juce::Colour StyleGradientPropertyComponent::GradientPanel::ColourSelectorWithSw
return swatchColours [size_t (index)];
}
-void StyleGradientPropertyComponent::GradientPanel::ColourSelectorWithSwatches::setSwatchColour (int index, const juce::Colour& colour)
+void StyleGradientPropertyComponent::GradientPanel::ColourSelectorWithSwatches::setSwatchColour (int index, const juce::Colour& newColour)
{
- swatchColours [size_t (index)] = colour;
+ swatchColours [size_t (index)] = newColour;
}
void StyleGradientPropertyComponent::GradientPanel::ColourSelectorWithSwatches::loadSwatches()
@@ -267,8 +267,8 @@ void StyleGradientPropertyComponent::GradientPanel::ColourSelectorWithSwatches::
coloursNode->deleteAllChildElements();
for (int i = 0; i < int (swatchColours.size()); ++i)
{
- auto* node = coloursNode->createNewChildElement (IDs::colour);
- node->addTextElement (swatchColours [size_t (i)].toDisplayString (true));
+ auto* colourNode = coloursNode->createNewChildElement (IDs::colour);
+ colourNode->addTextElement (swatchColours [size_t (i)].toDisplayString (true));
}
p->setValue (IDs::swatches, coloursNode.get());
diff --git a/Editor/foleys_ToolBox.cpp b/Editor/foleys_ToolBox.cpp
index a3110c59..945adbe8 100644
--- a/Editor/foleys_ToolBox.cpp
+++ b/Editor/foleys_ToolBox.cpp
@@ -226,6 +226,7 @@ void ToolBox::stateWasReloaded()
treeEditor.updateTree();
propertiesEditor.setStyle (builder.getStylesheet().getCurrentStyle());
palette.update();
+ builder.updateComponents();
}
void ToolBox::paint (juce::Graphics& g)
@@ -361,9 +362,9 @@ juce::File ToolBox::getLastLocation() const
{
juce::File lastLocation;
- juce::ApplicationProperties properties;
- properties.setStorageParameters (ToolBox::getApplicationPropertyStorage());
- if (auto* p = properties.getUserSettings())
+ juce::ApplicationProperties appProperties;
+ appProperties.setStorageParameters (ToolBox::getApplicationPropertyStorage());
+ if (auto* p = appProperties.getUserSettings())
lastLocation = juce::File (p->getValue (IDs::lastLocation));
if (lastLocation.exists())
@@ -389,9 +390,9 @@ juce::File ToolBox::getLastLocation() const
void ToolBox::setLastLocation(juce::File file)
{
- juce::ApplicationProperties properties;
- properties.setStorageParameters (ToolBox::getApplicationPropertyStorage());
- if (auto* p = properties.getUserSettings())
+ juce::ApplicationProperties appProperties;
+ appProperties.setStorageParameters (ToolBox::getApplicationPropertyStorage());
+ if (auto* p = appProperties.getUserSettings())
p->setValue (IDs::lastLocation, file.getFullPathName());
}
diff --git a/General/foleys_MagicGUIBuilder.h b/General/foleys_MagicGUIBuilder.h
index 91d66021..b78f0e99 100644
--- a/General/foleys_MagicGUIBuilder.h
+++ b/General/foleys_MagicGUIBuilder.h
@@ -93,7 +93,7 @@ class MagicGUIBuilder : public juce::ChangeListener
void updateStylesheet();
/**
- Recreates all components from the
tree.
+ Recreates all components from the tree.
If no div tree is found, createDefaultGUITree is called to give subclasses
a chance to create a suitable default.
*/
diff --git a/General/foleys_MagicPluginEditor.cpp b/General/foleys_MagicPluginEditor.cpp
index 4aa39aca..bb94567c 100644
--- a/General/foleys_MagicPluginEditor.cpp
+++ b/General/foleys_MagicPluginEditor.cpp
@@ -43,44 +43,28 @@ MagicPluginEditor::MagicPluginEditor (MagicProcessorState& stateToUse, std::uniq
: juce::AudioProcessorEditor (*stateToUse.getProcessor()),
processorState (stateToUse),
builder (std::move (builderToUse))
-{
- initialise();
-}
-
-MagicPluginEditor::MagicPluginEditor (MagicProcessorState& stateToUse, const char* data, const int dataSize, std::unique_ptr builderToUse)
- : juce::AudioProcessorEditor (*stateToUse.getProcessor()),
- processorState (stateToUse),
- builder (std::move (builderToUse))
-{
- initialise (data, dataSize);
-}
-
-MagicPluginEditor::~MagicPluginEditor()
-{
-#if JUCE_MODULE_AVAILABLE_juce_opengl && FOLEYS_ENABLE_OPEN_GL_CONTEXT
- oglContext.detach();
-#endif
-}
-
-void MagicPluginEditor::initialise (const char* data, int dataSize)
{
#if JUCE_MODULE_AVAILABLE_juce_opengl && FOLEYS_ENABLE_OPEN_GL_CONTEXT
oglContext.attachTo (*this);
#endif
if (builder.get() == nullptr)
- builder = createBuilderInstance();
+ {
+ builder = std::make_unique(processorState);
+ builder->registerJUCEFactories();
+ builder->registerJUCELookAndFeels();
+ }
#if FOLEYS_SAVE_EDITED_GUI_IN_PLUGIN_STATE
auto guiTree = processorState.getValueTree().getChildWithName ("magic");
if (guiTree.isValid())
setConfigTree (guiTree);
- else if (data != nullptr)
- setConfigTree (data, dataSize);
else
builder->createGUI (*this);
#else // FOLEYS_SAVE_EDITED_GUI_IN_PLUGIN_STATE
auto guiTree = processorState.getGuiTree();
+ if (guiTree.isValid())
+ setConfigTree (guiTree);
#endif // FOLEYS_SAVE_EDITED_GUI_IN_PLUGIN_STATE
updateSize();
@@ -93,13 +77,11 @@ void MagicPluginEditor::initialise (const char* data, int dataSize)
#endif
}
-std::unique_ptr MagicPluginEditor::createBuilderInstance()
+MagicPluginEditor::~MagicPluginEditor()
{
- auto newBuilder = std::make_unique(processorState);
- newBuilder->registerJUCEFactories();
- newBuilder->registerJUCELookAndFeels();
-
- return newBuilder;
+#if JUCE_MODULE_AVAILABLE_juce_opengl && FOLEYS_ENABLE_OPEN_GL_CONTEXT
+ oglContext.detach();
+#endif
}
void MagicPluginEditor::updateSize()
@@ -121,10 +103,11 @@ void MagicPluginEditor::updateSize()
{
processorState.getLastEditorSize (width, height);
+ auto maximalBounds = juce::Desktop::getInstance().getDisplays().getTotalBounds (true);
int minWidth = rootNode.getProperty (IDs::minWidth, 10);
int minHeight = rootNode.getProperty (IDs::minHeight, 10);
- int maxWidth = rootNode.getProperty (IDs::maxWidth, std::numeric_limits::max());
- int maxHeight = rootNode.getProperty (IDs::maxHeight, std::numeric_limits::max());
+ int maxWidth = rootNode.getProperty (IDs::maxWidth, maximalBounds.getWidth());
+ int maxHeight = rootNode.getProperty (IDs::maxHeight, maximalBounds.getHeight());
setResizable (resizable, resizeCorner);
setResizeLimits (minWidth, minHeight, maxWidth, maxHeight);
}
@@ -146,13 +129,6 @@ void MagicPluginEditor::setConfigTree (const juce::ValueTree& gui)
updateSize();
}
-void MagicPluginEditor::setConfigTree (const char* data, int dataSize)
-{
- juce::String text (data, size_t (dataSize));
- auto gui = juce::ValueTree::fromXml (text);
- setConfigTree (gui);
-}
-
MagicGUIBuilder& MagicPluginEditor::getGUIBuilder()
{
// This shouldn't be possible, since the builder instance is created if none was supplied...
diff --git a/General/foleys_MagicPluginEditor.h b/General/foleys_MagicPluginEditor.h
index c8ec1220..8d3dfd0a 100644
--- a/General/foleys_MagicPluginEditor.h
+++ b/General/foleys_MagicPluginEditor.h
@@ -53,9 +53,6 @@ class MagicPluginEditor : public juce::AudioProcessorEditor,
*/
MagicPluginEditor (MagicProcessorState& processorState, std::unique_ptr builder = {});
- [[deprecated ("MagicPluginEditor will get the state from the processorState. Call processorState.setGuiValueTree() beforehand.")]]
- MagicPluginEditor (MagicProcessorState& processorState, const char* data, const int dataSize, std::unique_ptr builder = {});
-
~MagicPluginEditor() override;
/**
@@ -65,23 +62,6 @@ class MagicPluginEditor : public juce::AudioProcessorEditor,
*/
void setConfigTree (const juce::ValueTree& gui);
- /**
- Setup a GUI from a previously stored ValueTree. This is the
- usual way to deploy your finished GUI via the Projucer:
-
- @code{.cpp}
- AudioProcessorEditor* MyAudioProcessor::createEditor()
- {
- auto* editor = new foleys::MagicPluginEditor (magicState, BinaryData::magic_xml, BinaryData::magic_xmlSize);
- return editor;
- }
- @endcode
-
- @param data points to the binary data of the XML file
- @param dataSize the number of bytes
- */
- void setConfigTree (const char* data, int dataSize);
-
/**
Grants access to the MagicGUIBuilder
*/
@@ -92,10 +72,10 @@ class MagicPluginEditor : public juce::AudioProcessorEditor,
void resized() override;
private:
- void initialise (const char* data = nullptr, int dataSize = 0);
-
- std::unique_ptr createBuilderInstance();
+ /**
+ Setup the size and resizable and size limits
+ */
void updateSize();
#if JUCE_MODULE_AVAILABLE_juce_opengl && FOLEYS_ENABLE_OPEN_GL_CONTEXT
diff --git a/General/foleys_Resources.cpp b/General/foleys_Resources.cpp
index 60a85229..c0e8d97e 100644
--- a/General/foleys_Resources.cpp
+++ b/General/foleys_Resources.cpp
@@ -35,11 +35,19 @@
*/
+namespace BinaryDataFallbacks {
+const int namedResourceListSize = 0;
+const char** namedResourceList = nullptr;
+const char* getNamedResource(const char*, int&) { return nullptr; }
+} // namespace BinaryDataFallbacks
+
+namespace BinaryData {
+using namespace BinaryDataFallbacks;
+}
+
namespace foleys
{
-#if FOLEYS_ENABLE_BINARY_DATA
-
juce::StringArray Resources::getResourceFileNames()
{
juce::StringArray names;
@@ -60,11 +68,4 @@ juce::Image Resources::getImage (const juce::String& name)
return {};
}
-#else
-
-juce::StringArray Resources::getResourceFileNames() { return {}; }
-juce::Image Resources::getImage (const juce::String&) { return {}; }
-
-#endif
-
}
diff --git a/Layout/foleys_Decorator.cpp b/Layout/foleys_Decorator.cpp
index ab9ab52b..c5ebf36b 100644
--- a/Layout/foleys_Decorator.cpp
+++ b/Layout/foleys_Decorator.cpp
@@ -135,7 +135,7 @@ Decorator::ClientBounds Decorator::getClientBounds (juce::Rectangle overall
else
{
juce::Font f (captionSize * 0.8f);
- auto w = f.getStringWidth (caption);
+ auto w = float (f.getStringWidth (caption));
if (justification.getOnlyHorizontalFlags() & juce::Justification::left)
captionBox = box.removeFromLeft (w).toNearestInt();
diff --git a/Layout/foleys_GuiItem.cpp b/Layout/foleys_GuiItem.cpp
index 2f4fc9f0..6a1e53f3 100644
--- a/Layout/foleys_GuiItem.cpp
+++ b/Layout/foleys_GuiItem.cpp
@@ -46,6 +46,12 @@ GuiItem::GuiItem (MagicGUIBuilder& builder, juce::ValueTree node)
visibility.addListener (this);
configNode.addListener (this);
+ magicBuilder.getStylesheet().addListener (this);
+}
+
+GuiItem::~GuiItem()
+{
+ magicBuilder.getStylesheet().removeListener (this);
}
void GuiItem::setColourTranslation (std::vector> mapping)
@@ -85,8 +91,8 @@ void GuiItem::updateInternal()
{
auto& stylesheet = magicBuilder.getStylesheet();
- if (auto* lookAndFeel = stylesheet.getLookAndFeel (configNode))
- setLookAndFeel (lookAndFeel);
+ if (auto* newLookAndFeel = stylesheet.getLookAndFeel (configNode))
+ setLookAndFeel (newLookAndFeel);
decorator.configure (magicBuilder, configNode);
configureComponent();
@@ -97,6 +103,10 @@ void GuiItem::updateInternal()
update();
+#if FOLEYS_SHOW_GUI_EDITOR_PALLETTE
+ setEditMode (magicBuilder.isEditModeOn());
+#endif
+
repaint();
}
@@ -285,6 +295,17 @@ void GuiItem::valueTreePropertyChanged (juce::ValueTree& treeThatChanged, const
parent->updateInternal();
else
updateInternal();
+
+ return;
+ }
+
+ auto& stylesheet = magicBuilder.getStylesheet();
+ if (stylesheet.isClassNode (treeThatChanged))
+ {
+ auto name = treeThatChanged.getType().toString();
+ auto classes = configNode.getProperty (IDs::styleClass, juce::String()).toString();
+ if (classes.contains (name))
+ updateInternal();
}
}
@@ -374,10 +395,13 @@ void GuiItem::setEditMode (bool shouldEdit)
void GuiItem::setDraggable (bool selected)
{
- if (selected && getParentsLayoutType() == LayoutType::Contents)
+ if (selected &&
+ getParentsLayoutType() == LayoutType::Contents &&
+ configNode != magicBuilder.getGuiRootNode())
{
toFront (false);
borderDragger = std::make_unique(this, nullptr);
+ componentDragger = std::make_unique();
borderDragger->onDragStart = [&]
{
@@ -398,6 +422,7 @@ void GuiItem::setDraggable (bool selected)
else
{
borderDragger.reset();
+ componentDragger.reset();
}
}
@@ -424,20 +449,18 @@ void GuiItem::savePosition ()
void GuiItem::mouseDown (const juce::MouseEvent& event)
{
- magicBuilder.setSelectedNode (configNode);
-
- if (getParentsLayoutType() == LayoutType::Contents)
+ if (componentDragger)
{
magicBuilder.getUndoManager().beginNewTransaction ("Drag component position");
- componentDragger.startDraggingComponent (this, event);
+ componentDragger->startDraggingComponent (this, event);
}
}
void GuiItem::mouseDrag (const juce::MouseEvent& event)
{
- if (getParentsLayoutType() == LayoutType::Contents)
+ if (componentDragger)
{
- componentDragger.dragComponent (this, event, nullptr);
+ componentDragger->dragComponent (this, event, nullptr);
savePosition();
}
else if (event.mouseWasDraggedSinceMouseDown())
@@ -446,6 +469,13 @@ void GuiItem::mouseDrag (const juce::MouseEvent& event)
container->startDragging (IDs::dragSelected, this);
}
}
+
+void GuiItem::mouseUp (const juce::MouseEvent& event)
+{
+ if (! event.mouseWasDraggedSinceMouseDown())
+ magicBuilder.setSelectedNode (configNode);
+}
+
#endif
bool GuiItem::isInterestedInDragSource (const juce::DragAndDropTarget::SourceDetails &)
diff --git a/Layout/foleys_GuiItem.h b/Layout/foleys_GuiItem.h
index a94c6d23..6b3a576d 100644
--- a/Layout/foleys_GuiItem.h
+++ b/Layout/foleys_GuiItem.h
@@ -56,6 +56,7 @@ class GuiItem : public juce::Component,
{
public:
GuiItem (MagicGUIBuilder& builder, juce::ValueTree node);
+ ~GuiItem() override;
/**
Allows accessing the Component inside that GuiItem. Don't keep this pointer!
@@ -176,6 +177,7 @@ class GuiItem : public juce::Component,
void mouseDown (const juce::MouseEvent& event) override;
void mouseDrag (const juce::MouseEvent& event) override;
+ void mouseUp (const juce::MouseEvent& event) override;
#endif
@@ -223,8 +225,8 @@ class GuiItem : public juce::Component,
private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BorderDragger)
};
- std::unique_ptr borderDragger;
- juce::ComponentDragger componentDragger;
+ std::unique_ptr borderDragger;
+ std::unique_ptr componentDragger;
void valueChanged (juce::Value& source) override;
diff --git a/Layout/foleys_Stylesheet.cpp b/Layout/foleys_Stylesheet.cpp
index fdf08386..7984d494 100644
--- a/Layout/foleys_Stylesheet.cpp
+++ b/Layout/foleys_Stylesheet.cpp
@@ -397,6 +397,16 @@ juce::StringArray Stylesheet::getAllClassesNames() const
return names;
}
+void Stylesheet::addListener (juce::ValueTree::Listener* listener)
+{
+ currentStyle.addListener (listener);
+}
+
+void Stylesheet::removeListener (juce::ValueTree::Listener* listener)
+{
+ currentStyle.removeListener (listener);
+}
+
//==============================================================================
Stylesheet::StyleClass::StyleClass (juce::ValueTree style)
diff --git a/Layout/foleys_Stylesheet.h b/Layout/foleys_Stylesheet.h
index 6f3a00c3..64275e49 100644
--- a/Layout/foleys_Stylesheet.h
+++ b/Layout/foleys_Stylesheet.h
@@ -170,6 +170,9 @@ class Stylesheet : private juce::ValueTree::Listener
bool isIdNode (const juce::ValueTree& node) const;
bool isColourPaletteNode (const juce::ValueTree& node) const;
+ void addListener (juce::ValueTree::Listener* listener);
+ void removeListener (juce::ValueTree::Listener* listener);
+
private:
void valueTreePropertyChanged (juce::ValueTree&, const juce::Identifier&) override;
diff --git a/State/foleys_MagicProcessorState.cpp b/State/foleys_MagicProcessorState.cpp
index e4ac4de3..869a9a8e 100644
--- a/State/foleys_MagicProcessorState.cpp
+++ b/State/foleys_MagicProcessorState.cpp
@@ -142,11 +142,11 @@ bool MagicProcessorState::getLastEditorSize (int& width, int& height)
void MagicProcessorState::getStateInformation (juce::MemoryBlock& destData)
{
- auto state = getValueTree();
- parameters.saveParameterValues (state);
+ auto newState = getValueTree();
+ parameters.saveParameterValues (newState);
juce::MemoryOutputStream stream (destData, false);
- state.writeToStream (stream);
+ newState.writeToStream (stream);
}
void MagicProcessorState::setStateInformation (const void* data, int sizeInBytes, juce::AudioProcessorEditor* editor)
@@ -155,13 +155,13 @@ void MagicProcessorState::setStateInformation (const void* data, int sizeInBytes
if (tree.isValid() == false)
return;
- auto state = getValueTree();
- if (state.getType() != tree.getType())
+ auto newState = getValueTree();
+ if (newState.getType() != tree.getType())
return;
- state.copyPropertiesAndChildrenFrom (tree, nullptr);
+ newState.copyPropertiesAndChildrenFrom (tree, nullptr);
- parameters.loadParameterValues (state);
+ parameters.loadParameterValues (newState);
if (editor)
{
diff --git a/VERSION.md b/VERSION.md
index a7dc3715..7155d24b 100644
--- a/VERSION.md
+++ b/VERSION.md
@@ -1,9 +1,20 @@
PluginGuiMagic - Versions history
================================
-1.3.1
+1.3.2
-----
+- New components respect current edit mode
+- Fixed accidently draggable components
+- Allow dragging of groups (instead of selecting the child)
+- Fixed setup when FOLEYS_SAVE_EDITED_GUI_IN_PLUGIN_STATE is off
+- Don't need BinaryData config switch any longer
+- Fixed creation of CSS classes and update when a property there changes
+- Changed Analyser to use ballistics rather than rolling average
+
+1.3.1 - 21.03.2021
+------------------
+
- Added options to specify position and size relative or absolute to the parent component
- Allow the selected component in a Contents to be draggable
- Add a switch to disable storing the tree in the plugin state
diff --git a/Visualisers/foleys_MagicAnalyser.cpp b/Visualisers/foleys_MagicAnalyser.cpp
index 797c4c29..446beec5 100644
--- a/Visualisers/foleys_MagicAnalyser.cpp
+++ b/Visualisers/foleys_MagicAnalyser.cpp
@@ -126,8 +126,7 @@ void MagicAnalyser::AnalyserJob::setupAnalyser (int audioFifoSize)
abstractFifo.setTotalSize (audioFifoSize);
audioFifo.clear();
- averager.clear();
- averagerPtr = 1;
+ values.clear();
}
void MagicAnalyser::AnalyserJob::pushSamples (const juce::AudioBuffer& buffer, int inChannel)
@@ -180,16 +179,21 @@ int MagicAnalyser::AnalyserJob::useTimeSlice()
{
juce::ScopedLock lockedForWriting (owner.pathCreationLock);
- auto factor = 1.0f / averager.getNumSamples();
- if (averager.getNumChannels() > 2)
- factor = factor / (averager.getNumChannels() - 1.0f);
+ const auto factor = 1.0f / fft.getSize();
+ const auto decay = 0.8f; // FIXME: calculate by fft size and sampleRate
+ const auto* read = fftBuffer.getReadPointer (0);
+ auto* write = values.getWritePointer (0);
- averager.copyFrom (averagerPtr, 0, fftBuffer.getReadPointer (0), averager.getNumSamples(), factor);
- if (++averagerPtr == averager.getNumChannels()) averagerPtr = 1;
-
- averager.copyFrom (0, 0, averager.getReadPointer (1), averager.getNumSamples());
- for (int i = 2; i < averager.getNumChannels(); ++i)
- averager.addFrom (0, 0, averager.getReadPointer (i), averager.getNumSamples());
+ for (int i=0; i < values.getNumSamples(); ++i, ++read, ++write)
+ {
+ auto v = *read * factor;
+ if (v >= *write)
+ *write = v;
+ else if (v < 1.12202e-05f)
+ *write = 0.0f;
+ else
+ *write = *write * decay;
+ }
owner.resetLastDataFlag();
}
@@ -199,7 +203,7 @@ int MagicAnalyser::AnalyserJob::useTimeSlice()
const juce::AudioBuffer MagicAnalyser::AnalyserJob::getAnalyserData() const
{
- return averager;
+ return values;
}
diff --git a/Visualisers/foleys_MagicAnalyser.h b/Visualisers/foleys_MagicAnalyser.h
index b8bcee9b..e9040a15 100644
--- a/Visualisers/foleys_MagicAnalyser.h
+++ b/Visualisers/foleys_MagicAnalyser.h
@@ -111,8 +111,7 @@ class MagicAnalyser : public MagicPlotSource
juce::dsp::WindowingFunction windowing { size_t (fft.getSize()), juce::dsp::WindowingFunction::hann, true };
juce::AudioBuffer fftBuffer { 1, fft.getSize() * 2 };
- juce::AudioBuffer averager { 5, fft.getSize() / 2 };
- int averagerPtr = 1;
+ juce::AudioBuffer values { 1, fft.getSize() / 2 };
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AnalyserJob)
};
diff --git a/foleys_gui_magic.h b/foleys_gui_magic.h
index e4c6d4f1..727ba6e1 100644
--- a/foleys_gui_magic.h
+++ b/foleys_gui_magic.h
@@ -37,7 +37,7 @@
ID: foleys_gui_magic
vendor: Foleys Finest Audio
- version: 1.3.1
+ version: 1.3.2
name: Foleys GUI magic
description: This module allows to create GUI with a drag and drop editor
dependencies: juce_core, juce_audio_basics, juce_audio_devices, juce_audio_formats,
@@ -69,14 +69,6 @@
#define FOLEYS_SAVE_EDITED_GUI_IN_PLUGIN_STATE 1
#endif
-/** Config: FOLEYS_ENABLE_BINARY_DATA
- Makes the binary resources available to the GUI. Make sure you actually have
- at least one file added, or this will fail to compile.
- */
-#ifndef FOLEYS_ENABLE_BINARY_DATA
-#define FOLEYS_ENABLE_BINARY_DATA 0
-#endif
-
/** Config: FOLEYS_ENABLE_OPEN_GL_CONTEXT
If selected an juce OpenGLCOntext is attached. Not a big difference on OSX, but vital on Windows.
*/