Mema
Memory Matrix — multi-channel audio matrix monitor and router
Loading...
Searching...
No Matches
AbstractAudioVisualizer.h
Go to the documentation of this file.
1/* Copyright (c) 2024-2025, Christian Ahrens
2 *
3 * This file is part of Mema <https://github.com/ChristianAhrens/Mema>
4 *
5 * This tool is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License version 3.0 as published
7 * by the Free Software Foundation.
8 *
9 * This tool is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this tool; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#pragma once
20
21#include <JuceHeader.h>
22
23#include "../MemaProcessor/MemaProcessor.h"
24
25namespace Mema
26{
27
34class AbstractAudioVisualizer : public juce::Component,
36 public juce::Timer
37{
38public:
41
42 //==============================================================================
44 void notifyChanges();
46 virtual void processChanges();
47
48 //==============================================================================
50 void paint (Graphics&) override;
52 void resized() override;
54 void mouseDown(const MouseEvent& event) override;
55
56 //==============================================================================
58 void setRefreshFrequency(int frequency);
60 void timerCallback() override;
61
62protected:
63 //==============================================================================
64 void setUsesValuesInDB(bool useValuesInDB);
65 bool getUsesValuesInDB();
66
67private:
68 bool m_changesPending{ false };
69 bool m_usesValuesInDB{ 0 };
70
71 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AbstractAudioVisualizer)
72};
73
74}
Base class for all audio-data visualisation components in the Mema processor editor.
void paint(Graphics &) override
Paints the visualiser background.
virtual void processChanges()
Called on the message thread to update cached data before repainting.
void notifyChanges()
Marks that new data is available and triggers a repaint on the next timer tick.
void setRefreshFrequency(int frequency)
Sets the display refresh rate in Hz.
void setUsesValuesInDB(bool useValuesInDB)
void mouseDown(const MouseEvent &event) override
Handles mouse-down events (e.g. right-click context menu).
void timerCallback() override
Timer callback that calls processChanges() and triggers a repaint if data changed.
void resized() override
Lays out child components.
Definition Mema.cpp:27