From e6080e5f29c61e10902d3e3709e0795d2e1b9090 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sat, 29 Nov 2025 20:35:57 +0100 Subject: [PATCH 01/10] add RPC method setFaderLevel (not yet working) --- src/clientrpc.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/clientrpc.cpp b/src/clientrpc.cpp index 51c9a9d287..8dce2294bc 100644 --- a/src/clientrpc.cpp +++ b/src/clientrpc.cpp @@ -326,6 +326,31 @@ CClientRpc::CClientRpc ( CClient* pClient, CRpcServer* pRpcServer, QObject* pare response["result"] = "ok"; } ); + + /// @rpc_method jamulusclient/setFaderLevel + /// @brief Sets the fader level. + /// @param {number} params.channelIndex - The channel index of the fader to be set. + /// @param {number} params.level - The fader level in range 0..100. + /// @result {string} result - Always "ok". + pRpcServer->HandleMethod ( "jamulusclient/setFaderLevel", [=] ( const QJsonObject& params, QJsonObject& response ) { + auto jsonChannelIndex = params["channelIndex"]; + if ( !jsonChannelIndex.isDouble() ) + { + response["error"] = CRpcServer::CreateJsonRpcError ( CRpcServer::iErrInvalidParams, "Invalid params: channelIndex is not a number" ); + return; + } + + auto jsonLevel = params["level"]; + if ( !jsonLevel.isDouble() ) + { + response["error"] = CRpcServer::CreateJsonRpcError ( CRpcServer::iErrInvalidParams, "Invalid params: level is not a number" ); + return; + } + + // TODO How to set fader level in client correctly? OnControllerInFaderLevel is definitely the function we need to call... + //pClient->OnControllerInFaderLevel ( jsonChannelIndex.toInt(), jsonLevel.toInt() ); + response["result"] = "ok"; + } ); } QJsonValue CClientRpc::SerializeSkillLevel ( ESkillLevel eSkillLevel ) From 241ac649b7f7f06c98311bbafa1420fd419d0c40 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 30 Nov 2025 09:10:59 +0100 Subject: [PATCH 02/10] introduce function SetControllerInFaderLevel to be able to use controller in for RPC interface --- src/client.cpp | 2 +- src/client.h | 4 +++- src/clientrpc.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index 0aee733ca4..8c18054ab6 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -881,7 +881,7 @@ void CClient::OnHandledSignal ( int sigNum ) #endif } -void CClient::OnControllerInFaderLevel ( int iChannelIdx, int iValue ) +void CClient::SetControllerInFaderLevel ( int iChannelIdx, int iValue ) { // in case of a headless client the faders cannot be moved so we need // to send the controller information directly to the server diff --git a/src/client.h b/src/client.h index 344db5163d..d6de7b2f86 100644 --- a/src/client.h +++ b/src/client.h @@ -260,6 +260,8 @@ class CClient : public QObject void OnTimerRemoteChanGainOrPan(); void StartTimerGainOrPan(); + void SetControllerInFaderLevel ( int iChannelIdx, int iValue ); + void SetInputBoost ( const int iNewBoost ) { iInputBoost = iNewBoost; } void SetRemoteInfo() { Channel.SetRemoteInfo ( ChannelInfo ); } @@ -432,7 +434,7 @@ protected slots: void OnCLPingWithNumClientsReceived ( CHostAddress InetAddr, int iMs, int iNumClients ); void OnSndCrdReinitRequest ( int iSndCrdResetType ); - void OnControllerInFaderLevel ( int iChannelIdx, int iValue ); + void OnControllerInFaderLevel ( int iChannelIdx, int iValue ) { SetControllerInFaderLevel ( iChannelIdx, iValue ); } void OnControllerInPanValue ( int iChannelIdx, int iValue ); void OnControllerInFaderIsSolo ( int iChannelIdx, bool bIsSolo ); void OnControllerInFaderIsMute ( int iChannelIdx, bool bIsMute ); diff --git a/src/clientrpc.cpp b/src/clientrpc.cpp index 8dce2294bc..e1d93c39b8 100644 --- a/src/clientrpc.cpp +++ b/src/clientrpc.cpp @@ -348,7 +348,7 @@ CClientRpc::CClientRpc ( CClient* pClient, CRpcServer* pRpcServer, QObject* pare } // TODO How to set fader level in client correctly? OnControllerInFaderLevel is definitely the function we need to call... - //pClient->OnControllerInFaderLevel ( jsonChannelIndex.toInt(), jsonLevel.toInt() ); + pClient->SetControllerInFaderLevel ( jsonChannelIndex.toInt(), jsonLevel.toInt() ); response["result"] = "ok"; } ); } From 78083707b65fa606f4ffb41769c5da022b9ac916 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 30 Nov 2025 09:21:46 +0100 Subject: [PATCH 03/10] add example for jamulusclient/setFaderLevel --- src/clientrpc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clientrpc.cpp b/src/clientrpc.cpp index e1d93c39b8..ae1691202b 100644 --- a/src/clientrpc.cpp +++ b/src/clientrpc.cpp @@ -328,7 +328,7 @@ CClientRpc::CClientRpc ( CClient* pClient, CRpcServer* pRpcServer, QObject* pare } ); /// @rpc_method jamulusclient/setFaderLevel - /// @brief Sets the fader level. + /// @brief Sets the fader level. Example: {"id":1,"jsonrpc":"2.0","method":"jamulusclient/setFaderLevel","params":{"channelIndex": 0,"level": 50}}. /// @param {number} params.channelIndex - The channel index of the fader to be set. /// @param {number} params.level - The fader level in range 0..100. /// @result {string} result - Always "ok". From 60edcf55755f80574ba69ee67b99a929b59850ad Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 30 Nov 2025 09:28:47 +0100 Subject: [PATCH 04/10] add range check to RPC to be able to correctly inform the RPC user that the command he has send has a problem --- src/clientrpc.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/clientrpc.cpp b/src/clientrpc.cpp index ae1691202b..2594f04702 100644 --- a/src/clientrpc.cpp +++ b/src/clientrpc.cpp @@ -334,16 +334,16 @@ CClientRpc::CClientRpc ( CClient* pClient, CRpcServer* pRpcServer, QObject* pare /// @result {string} result - Always "ok". pRpcServer->HandleMethod ( "jamulusclient/setFaderLevel", [=] ( const QJsonObject& params, QJsonObject& response ) { auto jsonChannelIndex = params["channelIndex"]; - if ( !jsonChannelIndex.isDouble() ) + if ( !jsonChannelIndex.isDouble() || ( jsonChannelIndex.toInt() < 0 ) || ( jsonChannelIndex.toInt() > MAX_NUM_CHANNELS ) ) { - response["error"] = CRpcServer::CreateJsonRpcError ( CRpcServer::iErrInvalidParams, "Invalid params: channelIndex is not a number" ); + response["error"] = CRpcServer::CreateJsonRpcError ( CRpcServer::iErrInvalidParams, "Invalid params: channelIndex is not a number or out-of-range" ); return; } auto jsonLevel = params["level"]; - if ( !jsonLevel.isDouble() ) + if ( !jsonLevel.isDouble() || ( jsonLevel.toInt() < 0 ) || ( jsonLevel.toInt() > 100 ) ) { - response["error"] = CRpcServer::CreateJsonRpcError ( CRpcServer::iErrInvalidParams, "Invalid params: level is not a number" ); + response["error"] = CRpcServer::CreateJsonRpcError ( CRpcServer::iErrInvalidParams, "Invalid params: level is not a number or out-of-range" ); return; } From cce4bf42e17b7e56aa35d07954e7281bc6a3313b Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 30 Nov 2025 09:32:18 +0100 Subject: [PATCH 05/10] clean up (TODO is already solved) --- src/clientrpc.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/clientrpc.cpp b/src/clientrpc.cpp index 2594f04702..9f7572936d 100644 --- a/src/clientrpc.cpp +++ b/src/clientrpc.cpp @@ -347,7 +347,6 @@ CClientRpc::CClientRpc ( CClient* pClient, CRpcServer* pRpcServer, QObject* pare return; } - // TODO How to set fader level in client correctly? OnControllerInFaderLevel is definitely the function we need to call... pClient->SetControllerInFaderLevel ( jsonChannelIndex.toInt(), jsonLevel.toInt() ); response["result"] = "ok"; } ); From 924375fb5a0030a3e0f1ef61e605ab8de05cb93e Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 30 Nov 2025 09:51:28 +0100 Subject: [PATCH 06/10] update RPC documentation --- docs/JSON-RPC.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/JSON-RPC.md b/docs/JSON-RPC.md index c5f6aa37d0..92591c0a27 100644 --- a/docs/JSON-RPC.md +++ b/docs/JSON-RPC.md @@ -222,6 +222,24 @@ Results: | result | string | Always "ok". | +### jamulusclient/setFaderLevel + +Sets the fader level. Example: {"id":1,"jsonrpc":"2.0","method":"jamulusclient/setFaderLevel","params":{"channelIndex": 0,"level": 50}}. + +Parameters: + +| Name | Type | Description | +| --- | --- | --- | +| params.channelIndex | number | The channel index of the fader to be set. | +| params.level | number | The fader level in range 0..100. | + +Results: + +| Name | Type | Description | +| --- | --- | --- | +| result | string | Always "ok". | + + ### jamulusclient/setName Sets your name. From c4cce829352a9ab256ade71bcf818991494c107b Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 30 Nov 2025 09:58:34 +0100 Subject: [PATCH 07/10] fix clang-format issues --- src/clientrpc.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/clientrpc.cpp b/src/clientrpc.cpp index 9f7572936d..5771f906da 100644 --- a/src/clientrpc.cpp +++ b/src/clientrpc.cpp @@ -328,7 +328,8 @@ CClientRpc::CClientRpc ( CClient* pClient, CRpcServer* pRpcServer, QObject* pare } ); /// @rpc_method jamulusclient/setFaderLevel - /// @brief Sets the fader level. Example: {"id":1,"jsonrpc":"2.0","method":"jamulusclient/setFaderLevel","params":{"channelIndex": 0,"level": 50}}. + /// @brief Sets the fader level. Example: {"id":1,"jsonrpc":"2.0","method":"jamulusclient/setFaderLevel","params":{"channelIndex": 0,"level": + /// 50}}. /// @param {number} params.channelIndex - The channel index of the fader to be set. /// @param {number} params.level - The fader level in range 0..100. /// @result {string} result - Always "ok". @@ -336,14 +337,16 @@ CClientRpc::CClientRpc ( CClient* pClient, CRpcServer* pRpcServer, QObject* pare auto jsonChannelIndex = params["channelIndex"]; if ( !jsonChannelIndex.isDouble() || ( jsonChannelIndex.toInt() < 0 ) || ( jsonChannelIndex.toInt() > MAX_NUM_CHANNELS ) ) { - response["error"] = CRpcServer::CreateJsonRpcError ( CRpcServer::iErrInvalidParams, "Invalid params: channelIndex is not a number or out-of-range" ); + response["error"] = + CRpcServer::CreateJsonRpcError ( CRpcServer::iErrInvalidParams, "Invalid params: channelIndex is not a number or out-of-range" ); return; } auto jsonLevel = params["level"]; if ( !jsonLevel.isDouble() || ( jsonLevel.toInt() < 0 ) || ( jsonLevel.toInt() > 100 ) ) { - response["error"] = CRpcServer::CreateJsonRpcError ( CRpcServer::iErrInvalidParams, "Invalid params: level is not a number or out-of-range" ); + response["error"] = + CRpcServer::CreateJsonRpcError ( CRpcServer::iErrInvalidParams, "Invalid params: level is not a number or out-of-range" ); return; } From 7e176e3f120e74f1946d6ae117bf2a24e66bc399 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 30 Nov 2025 10:00:07 +0100 Subject: [PATCH 08/10] fix check-json-rpc-docs --- docs/JSON-RPC.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/JSON-RPC.md b/docs/JSON-RPC.md index 92591c0a27..84271b66a8 100644 --- a/docs/JSON-RPC.md +++ b/docs/JSON-RPC.md @@ -224,7 +224,7 @@ Results: ### jamulusclient/setFaderLevel -Sets the fader level. Example: {"id":1,"jsonrpc":"2.0","method":"jamulusclient/setFaderLevel","params":{"channelIndex": 0,"level": 50}}. +Sets the fader level. Example: {"id":1,"jsonrpc":"2.0","method":"jamulusclient/setFaderLevel","params":{"channelIndex": 0,"level": 50}}. Parameters: From 2528c9111d141db2aa95b724ce0053f3b9d7719d Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 1 Dec 2025 20:09:24 +0100 Subject: [PATCH 09/10] avoid renaming of existing function implementation --- src/client.cpp | 2 +- src/client.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index 8c18054ab6..0aee733ca4 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -881,7 +881,7 @@ void CClient::OnHandledSignal ( int sigNum ) #endif } -void CClient::SetControllerInFaderLevel ( int iChannelIdx, int iValue ) +void CClient::OnControllerInFaderLevel ( int iChannelIdx, int iValue ) { // in case of a headless client the faders cannot be moved so we need // to send the controller information directly to the server diff --git a/src/client.h b/src/client.h index d6de7b2f86..8d48e0cbcc 100644 --- a/src/client.h +++ b/src/client.h @@ -260,7 +260,7 @@ class CClient : public QObject void OnTimerRemoteChanGainOrPan(); void StartTimerGainOrPan(); - void SetControllerInFaderLevel ( int iChannelIdx, int iValue ); + void SetControllerInFaderLevel ( int iChannelIdx, int iValue ) { OnControllerInFaderLevel ( iChannelIdx, iValue ); } void SetInputBoost ( const int iNewBoost ) { iInputBoost = iNewBoost; } @@ -434,7 +434,7 @@ protected slots: void OnCLPingWithNumClientsReceived ( CHostAddress InetAddr, int iMs, int iNumClients ); void OnSndCrdReinitRequest ( int iSndCrdResetType ); - void OnControllerInFaderLevel ( int iChannelIdx, int iValue ) { SetControllerInFaderLevel ( iChannelIdx, iValue ); } + void OnControllerInFaderLevel ( int iChannelIdx, int iValue ); void OnControllerInPanValue ( int iChannelIdx, int iValue ); void OnControllerInFaderIsSolo ( int iChannelIdx, bool bIsSolo ); void OnControllerInFaderIsMute ( int iChannelIdx, bool bIsMute ); From 7771bf9c4acbc93e9ce521bd3417a33e5430c0e7 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 1 Dec 2025 20:11:25 +0100 Subject: [PATCH 10/10] fix clang format issue --- src/client.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.h b/src/client.h index 8d48e0cbcc..f78ce8aba7 100644 --- a/src/client.h +++ b/src/client.h @@ -260,7 +260,7 @@ class CClient : public QObject void OnTimerRemoteChanGainOrPan(); void StartTimerGainOrPan(); - void SetControllerInFaderLevel ( int iChannelIdx, int iValue ) { OnControllerInFaderLevel ( iChannelIdx, iValue ); } + void SetControllerInFaderLevel ( int iChannelIdx, int iValue ) { OnControllerInFaderLevel ( iChannelIdx, iValue ); } void SetInputBoost ( const int iNewBoost ) { iInputBoost = iNewBoost; }