Umsci
Upmix Spatial Control Interface — OCA/OCP.1 spatial audio utility
Loading...
Searching...
No Matches
UmsciLoudspeakersPaintComponent Class Reference

The bottom layer of the UmsciControlComponent stack — paints a speaker SVG icon at each loudspeaker's reported real-world position. More...

#include <UmsciLoudspeakersPaintComponent.h>

+ Inheritance diagram for UmsciLoudspeakersPaintComponent:
+ Collaboration diagram for UmsciLoudspeakersPaintComponent:

Public Member Functions

 UmsciLoudspeakersPaintComponent ()
 
 ~UmsciLoudspeakersPaintComponent () override
 
void paint (Graphics &) override
 
void resized () override
 
void lookAndFeelChanged () override
 Re-prerender all speaker drawables in the new look-and-feel colour.
 
void setControlsSize (ControlsSize size) override
 Re-prerender all speaker drawables at the new icon size.
 
void setSpeakerPositions (const std::map< std::int16_t, std::array< std::float_t, 6 > > &speakerPositions)
 Replaces all speaker positions at once (e.g. on reconnect).
 
void setSpeakerPosition (std::int16_t speakerId, const std::array< std::float_t, 6 > &position)
 Updates a single speaker position and re-prerenders its drawable.
 
- Public Member Functions inherited from UmsciPaintNControlComponentBase
 UmsciPaintNControlComponentBase ()
 
virtual ~UmsciPaintNControlComponentBase () override
 
void setBoundsRealRef (const juce::Rectangle< float > &boundsRealRef)
 Sets the real-world rectangle that the component's pixel bounds map to.
 
ControlsSize getControlsSize () const
 
float getControlsSizeMultiplier () const
 Returns a multiplier (e.g. 0.5 / 1.0 / 1.5) for S/M/L icon sizes.
 
void setZoom (float factor, juce::Point< float > normalizedPanOffset={})
 Silently applies zoom without firing onViewportZoomChanged. Used by UmsciControlComponent to synchronise sibling layers after one of them fires the callback.
 
float getZoomFactor () const
 
void resetZoom ()
 Resets zoom to 1.0 / no pan and fires onViewportZoomChanged.
 
void simulatePinchZoom (float scaleFactor, juce::Point< float > centre)
 Applies an incremental pinch-zoom step, as if the user performed a native pinch gesture centred at centre (in component-local pixel coordinates).
 

Additional Inherited Members

- Public Types inherited from UmsciPaintNControlComponentBase
enum class  ControlsSize {
  S ,
  M ,
  L
}
 Visual size of source/speaker icons. Multiplier accessible via getControlsSizeMultiplier(). More...
 
- Public Attributes inherited from UmsciPaintNControlComponentBase
std::function< void(float, juce::Point< float >)> onViewportZoomChanged
 Fired after every user-initiated zoom/pan change (wheel, pinch, double-click). Parameters: (newFactor, newNormalisedPanOffset). UmsciControlComponent uses this to synchronise the other two layers via setZoom().
 
- Protected Member Functions inherited from UmsciPaintNControlComponentBase
juce::Point< float > GetPointForRealCoordinate (const std::array< float, 3 > &realCoordinate)
 Converts a 3D real-world coordinate to a 2D screen pixel point.
 
std::array< float, 3 > GetRealCoordinateForPoint (const juce::Point< float > &screenPoint)
 Inverse of GetPointForRealCoordinate — converts a screen pixel point back to a 3D real-world coordinate (Z is set to 0).
 
void mouseDoubleClick (const juce::MouseEvent &) override
 Double-click resets zoom to 1.0 via resetZoom().
 
void mouseWheelMove (const juce::MouseEvent &, const juce::MouseWheelDetails &) override
 Mouse-wheel zooms about the cursor position.
 
void mouseMagnify (const juce::MouseEvent &, float scaleFactor) override
 Trackpad pinch-to-zoom (macOS).
 
