Skip to content

Conversation

Copy link

Copilot AI commented Feb 3, 2026

Keyboard shortcuts for RecvSyncToggle and ResetAllJitterBuffers were inverted - user testing on macOS revealed Cmd-J triggered buffer reset instead of receive sync, and vice versa.

Changes

Swapped keyboard bindings in getCommandInfo():

// ResetAllJitterBuffers: Ctrl-Shift-J → Ctrl-J
info.addDefaultKeypress('j', ModifierKeys::commandModifier);

// RecvSyncToggle: Ctrl-J → Ctrl-Shift-J  
info.addDefaultKeypress('j', ModifierKeys::commandModifier | ModifierKeys::shiftModifier);

Result:

  • Ctrl-J: Reset jitter buffers to minimum
  • Ctrl-Shift-J: Synchronize receive latency across peers
Original prompt

Add Keyboard Shortcuts for Receive Sync and Buffer Min Buttons

Objective

Add keyboard shortcuts for two important buffer management buttons in the SonoBus application.

Required Changes

1. New Keyboard Shortcuts to Add:

  • mRecvSyncButton: Control-J (Command-J on Mac)

    • Function: Toggle Receive Sync - synchronizes receive latency for all users
    • Button location: Main peer view area
  • mbufferMinButton: Control-Shift-J (Command-Shift-J on Mac)

    • Function: Reset Buffer Min - resets jitter buffer to minimum for all connected users
    • Button location: Main peer view area

2. Implementation Requirements:

File to modify: Source/SonobusPluginEditor.cpp and Source/SonobusPluginEditor.h

The implementation should follow the existing pattern used for other keyboard shortcuts in the codebase (like Control-R for Record Toggle).

In the header file (SonobusPluginEditor.h):

  • Command IDs should be added to the existing command ID enumeration/definition area

In the implementation file (SonobusPluginEditor.cpp):

a. getAllCommands method: Add the new command IDs to the list of available commands

b. getCommandInfo method: Add cases for both new commands with:

  • Command name and description
  • Keyboard shortcut assignment using result.addDefaultKeypress()
  • For mRecvSyncButton: KeyPress('j', ModifierKeys::commandModifier, 0)
  • For mbufferMinButton: KeyPress('j', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0)

c. perform method: Add cases to handle the command execution:

  • For mRecvSyncButton: Trigger the button click with mRecvSyncButton->triggerClick()
  • For mbufferMinButton: Trigger the button click (needs reference to the button in PeersContainerView)

3. Context from Existing Code:

  • The buttons are defined in Source/PeersContainerView.cpp:

    • mRecvSyncButton - described in OSC docs as "Synchronizes receive latency for all users"
    • mbufferMinButton - has tooltip "Resets jitter buffer to the minimum"
  • Current keyboard shortcuts pattern (from User Guide):

    Record Toggle     = Control-R
    Mute All Input    = M or Control-M
    Play/Pause File   = Spacebar or Control-P
    
  • The ModifierKeys::commandModifier automatically maps to:

    • Control key on Windows/Linux
    • Command key on macOS

4. Testing Considerations:

  • Ensure shortcuts work when the main window has focus
  • Verify no conflicts with existing shortcuts
  • Test on both macOS (Command key) and Windows/Linux (Control key)

Verification:

The implementation should allow users to press:

  • Ctrl-J (or Cmd-J on Mac) to synchronize receive buffers
  • Ctrl-Shift-J (or Cmd-Shift-J on Mac) to reset buffer to minimum

Both shortcuts should have the same effect as clicking the respective buttons with the mouse.

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.

Co-authored-by: mendeni <2165238+mendeni@users.noreply.github.com>
Copilot AI changed the title [WIP] Add keyboard shortcuts for receive sync and buffer min buttons Add keyboard shortcuts for Receive Sync (Ctrl-J) and Buffer Min Reset (Ctrl-Shift-J) Feb 3, 2026
Copilot AI requested a review from mendeni February 3, 2026 20:04
Co-authored-by: mendeni <2165238+mendeni@users.noreply.github.com>
Copilot AI changed the title Add keyboard shortcuts for Receive Sync (Ctrl-J) and Buffer Min Reset (Ctrl-Shift-J) Fix reversed keyboard shortcuts for buffer management commands Feb 3, 2026
@mendeni mendeni changed the title Fix reversed keyboard shortcuts for buffer management commands Keyboard Shortcuts for mBufferMinButton (ctrl-J), mRecvSyncButton (ctrl-shift-J) Feb 3, 2026
@mendeni mendeni marked this pull request as ready for review February 3, 2026 21:13
@mendeni mendeni merged commit 7297207 into 1.7.5 Feb 3, 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