Umsci
Upmix Spatial Control Interface — OCA/OCP.1 spatial audio utility
Loading...
Searching...
No Matches
UmsciSoundobjectsPaintComponent.h
Go to the documentation of this file.
1/* Copyright (c) 2026, Christian Ahrens
2 *
3 * This file is part of Umsci <https://github.com/ChristianAhrens/Umsci>
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
24
25#include <set>
26
27
62{
63public:
66
67 //==============================================================================
68 void paint(Graphics&) override;
69 void resized() override;
70
71 //==============================================================================
73 bool hitTest(int x, int y) override;
75 void mouseDown(const juce::MouseEvent& e) override;
77 void mouseDrag(const juce::MouseEvent& e) override;
79 void mouseUp(const juce::MouseEvent& e) override;
80
81 //==============================================================================
83 void setSourcePositions(const std::map<std::int16_t, std::array<std::float_t, 3>>& sourcePositions);
89 void setSourcePosition(std::int16_t sourceId, const std::array<std::float_t, 3>& position);
90
91 //==============================================================================
97 void setSourceIdFilter(const std::set<std::int16_t>& allowedIds);
98
99 //==============================================================================
106 std::function<void(std::int16_t, std::array<std::float_t, 3>)> onSourcePositionChanged;
107
108private:
109 //==============================================================================
111 void onZoomChanged() override;
113 void PrerenderSourcesInBounds();
114
115 //==============================================================================
116 std::map<std::int16_t, std::array<std::float_t, 3>> m_sourcePositions;
117 std::map<std::int16_t, juce::Point<int>> m_sourceScreenPositions;
118 std::set<std::int16_t> m_sourceIdFilter;
119
120 std::int16_t m_draggedSourceId{ -1 };
121
122 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UmsciSoundobjectsPaintComponent)
123};
124
Abstract base class for all three overlaid visualisation layers in UmsciControlComponent.
The middle layer of the UmsciControlComponent stack — paints a filled circle for each sound object an...
void setSourcePosition(std::int16_t sourceId, const std::array< std::float_t, 3 > &position)
Updates a single source position.
void setSourcePositions(const std::map< std::int16_t, std::array< std::float_t, 3 > > &sourcePositions)
Replaces all source positions at once (e.g. on reconnect or initial query).
void setSourceIdFilter(const std::set< std::int16_t > &allowedIds)
Restricts rendering and interaction to the given set of source IDs. An empty set means no sources are...
void mouseDrag(const juce::MouseEvent &e) override
Converts the drag position to world coordinates and fires onSourcePositionChanged.
std::function< void(std::int16_t, std::array< std::float_t, 3 >)> onSourcePositionChanged
Fired during a drag with the new world position. UmsciControlComponent receives this and calls Device...
void mouseDown(const juce::MouseEvent &e) override
Identifies which source is under the cursor and begins a drag.
void mouseUp(const juce::MouseEvent &e) override
Clears the active drag state.
bool hitTest(int x, int y) override
Returns true only when the point falls within a rendered source circle.