![]() |
Umsci
Upmix Spatial Control Interface — OCA/OCP.1 spatial audio utility
|
The main visualisation and interaction surface for Umsci. More...
#include <UmsciControlComponent.h>
Inheritance diagram for UmsciControlComponent:
Collaboration diagram for UmsciControlComponent:Public Member Functions | |
| UmsciControlComponent () | |
| ~UmsciControlComponent () override | |
| void | resized () override |
| void | paint (juce::Graphics &g) override |
| void | parentHierarchyChanged () override |
| std::unique_ptr< XmlElement > | createStateXml () override |
| bool | setStateXml (XmlElement *stateXml) override |
| const std::pair< int, int > & | getOcp1IOSize () |
| Sets the DS100 input/output channel count for this session. | |
| void | setOcp1IOSize (const std::pair< int, int > &ioSize) |
| void | setDeviceName (const std::string &name) |
| Updates the device name label (shown as a title/overlay in the UI). | |
| void | triggerUpmixTransformApplied () |
Fires live-mode position callbacks and onUpmixTransformChanged after a programmatic transform update (e.g. from MIDI control). | |
| void | triggerUpmixFlashCheck () |
| Starts the flash animation on the upmix indicator if the ideal ring positions diverge from the current DS100 positions. | |
| void | setShowAllSources (bool showAll) |
| When false, only sound objects that are part of the upmix group (i.e. channels >= sourceStartId within the upmix channel count) are rendered; all others are hidden. | |
| bool | getShowAllSources () const |
| void | setControlsSize (UmsciPaintNControlComponentBase::ControlsSize size) |
| Sets the visual size of source/speaker icons (small / medium / large). | |
| UmsciPaintNControlComponentBase::ControlsSize | getControlsSize () const |
| void | resetData () |
| Clears all cached source/speaker data and marks the database incomplete. | |
Sound-object (matrix input) setters | |
Called by
| |
| void | setSourceName (std::int16_t sourceId, const std::string &name) |
| void | setSourceMute (std::int16_t sourceId, const std::uint8_t &mute) |
| 0 = unmuted, nonzero = muted. | |
| void | setSourceGain (std::int16_t sourceId, const std::float_t &gain) |
| Gain in dB. | |
| void | setSourcePosition (std::int16_t sourceId, const std::array< std::float_t, 3 > &position) |
| Sets the 3-component (X, Y, Z) absolute position in normalised real-world coordinates. | |
| void | setSourceDelayMode (std::int16_t sourceId, const std::uint16_t &delayMode) |
| Delay mode: 0 = off, 1 = compensate, 2 = reflect (DS100-specific enum). | |
| void | setSourceSpread (std::int16_t sourceId, const std::float_t &spread) |
| Spread factor 0.0–1.0 (0 = point source, 1 = full spread). | |
Loudspeaker (matrix output) setters | |
Called by
| |
| void | setSpeakerName (std::int16_t speakerId, const std::string &name) |
| void | setSpeakerMute (std::int16_t speakerId, const std::uint8_t &mute) |
| void | setSpeakerGain (std::int16_t speakerId, const std::float_t &gain) |
| void | setSpeakerPosition (std::int16_t speakerId, const std::array< std::float_t, 6 > &position) |
| Sets the 6-component speaker position: {X, Y, Z, horizontal angle, vertical angle, rotation}. | |
Upmix configuration | |
Settings for the upmix indicator overlay ( The upmix indicator shows a ring of virtual speaker positions representing the target upmix channel configuration (e.g. 5.1, 7.1, Atmos). The ring can be rotated, scaled (radius), stretched per-angle, and shifted (offset) by the user via on-screen handles.
| |
| void | setUpmixChannelConfiguration (const juce::AudioChannelSet &upmixChannelConfig) |
| const juce::AudioChannelSet | getUpmixChannelConfiguration () |
| void | setUpmixSourceStartId (int startId) |
| 1-based DS100 channel of the first upmix input. | |
| int | getUpmixSourceStartId () const |
| void | setUpmixLiveMode (bool liveMode) |
| true = follow live DS100 positions. | |
| bool | getUpmixLiveMode () const |
| void | setUpmixShape (UmsciUpmixIndicatorPaintNControlComponent::IndicatorShape shape) |
| UmsciUpmixIndicatorPaintNControlComponent::IndicatorShape | getUpmixShape () const |
Upmix spatial transform | |
Controls the rotation, radial scale, height translation, and angular stretch of the upmix indicator ring relative to its default position. All values are in normalised units consistent with the component's coordinate system (see | |
| void | setUpmixTransform (float rot, float trans, float heightTrans, float angleStretch=1.0f) |
| float | getUpmixRot () const |
| Ring rotation in normalised units (0–1 → 0–360°). | |
| float | getUpmixTrans () const |
| Radial scale factor. | |
| float | getUpmixHeightTrans () const |
| Height (Z) translation. | |
| float | getUpmixAngleStretch () const |
| Per-angle stretch factor (1.0 = uniform). | |
Upmix ring offset | |
Translates the entire upmix ring in the X/Y plane independently of rotation. | |
| void | setUpmixOffset (float x, float y) |
| float | getUpmixOffsetX () const |
| float | getUpmixOffsetY () const |
Public Attributes | |
| std::function< void()> | onDatabaseComplete |
| Fired on the message thread when all initially subscribed values have been received from the DS100 (i.e. the "database" is fully populated). Consumers use this to trigger a first full render or to enable UI controls. | |
| std::function< void()> | onUpmixTransformChanged |
| Fired on the message thread whenever the user changes any upmix transform parameter via the on-screen handles, so the caller can persist the new values. | |
The main visualisation and interaction surface for Umsci.
Three transparent JUCE Components are stacked in z-order, all sharing the same pixel bounds, and all using the same normalised coordinate system managed by UmsciPaintNControlComponentBase:
| Layer (z-order) | Class | Purpose |
|---|---|---|
| Bottom | UmsciLoudspeakersPaintComponent | Paints speaker SVG icons at their real-world positions (read-only). |
| Middle | UmsciSoundobjectsPaintComponent | Paints and lets the user drag source circles. |
| Top | UmsciUpmixIndicatorPaintNControlComponent | Paints the upmix ring with rotation/scale/stretch handles. |
DeviceController::onRemoteObjectReceived (message thread) → setRemoteObject().setRemoteObject() stores the value in m_source* / m_speaker* maps and calls the appropriate setter on the relevant paint component.On each new connection, UmsciControlComponent waits until initial values have been received for every subscribed object before signalling onDatabaseComplete. Until then the visualisation may show stale or partial data.
All source and speaker positions received from the DS100 are in a normalised real-world space (roughly 0.0–1.0 for X/Y, see UmsciPaintNControlComponentBase for the exact transform). The paint components convert these to pixel coordinates for rendering.
All three layers share a single zoom state (scale factor + pan offset). When the user zooms on any layer, that layer fires UmsciPaintNControlComponentBase::onViewportZoomChanged; the syncViewportZoom lambda (wired up in the constructor) forwards the new state to the other two layers via setZoom(), which does not re-fire the callback.
On iOS/iPadOS, JUCE 8's touch routing delivers each finger as a separate MouseEvent routed to whichever component passes hitTest() at that position. Both fingers of a pinch therefore rarely arrive at the same JUCE component, making the JUCE-level processPinchGesture() fallback unreliable. parentHierarchyChanged() therefore attaches a native UIPinchGestureRecognizer (via JUCEAppBasics::iOS_utils::registerNativePinchOnView()) to the JUCE peer UIView the first time a peer becomes available. The UIKit gesture fires at the gesture- recognizer layer before JUCE's per-component touch routing, so it works regardless of which components the individual fingers hit. The incremental scale and centre point are forwarded to simulatePinchZoom() on one of the paint layers, which fires onViewportZoomChanged and thus synchronises all three siblings normally.
Definition at line 91 of file UmsciControlComponent.h.
| UmsciControlComponent::UmsciControlComponent | ( | ) |
Definition at line 30 of file UmsciControlComponent.cpp.
References onUpmixTransformChanged, DeviceController::RemoteObject::Positioning_SourcePosition, DeviceController::RemObjAddr::sc_INV, and setOcp1IOSize().
|
override |
Definition at line 85 of file UmsciControlComponent.cpp.
|
override |
Definition at line 146 of file UmsciControlComponent.cpp.
References UmsciAppConfiguration::CONTROLCONFIG, UmsciAppConfiguration::getAttributeName(), getOcp1IOSize(), UmsciAppConfiguration::getTagName(), and UmsciAppConfiguration::IOSIZE.
| UmsciPaintNControlComponentBase::ControlsSize UmsciControlComponent::getControlsSize | ( | ) | const |
Definition at line 642 of file UmsciControlComponent.cpp.
References UmsciPaintNControlComponentBase::S.
| const std::pair< int, int > & UmsciControlComponent::getOcp1IOSize | ( | ) |
Sets the DS100 input/output channel count for this session.
The pair is {inputChannels, outputChannels}. It is used to limit which channel IDs are subscribed to and rendered.
The DS100 supports M / L / XL software licenses that set different maximum input and output channel counts. The I/O size is configured by the user in Umsci's connection settings and must match (or be within) the device's licensed capacity — it is not auto-detected from the device.
Definition at line 168 of file UmsciControlComponent.cpp.
Referenced by createStateXml(), and setStateXml().
| bool UmsciControlComponent::getShowAllSources | ( | ) | const |
Definition at line 721 of file UmsciControlComponent.cpp.
| float UmsciControlComponent::getUpmixAngleStretch | ( | ) | const |
Per-angle stretch factor (1.0 = uniform).
Definition at line 676 of file UmsciControlComponent.cpp.
| const juce::AudioChannelSet UmsciControlComponent::getUpmixChannelConfiguration | ( | ) |
Definition at line 584 of file UmsciControlComponent.cpp.
| float UmsciControlComponent::getUpmixHeightTrans | ( | ) | const |
Height (Z) translation.
Definition at line 669 of file UmsciControlComponent.cpp.
| bool UmsciControlComponent::getUpmixLiveMode | ( | ) | const |
Definition at line 612 of file UmsciControlComponent.cpp.
| float UmsciControlComponent::getUpmixOffsetX | ( | ) | const |
Definition at line 701 of file UmsciControlComponent.cpp.
| float UmsciControlComponent::getUpmixOffsetY | ( | ) | const |
Definition at line 708 of file UmsciControlComponent.cpp.
| float UmsciControlComponent::getUpmixRot | ( | ) | const |
Ring rotation in normalised units (0–1 → 0–360°).
Definition at line 655 of file UmsciControlComponent.cpp.
| UmsciUpmixIndicatorPaintNControlComponent::IndicatorShape UmsciControlComponent::getUpmixShape | ( | ) | const |
Definition at line 625 of file UmsciControlComponent.cpp.
References UmsciUpmixIndicatorPaintNControlComponent::Circle.
| int UmsciControlComponent::getUpmixSourceStartId | ( | ) | const |
Definition at line 599 of file UmsciControlComponent.cpp.
| float UmsciControlComponent::getUpmixTrans | ( | ) | const |
Radial scale factor.
Definition at line 662 of file UmsciControlComponent.cpp.
|
override |
Definition at line 93 of file UmsciControlComponent.cpp.
|
override |
Definition at line 117 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::resetData | ( | ) |
Clears all cached source/speaker data and marks the database incomplete.
Definition at line 474 of file UmsciControlComponent.cpp.
|
override |
Definition at line 105 of file UmsciControlComponent.cpp.
Referenced by setSpeakerPosition().
| void UmsciControlComponent::setControlsSize | ( | UmsciPaintNControlComponentBase::ControlsSize | size | ) |
Sets the visual size of source/speaker icons (small / medium / large).
Definition at line 632 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setDeviceName | ( | const std::string & | name | ) |
Updates the device name label (shown as a title/overlay in the UI).
Definition at line 479 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setOcp1IOSize | ( | const std::pair< int, int > & | ioSize | ) |
Definition at line 173 of file UmsciControlComponent.cpp.
Referenced by setStateXml(), and UmsciControlComponent().
| void UmsciControlComponent::setShowAllSources | ( | bool | showAll | ) |
When false, only sound objects that are part of the upmix group (i.e. channels >= sourceStartId within the upmix channel count) are rendered; all others are hidden.
Definition at line 715 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setSourceDelayMode | ( | std::int16_t | sourceId, |
| const std::uint16_t & | delayMode | ||
| ) |
Delay mode: 0 = off, 1 = compensate, 2 = reflect (DS100-specific enum).
Definition at line 520 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setSourceGain | ( | std::int16_t | sourceId, |
| const std::float_t & | gain | ||
| ) |
Gain in dB.
Definition at line 504 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setSourceMute | ( | std::int16_t | sourceId, |
| const std::uint8_t & | mute | ||
| ) |
0 = unmuted, nonzero = muted.
Definition at line 489 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setSourceName | ( | std::int16_t | sourceId, |
| const std::string & | name | ||
| ) |
Definition at line 484 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setSourcePosition | ( | std::int16_t | sourceId, |
| const std::array< std::float_t, 3 > & | position | ||
| ) |
Sets the 3-component (X, Y, Z) absolute position in normalised real-world coordinates.
Definition at line 509 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setSourceSpread | ( | std::int16_t | sourceId, |
| const std::float_t & | spread | ||
| ) |
Spread factor 0.0–1.0 (0 = point source, 1 = full spread).
Definition at line 525 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setSpeakerGain | ( | std::int16_t | speakerId, |
| const std::float_t & | gain | ||
| ) |
Definition at line 549 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setSpeakerMute | ( | std::int16_t | speakerId, |
| const std::uint8_t & | mute | ||
| ) |
Definition at line 535 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setSpeakerName | ( | std::int16_t | speakerId, |
| const std::string & | name | ||
| ) |
Definition at line 530 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setSpeakerPosition | ( | std::int16_t | speakerId, |
| const std::array< std::float_t, 6 > & | position | ||
| ) |
Sets the 6-component speaker position: {X, Y, Z, horizontal angle, vertical angle, rotation}.
Definition at line 554 of file UmsciControlComponent.cpp.
References resized().
|
override |
Definition at line 155 of file UmsciControlComponent.cpp.
References UmsciAppConfiguration::CONTROLCONFIG, UmsciAppConfiguration::getAttributeName(), getOcp1IOSize(), UmsciAppConfiguration::getTagName(), UmsciAppConfiguration::IOSIZE, and setOcp1IOSize().
| void UmsciControlComponent::setUpmixChannelConfiguration | ( | const juce::AudioChannelSet & | upmixChannelConfig | ) |
Definition at line 577 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setUpmixLiveMode | ( | bool | liveMode | ) |
true = follow live DS100 positions.
Definition at line 606 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setUpmixOffset | ( | float | x, |
| float | y | ||
| ) |
Definition at line 683 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setUpmixShape | ( | UmsciUpmixIndicatorPaintNControlComponent::IndicatorShape | shape | ) |
Definition at line 619 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setUpmixSourceStartId | ( | int | startId | ) |
1-based DS100 channel of the first upmix input.
Definition at line 592 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::setUpmixTransform | ( | float | rot, |
| float | trans, | ||
| float | heightTrans, | ||
| float | angleStretch = 1.0f |
||
| ) |
Definition at line 649 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::triggerUpmixFlashCheck | ( | ) |
Starts the flash animation on the upmix indicator if the ideal ring positions diverge from the current DS100 positions.
Call this after a programmatic transform update when live mode is off, so the operator sees a visual cue that the device positions are out of sync.
Definition at line 695 of file UmsciControlComponent.cpp.
| void UmsciControlComponent::triggerUpmixTransformApplied | ( | ) |
Fires live-mode position callbacks and onUpmixTransformChanged after a programmatic transform update (e.g. from MIDI control).
Call this after setUpmixTransform() / setUpmixOffset() when the change originates outside the UI (MIDI, automation) to ensure DS100 positions are updated in live mode and the config is marked dirty.
Definition at line 689 of file UmsciControlComponent.cpp.
| std::function<void()> UmsciControlComponent::onDatabaseComplete |
Fired on the message thread when all initially subscribed values have been received from the DS100 (i.e. the "database" is fully populated). Consumers use this to trigger a first full render or to enable UI controls.
Definition at line 267 of file UmsciControlComponent.h.
| std::function<void()> UmsciControlComponent::onUpmixTransformChanged |
Fired on the message thread whenever the user changes any upmix transform parameter via the on-screen handles, so the caller can persist the new values.
Definition at line 273 of file UmsciControlComponent.h.
Referenced by UmsciControlComponent().