bool processPinchGesture (const juce::MouseEvent &e, bool isDown, bool isUp)
 JUCE-level two-touch pinch-zoom fallback for platforms where neither mouseMagnify nor a native gesture recognizer is available.
 

Detailed Description

The bottom layer of the UmsciControlComponent stack — paints a speaker SVG icon at each loudspeaker's reported real-world position.

Rendering pipeline

  1. setSpeakerPosition() stores the incoming 6-component position {X, Y, Z, horizontal angle, vertical angle, rotation} and calls PrerenderSpeakerDrawable() to create a rotated juce::Drawable scaled to the current pixel bounds.
  2. PrerenderSpeakersInBounds() converts all world positions to pixel coordinates (via GetPointForRealCoordinate()) and stores the target Rectangle<float> for each speaker icon in m_speakerDrawableAreas.
  3. paint() iterates the drawables and draws each one at its prerendered area.

Prerender is retriggered in onZoomChanged() (zoom changed), resized() (component resized), and lookAndFeelChanged() / setControlsSize() (appearance changed).

This component is display-only — it does not handle any mouse interaction. Interaction is handled by the UmsciSoundobjectsPaintComponent layer above.

Note
[MANUAL CONTEXT NEEDED] Describe which SVG asset is used for the speaker icon and where it originates (BinaryData resource name, source file).

Definition at line 49 of file UmsciLoudspeakersPaintComponent.h.

Constructor & Destructor Documentation

◆ UmsciLoudspeakersPaintComponent()

UmsciLoudspeakersPaintComponent::UmsciLoudspeakersPaintComponent ( )

Definition at line 22 of file UmsciLoudspeakersPaintComponent.cpp.

◆ ~UmsciLoudspeakersPaintComponent()

UmsciLoudspeakersPaintComponent::~UmsciLoudspeakersPaintComponent ( )
override

Definition at line 27 of file UmsciLoudspeakersPaintComponent.cpp.

Member Function Documentation

◆ lookAndFeelChanged()

void UmsciLoudspeakersPaintComponent::lookAndFeelChanged ( )
override

Re-prerender all speaker drawables in the new look-and-feel colour.

Definition at line 49 of file UmsciLoudspeakersPaintComponent.cpp.

◆ paint()

void UmsciLoudspeakersPaintComponent::paint ( Graphics &  )
override

◆ resized()

void UmsciLoudspeakersPaintComponent::resized ( )
override

Definition at line 44 of file UmsciLoudspeakersPaintComponent.cpp.

◆ setControlsSize()

void UmsciLoudspeakersPaintComponent::setControlsSize ( ControlsSize  size)
overridevirtual

Re-prerender all speaker drawables at the new icon size.

Reimplemented from UmsciPaintNControlComponentBase.

Definition at line 118 of file UmsciLoudspeakersPaintComponent.cpp.

References UmsciPaintNControlComponentBase::setControlsSize().

◆ setSpeakerPosition()

void UmsciLoudspeakersPaintComponent::setSpeakerPosition ( std::int16_t  speakerId,
const std::array< std::float_t, 6 > &  position 
)

Updates a single speaker position and re-prerenders its drawable.

Parameters
speakerId1-based DS100 output channel index.
position{X, Y, Z, horizontal angle, vertical angle, rotation}.

Definition at line 109 of file UmsciLoudspeakersPaintComponent.cpp.

References UmsciPaintNControlComponentBase::getControlsSizeMultiplier(), and UmsciPaintNControlComponentBase::GetPointForRealCoordinate().

◆ setSpeakerPositions()

void UmsciLoudspeakersPaintComponent::setSpeakerPositions ( const std::map< std::int16_t, std::array< std::float_t, 6 > > &  speakerPositions)

Replaces all speaker positions at once (e.g. on reconnect).

Definition at line 88 of file UmsciLoudspeakersPaintComponent.cpp.


The documentation for this class was generated from the following files: