From ad37e9eafaaef9ce3c583e89587ffa5f136231ba Mon Sep 17 00:00:00 2001 From: jrd Date: Tue, 28 Jul 2026 19:57:17 +0000 Subject: [PATCH] Add jamulusclient/setInputBoost JSON-RPC method Headless clients had no way to change the input boost factor at runtime: CClient::SetInputBoost() was only reachable from the GUI's Advanced Settings combo box (CClientSettingsDlg::OnInputBoostChanged). Adds a setter mirroring the existing setMuted handler, taking a 1-based factor from 1 (the GUI's "None") to 10, matching cbxInputBoost's range. docs/JSON-RPC.md regenerated via tools/generate_json_rpc_docs.py. Requested by pljones on #3841, which applies the inputboost ini setting at headless startup and follows this change. Co-Authored-By: Claude Opus 5 --- docs/JSON-RPC.md | 17 +++++++++++++++++ src/clientrpc.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/docs/JSON-RPC.md b/docs/JSON-RPC.md index e9111187f4..e2eb457665 100644 --- a/docs/JSON-RPC.md +++ b/docs/JSON-RPC.md @@ -274,6 +274,23 @@ Results: | result | string | Always "ok". | +### jamulusclient/setInputBoost + +Sets the input boost factor. + +Parameters: + +| Name | Type | Description | +| --- | --- | --- | +| params.boost | int | boost factor, 1 (no boost) to 10. | + +Results: + +| Name | Type | Description | +| --- | --- | --- | +| result | string | Always "ok". | + + ### jamulusclient/setMidiSettings Sets one or more MIDI controller settings. diff --git a/src/clientrpc.cpp b/src/clientrpc.cpp index 1f6671ca9e..15c17f3372 100644 --- a/src/clientrpc.cpp +++ b/src/clientrpc.cpp @@ -511,6 +511,30 @@ CClientRpc::CClientRpc ( CClient* pClient, CClientSettings* pSettings, CRpcServe response["result"] = "ok"; } ); + + /// @rpc_method jamulusclient/setInputBoost + /// @brief Sets the input boost factor. + /// @param {int} params.boost - boost factor, 1 (no boost) to 10. + /// @result {string} result - Always "ok". + pRpcServer->HandleMethod ( "jamulusclient/setInputBoost", [=] ( const QJsonObject& params, QJsonObject& response ) { + auto boost = params["boost"]; + if ( !boost.isDouble() ) + { + response["error"] = CRpcServer::CreateJsonRpcError ( CRpcServer::iErrInvalidParams, "Invalid params: boost is not a number" ); + return; + } + + const int iBoost = boost.toInt(); + if ( iBoost < 1 || iBoost > 10 ) + { + response["error"] = CRpcServer::CreateJsonRpcError ( CRpcServer::iErrInvalidParams, "Invalid params: boost must be between 1 and 10" ); + return; + } + + pClient->SetInputBoost ( iBoost ); + + response["result"] = "ok"; + } ); } QJsonValue CClientRpc::SerializeSkillLevel ( ESkillLevel eSkillLevel )