Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions docs/JSON-RPC.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,40 @@ Results:
| result.clients | array | The client list. See jamulusclient/clientListReceived for the format. |


### jamulusclient/getCurrentDirectory

Returns the currently selected directory socket address.

Parameters:

| Name | Type | Description |
| --- | --- | --- |
| params | object | No parameters (empty object). |

Results:

| Name | Type | Description |
| --- | --- | --- |
| result | string | The socket address of the current directory, usable as params.directory in jamulusclient/pollServerList. |


### jamulusclient/getDirectories

Returns the list of directories in the same order as presented in Jamulus.

Parameters:

| Name | Type | Description |
| --- | --- | --- |
| params | object | No parameters (empty object). |

Results:

| Name | Type | Description |
| --- | --- | --- |
| result | array | Array of directory socket address strings, usable as params.directory in jamulusclient/pollServerList. |


### jamulusclient/getMidiDevices

Returns a list of available MIDI input devices.
Expand Down
33 changes: 33 additions & 0 deletions src/clientrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,39 @@ CClientRpc::CClientRpc ( CClient* pClient, CClientSettings* pSettings, CRpcServe
response["result"] = "ok";
} );

/// @rpc_method jamulusclient/getDirectories
/// @brief Returns the list of directories in the same order as presented in Jamulus.
/// @param {object} params - No parameters (empty object).
/// @result {array} result - Array of directory socket address strings, usable as params.directory in jamulusclient/pollServerList.
pRpcServer->HandleMethod ( "jamulusclient/getDirectories", [=] ( const QJsonObject& params, QJsonObject& response ) {
QJsonArray arrDirectories;
Copy link
Copy Markdown
Collaborator

@pljones pljones Apr 27, 2026

Choose a reason for hiding this comment

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

Ideally this would be simplified:

  • CClient would own "get the user's current directories"
  • CConnectDlg would put that in the Directory drop down
  • CClientRpc would return that here

Otherwise we're duplicating functionality for no benefit.

// built-in directories in UI order
for ( int i = AT_DEFAULT; i < AT_CUSTOM; i++ )
{
arrDirectories.append ( NetworkUtil::GetDirectoryAddress ( static_cast<EDirectoryType> ( i ), "" ) );
}
// custom directories — stored newest-first, displayed oldest-first (reverse iteration)
for ( int i = MAX_NUM_SERVER_ADDR_ITEMS - 1; i >= 0; i-- )
{
if ( !m_pSettings->vstrDirectoryAddress[i].isEmpty() )
{
arrDirectories.append ( m_pSettings->vstrDirectoryAddress[i] );
}
}
response["result"] = arrDirectories;
Q_UNUSED ( params );
} );

/// @rpc_method jamulusclient/getCurrentDirectory
/// @brief Returns the currently selected directory socket address.
/// @param {object} params - No parameters (empty object).
/// @result {string} result - The socket address of the current directory, usable as params.directory in jamulusclient/pollServerList.
pRpcServer->HandleMethod ( "jamulusclient/getCurrentDirectory", [=] ( const QJsonObject& params, QJsonObject& response ) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Go to Settings -> Advanced. The data item you're collecting here is the "current" entry in the custom directories list, I think.

Not Connect->Directory.

Copy link
Copy Markdown
Collaborator

@pljones pljones Apr 27, 2026

Choose a reason for hiding this comment

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

So again, ideally:

  • CClient would own "current directory index" which was an index into the list it returned when asked to "get the user's current directories"
  • CConnectDlg would emit a "current directory index changed" signal when the selection changed
  • CClient would handle that, storing the new value in CClientSettings
  • CClientSettings would emit its own "current directory index changed" signal
  • CConnectDlg would handle that by retrieving ensuring the dropdown was displayed correctly, then retrieving the new server list from the appropriate entry from "get the user's current directories"

I think there are JSON-RPC calls that can handle emitted signals by emitting new state, aren't there? They not just responses?

  • So CClientRpc would handle the CClientSettings "current directory index changed" signal by sending the new address.

This also begs for a JSON-RPC "setCurrentDirectory", of course, to act the same as selecting a new entry in the dropdown.

response["result"] =
NetworkUtil::GetDirectoryAddress ( m_pSettings->eDirectoryType, m_pSettings->vstrDirectoryAddress[m_pSettings->iCustomDirectoryIndex] );
Q_UNUSED ( params );
} );

/// @rpc_method jamulus/getMode
/// @brief Returns the current mode, i.e. whether Jamulus is running as a server or client.
/// @param {object} params - No parameters (empty object).
Expand Down
Loading