Skip to content

Add bidirectional OSC scaling for TouchOSC slider synchronization#22

Merged
mendeni merged 4 commits intoadd-juce-oscfrom
copilot/add-global-scale-factor
Jan 28, 2026
Merged

Add bidirectional OSC scaling for TouchOSC slider synchronization#22
mendeni merged 4 commits intoadd-juce-oscfrom
copilot/add-global-scale-factor

Conversation

Copy link

Copilot AI commented Jan 28, 2026

TouchOSC requires 0.5x scaling on outbound messages. Without compensating on inbound messages, sliders desynchronize when controlled from TouchOSC.

Changes

Outbound scaling (all float values)

  • Added OSC_SCALE_FACTOR = 0.5f in OSCManager.h
  • Applied in OSCManager::sendMessage() for all float/double values
  • Integer and string values pass through unchanged

Inbound scaling (selective controls only)

  • Added OSC_INVERSE_SCALE_FACTOR = 2.0f in OSCManager.h
  • Applied to incoming values in control registrations:
    • /OutGainSlider - main output gain
    • /DrySlider - dry/wet mix
    • /Peer{1-16}Level - peer level/gain
    • /Peer{1-16}Pan - peer pan

Unchanged controls

  • All other peer controls (compressor, expander, EQ, reverb send)
  • All main controls (mute, metronome, recording, options)
  • All InputGroup controls

Example

// Outbound: Application → TouchOSC
processor.getOSCManager().sendMessage("/OutGainSlider", 1.0);
// TouchOSC receives: 0.5

// Inbound: TouchOSC → Application  
oscManager.registerControl("/OutGainSlider", [this](const OSCMessage& msg) {
    float value = msg[0].getFloat32() * OSC_INVERSE_SCALE_FACTOR;  // 0.5 * 2.0 = 1.0
    mOutGainSlider->setValue(value);
});

This maintains bidirectional synchronization: App(1.0) --[×0.5]--> TouchOSC(0.5) --[×2.0]--> App(1.0)

Original prompt

In the branch add-juce-osc, we need to add a global constant to centrally manage a scaling factor for outbound OSC messages. Specifically, implement a constexpr float scaleFactor = 0.5f in the appropriate source files under Source to ensure all OSC messages sent use this scale factor. The intention is to minimize duplication and ensure future flexibility while maintaining compatibility with TouchOSC or similar controls that expect normalized ranges. Update related OSC send calls to incorporate this scaling factor using existing message send logic.

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 28, 2026 16:50
Co-authored-by: mendeni <2165238+mendeni@users.noreply.github.com>
Co-authored-by: mendeni <2165238+mendeni@users.noreply.github.com>
Copilot AI changed the title [WIP] Add global constant for OSC message scaling Add global OSC_SCALE_FACTOR for outbound message scaling Jan 28, 2026
Copilot AI requested a review from mendeni January 28, 2026 16:53
Co-authored-by: mendeni <2165238+mendeni@users.noreply.github.com>
Copilot AI changed the title Add global OSC_SCALE_FACTOR for outbound message scaling Add bidirectional OSC scaling for TouchOSC slider synchronization Jan 28, 2026
Copy link
Owner

@mendeni mendeni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've confirmed the correct values are being sent and received between our application and TouchOSC.

@mendeni mendeni marked this pull request as ready for review January 28, 2026 22:30
@mendeni mendeni merged commit d42da4b into add-juce-osc Jan 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants