### Control JACK Server via qjackctlMainForm (C++)
Source: https://context7.com/rncbc/qjackctl/llms.txt
Example of using the qjackctlMainForm singleton to start the JACK server and append messages to the log. Requires obtaining the singleton instance first.
```cpp
// Example usage in external code:
qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
if (pMainForm) {
pMainForm->startJack();
pMainForm->appendMessages("JACK server started");
}
```
--------------------------------
### D-Bus: Show Setup Dialog
Source: https://context7.com/rncbc/qjackctl/llms.txt
Opens the QjackCtl setup dialog for configuring JACK parameters via D-Bus.
```bash
dbus-send --system / org.rncbc.qjackctl.setup
```
--------------------------------
### Build with Custom Install Prefix
Source: https://context7.com/rncbc/qjackctl/llms.txt
Specifies a custom directory for installing QjackCtl, overriding the default system-wide location. After setting the prefix, build and install the application.
```bash
# Build with custom install prefix
cmake -DCMAKE_INSTALL_PREFIX=/opt/qjackctl -B build
cmake --build build
sudo cmake --install build
```
--------------------------------
### Start QjackCtl with JACK Server Auto-start
Source: https://context7.com/rncbc/qjackctl/llms.txt
Use this command to launch QjackCtl and automatically start the JACK audio server.
```bash
qjackctl --start
```
--------------------------------
### Display Install Prefix
Source: https://github.com/rncbc/qjackctl/blob/main/CMakeLists.txt
Prints the installation prefix for the project. This indicates the base directory where the project's files will be installed.
```cmake
message ("\n Install prefix . . . . . . . . . . . . . . . . . .: ${CONFIG_PREFIX}\n")
```
--------------------------------
### Install System-Wide
Source: https://context7.com/rncbc/qjackctl/llms.txt
Installs QjackCtl to the system-wide location after building. This command typically requires administrator privileges.
```bash
# Install system-wide
sudo cmake --install build
```
--------------------------------
### Install on Windows
Source: https://github.com/rncbc/qjackctl/blob/main/src/CMakeLists.txt
Defines installation rules for the runtime target and translations on Windows.
```cmake
install (TARGETS ${PROJECT_NAME} RUNTIME
DESTINATION .)
# Use same path as windeployqt for translations
install (FILES ${QM_FILES}
DESTINATION translations)
endif ()
```
--------------------------------
### Start QjackCtl with an Active Patchbay Definition
Source: https://context7.com/rncbc/qjackctl/llms.txt
Starts QjackCtl and loads a specific patchbay definition file, which defines audio and MIDI connections.
```bash
qjackctl --active-patchbay /home/user/.config/qjackctl/default.xml
```
--------------------------------
### Configure macOS Bundle Installation
Source: https://github.com/rncbc/qjackctl/blob/main/src/CMakeLists.txt
Sets up the macOS bundle properties, including icon, Info.plist, and installation destination.
```cmake
# Generate bundle on MacOS with QjackCtl.icns as the icon and a custom Info.plist file.
target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/images/QjackCtl.icns)
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/images/QjackCtl.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE True
OUTPUT_NAME QjackCtl
MACOSX_RPATH ON
INSTALL_RPATH @executable_path/../Frameworks
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/appdata/Info.plist
)
install (TARGETS ${PROJECT_NAME} BUNDLE
DESTINATION ${CMAKE_INSTALL_BINDIR})
elseif (WIN32)
```
--------------------------------
### Install and Use GNU Sed
Source: https://github.com/rncbc/qjackctl/wiki/Build-from-source
Install GNU sed and prepend its path to the current session's PATH if configure errors related to invalid sed options.
```bash
brew install gnu-sed
```
```bash
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
```
--------------------------------
### Start QjackCtl with a Specific Preset
Source: https://context7.com/rncbc/qjackctl/llms.txt
Launches QjackCtl using a predefined server configuration preset. Ensure the preset name is enclosed in quotes if it contains spaces.
```bash
qjackctl --preset "Low Latency"
```
--------------------------------
### Initialize qjackctlPreset (C++)
Source: https://context7.com/rncbc/qjackctl/llms.txt
Example demonstrating how to initialize and set parameters for a qjackctlPreset object. This involves assigning values to member variables like driver, sample rate, and buffer size.
```cpp
// Usage example:
qjackctlPreset preset;
preset.sDriver = "alsa";
preset.sInterface = "hw:0";
preset.iSampleRate = 48000;
preset.iFrames = 256;
preset.iPeriods = 2;
preset.bRealtime = true;
preset.iPriority = 70;
```
--------------------------------
### Display QjackCtl Version Information
Source: https://context7.com/rncbc/qjackctl/llms.txt
Prints the installed version of QjackCtl to the console.
```bash
qjackctl --version
```
--------------------------------
### Install on Linux/Unix
Source: https://github.com/rncbc/qjackctl/blob/main/src/CMakeLists.txt
Defines installation rules for targets, translations, icons, desktop entries, and man pages on Linux/Unix systems.
```cmake
if (MINGW OR (UNIX AND NOT APPLE))
install (TARGETS ${PROJECT_NAME} RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR})
install (FILES ${QM_FILES}
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/translations)
install (FILES images/${PROJECT_NAME}.png
RENAME org.rncbc.${PROJECT_NAME}.png
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/32x32/apps)
install (FILES images/${PROJECT_NAME}.svg
RENAME org.rncbc.${PROJECT_NAME}.svg
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
install (FILES appdata/org.rncbc.${PROJECT_NAME}.desktop
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
install (FILES appdata/org.rncbc.${PROJECT_NAME}.metainfo.xml
DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
install (FILES man1/${PROJECT_NAME}.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
install (FILES man1/${PROJECT_NAME}.fr.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/fr/man1 RENAME ${PROJECT_NAME}.1)
install (FILES palette/KXStudio.conf palette/Wonton\ Soup.conf
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/palette)
elseif (APPLE)
```
--------------------------------
### qjackctlSession XML Structure Example
Source: https://github.com/rncbc/qjackctl/blob/main/src/qjackctlSessionFile.txt
This is an example of the qjackctlSession XML format. It defines a session with a client, its command, and a port with connection details. Use this structure to save and load JACK connection states.
```xml
client-command
.
.
.
.
.
.
.
.
.
```
--------------------------------
### QjackCtl Command Line Interface
Source: https://context7.com/rncbc/qjackctl/llms.txt
QjackCtl provides several command-line options for starting the JACK server, applying presets, and managing configurations.
```APIDOC
## QjackCtl Command Line Interface
QjackCtl supports several command-line options for automation and scripting, allowing immediate server startup and preset configuration.
### Usage
```bash
qjackctl [options]
```
### Options
- `--start`: Start QjackCtl with JACK server auto-start.
- `--preset ""`: Start with a specific preset configuration.
- `--active-patchbay ""`: Start with a specific active patchbay definition file.
- `--server-name ""`: Start with a custom JACK server name.
- `--version`: Display version information.
- `--help`: Display help information.
### Examples
```bash
# Start QjackCtl with JACK server auto-start
qjackctl --start
# Start with a specific preset configuration
qjackctl --preset "Low Latency"
# Start with a specific active patchbay definition file
qjackctl --active-patchbay /home/user/.config/qjackctl/default.xml
# Start with a custom JACK server name
qjackctl --server-name myserver
# Display version information
qjackctl --version
# Display help
qjackctl --help
```
```
--------------------------------
### Start QjackCtl with a Custom Server Name
Source: https://context7.com/rncbc/qjackctl/llms.txt
Initiates QjackCtl with a non-default JACK server name, useful for running multiple JACK instances.
```bash
qjackctl --server-name myserver
```
--------------------------------
### Force Link Qt5
Source: https://github.com/rncbc/qjackctl/wiki/Build-from-source
Use this command to force link Qt5 if the configure script cannot find it, even if installed.
```bash
brew link qt5 --force
```
--------------------------------
### D-Bus: Start JACK Audio Server
Source: https://context7.com/rncbc/qjackctl/llms.txt
Initiates the JACK audio server using a D-Bus command. This command is typically sent to the system bus.
```bash
dbus-send --system / org.rncbc.qjackctl.start
```
--------------------------------
### Access qjackctlMainForm Singleton (C++)
Source: https://context7.com/rncbc/qjackctl/llms.txt
Demonstrates how to get the singleton instance of the qjackctlMainForm class. This is the primary interface for controlling JACK server operations.
```cpp
// Main form singleton access - defined in qjackctlMainForm.h
class qjackctlMainForm : public QWidget
{
public:
// Get singleton instance
static qjackctlMainForm *getInstance();
// Setup and configuration
bool setup(qjackctlSetup *pSetup);
qjackctlSetup *setup() const;
// JACK client accessor
jack_client_t *jackClient() const;
// ALSA sequencer accessor
snd_seq_t *alsaSeq() const;
// Message logging
void appendMessages(const QString& s);
// Patchbay management
bool isActivePatchbay(const QString& sPatchbayPath) const;
void updateActivePatchbay();
void setActivePatchbay(const QString& sPatchbayPath);
void setRecentPatchbays(const QStringList& patchbays);
// UI stabilization
void stabilizeForm();
// Statistics refresh
void refreshXrunStats();
// Connection refresh
void refreshJackConnections(bool bClear = false);
void refreshAlsaConnections(bool bClear = false);
void refreshPatchbay();
// Buffer size control
bool resetBuffSize(jack_nframes_t nframes);
// Server control
void restartJack();
bool isJackDetach() const;
public slots:
// Server control slots
void startJack();
void stopJack();
void toggleJack();
// Dialog control
void showSetupForm();
void showAboutForm();
// Statistics
void resetXrunStats();
// Preset/patchbay activation
void activatePreset(const QString& sPreset);
void activatePatchbay(const QString& sPatchbayPath);
};
```
--------------------------------
### QjackCtl Configuration File - Default Preset Parameters
Source: https://context7.com/rncbc/qjackctl/llms.txt
Defines the JACK server parameters for a specific preset, including sample rate, buffer size, periods, and audio interface settings. This is an example for the 'default' preset.
```ini
[default]
ServerPrefix=jackd
ServerName=
Realtime=true
SoftMode=false
Monitor=false
Shorts=false
NoMemLock=false
HWMeter=false
IgnoreHW=false
Priority=70
Frames=1024
SampleRate=48000
Periods=2
WordLength=16
Wait=21333
Chan=0
Driver=alsa
Interface=hw:0
Audio=0
Dither=0
Timeout=500
InDevice=
OutDevice=
InChannels=0
OutChannels=0
InLatency=0
OutLatency=0
StartDelay=2
Sync=false
Verbose=false
PortMax=256
MidiDriver=none
```
--------------------------------
### Display QjackCtl Help Information
Source: https://context7.com/rncbc/qjackctl/llms.txt
Shows all available command-line options and their descriptions for QjackCtl.
```bash
qjackctl --help
```
--------------------------------
### Display Project and Build Information
Source: https://github.com/rncbc/qjackctl/blob/main/CMakeLists.txt
Prints the project title, version, Qt version, and build type. This is typically used at the beginning of a configuration script to inform the user about the build environment.
```cmake
message ("\n ${PROJECT_TITLE} ${PROJECT_VERSION} (Qt ${QT_VERSION})")
message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")
```
--------------------------------
### Build with Specific Qt Version
Source: https://context7.com/rncbc/qjackctl/llms.txt
Configures the build to use Qt6, with a fallback to Qt5 if Qt6 is not available. This is useful for ensuring compatibility or leveraging newer Qt features.
```bash
# Build with specific Qt version (Qt6 preferred, Qt5 fallback)
cmake -DCONFIG_QT6=ON -B build
```
--------------------------------
### Server Preset Structure (C++ API)
Source: https://context7.com/rncbc/qjackctl/llms.txt
The qjackctlPreset structure defines all savable and loadable JACK server configuration parameters.
```APIDOC
## Server Preset Structure (C++ API)
The qjackctlPreset structure contains all JACK server configuration parameters that can be saved and loaded as named presets.
```cpp
// Server settings preset - defined in qjackctlSetup.h
struct qjackctlPreset
{
QString sServerPrefix; // Server executable path (e.g., "jackd")
QString sServerName; // JACK server name
bool bRealtime; // Enable realtime scheduling
bool bSoftMode; // Soft mode (ignore xruns)
bool bMonitor; // Enable monitor ports
bool bShorts; // Use 16-bit samples
bool bNoMemLock; // Do not lock memory
bool bUnlockMem; // Unlock memory
bool bHWMeter; // Enable hardware metering
bool bIgnoreHW; // Ignore hardware
int iPriority; // Realtime priority (0-99)
int iFrames; // Buffer size in frames (64-4096)
int iSampleRate; // Sample rate (22050-192000)
int iPeriods; // Number of periods (2-4)
int iWordLength; // Word length in bits
int iWait; // Wait time in microseconds
int iChan; // Number of channels
QString sDriver; // Audio driver (alsa, dummy, etc.)
QString sInterface; // Audio interface (hw:0, etc.)
int iAudio; // Audio mode (duplex=0, capture=1, playback=2)
int iDither; // Dither mode
int iTimeout; // Client timeout in milliseconds
QString sInDevice; // Input device
QString sOutDevice; // Output device
int iInChannels; // Input channels
int iOutChannels; // Output channels
int iInLatency; // Input latency
int iOutLatency; // Output latency
int iStartDelay; // Startup delay in seconds
bool bSync; // Synchronous mode
bool bVerbose; // Verbose output
int iPortMax; // Maximum number of ports
QString sMidiDriver; // MIDI driver (none, seq, raw)
QString sServerSuffix; // Additional server arguments
uchar ucClockSource; // Clock source
uchar ucSelfConnectMode;// Self-connect mode
};
// Usage example:
qjackctlPreset preset;
preset.sDriver = "alsa";
preset.sInterface = "hw:0";
preset.iSampleRate = 48000;
preset.iFrames = 256;
preset.iPeriods = 2;
preset.bRealtime = true;
preset.iPriority = 70;
```
```
--------------------------------
### Build with All Optional Features
Source: https://context7.com/rncbc/qjackctl/llms.txt
Enables all available optional features for QjackCtl during the build process. This provides the most comprehensive functionality, including system tray, session management, port aliases, metadata, MIDI, CV, OSC, ALSA Seq, D-Bus, and XUnique.
```bash
# Build with all optional features enabled
cmake \
-DCONFIG_SYSTEM_TRAY=ON \
-DCONFIG_JACK_SESSION=ON \
-DCONFIG_JACK_PORT_ALIASES=ON \
-DCONFIG_JACK_METADATA=ON \
-DCONFIG_JACK_MIDI=ON \
-DCONFIG_JACK_CV=ON \
-DCONFIG_JACK_OSC=ON \
-DCONFIG_ALSA_SEQ=ON \
-DCONFIG_DBUS=ON \
-DCONFIG_XUNIQUE=ON \
-B build
```
--------------------------------
### Basic CMake Build
Source: https://context7.com/rncbc/qjackctl/llms.txt
Compiles QjackCtl using CMake. The build artifacts are placed in a 'build' directory. Use '--parallel' to speed up compilation by utilizing multiple cores.
```bash
# Basic build
cmake -B build
cmake --build build --parallel 4
```
--------------------------------
### QjackCtl Configuration File - Options Section
Source: https://context7.com/rncbc/qjackctl/llms.txt
Defines general QjackCtl application options, such as singleton behavior, logging, and D-Bus enablement. Located at ~/.config/rncbc.org/QjackCtl.conf.
```ini
[Options]
Singleton=true
ServerName=default
StartupScript=false
StartupScriptShell=/path/to/startup.sh
PostStartupScript=false
ShutdownScript=false
StdoutCapture=true
XrunRegex=xrun of at least ([0-9|\.]+) msecs
ActivePatchbay=true
ActivePatchbayPath=/home/user/.config/qjackctl/default.xml
MessagesLog=false
MessagesLogPath=/home/user/.config/qjackctl/messages.log
TimeDisplay=0
DisplayEffect=true
DisplayBlink=true
SystemTray=true
StartMinimized=false
KeepOnTop=false
AlsaSeqEnabled=true
DBusEnabled=true
```
--------------------------------
### Deploy Qt Dependencies on Windows
Source: https://github.com/rncbc/qjackctl/blob/main/src/CMakeLists.txt
Configures a post-build custom command to run windeployqt for deploying Qt dependencies on Windows when CONFIG_INSTALL_QT is enabled.
```cmake
if (WIN32 AND CONFIG_INSTALL_QT)
get_target_property (_qt_qmake_location Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
get_filename_component (_qt_bin_dir "${_qt_qmake_location}" DIRECTORY)
set (QT_WINDEPLOYQT "${_qt_bin_dir}/windeployqt.exe")
if (EXISTS ${QT_WINDEPLOYQT})
# execute windeployqt in a tmp directory after build
if (QT_VERSION_MAJOR MATCHES "5")
# These options are not available with Qt6
set (WINDEPLOYQT_EXTRA_OPTIONS --no-webkit2 --no-angle)
endif ()
add_custom_command (TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/windeployqt"
COMMAND set PATH=${_qt_bin_dir}$%PATH%
COMMAND "${QT_WINDEPLOYQT}"
--dir "${CMAKE_CURRENT_BINARY_DIR}/windeployqt"
--no-quick-import
--no-opengl-sw
--no-virtualkeyboard
--no-svg
${WINDEPLOYQT_EXTRA_OPTIONS}
"$"
USES_TERMINAL
)
# copy deployment directory during installation
install (
DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/windeployqt/"
DESTINATION .
)
endif ()
endif ()
```
--------------------------------
### D-Bus: Show/Toggle Connections Window
Source: https://context7.com/rncbc/qjackctl/llms.txt
Manages the display of the QjackCtl connections window through D-Bus.
```bash
dbus-send --system / org.rncbc.qjackctl.connections
```
--------------------------------
### QjackCtl Configuration File
Source: https://context7.com/rncbc/qjackctl/llms.txt
Details the structure and parameters of the QjackCtl configuration file, which stores application settings.
```APIDOC
## Configuration File
QjackCtl stores all settings in a configuration file that can be backed up or shared between systems. The file uses INI format.
### Location
`~/.config/rncbc.org/QjackCtl.conf`
### Format
INI file format with sections and key-value pairs.
### Sections and Parameters
#### `[Options]`
- `Singleton` (boolean): Whether to enforce a single instance of QjackCtl.
- `ServerName` (string): Default JACK server name.
- `StartupScript` (boolean): Whether to execute a startup script.
- `StartupScriptShell` (string): Path to the startup script.
- `PostStartupScript` (boolean): Whether to execute a post-startup script.
- `ShutdownScript` (boolean): Whether to execute a shutdown script.
- `StdoutCapture` (boolean): Whether to capture stdout.
- `XrunRegex` (string): Regular expression to detect xruns.
- `ActivePatchbay` (boolean): Whether to load an active patchbay on startup.
- `ActivePatchbayPath` (string): Path to the active patchbay definition file.
- `MessagesLog` (boolean): Whether to log messages.
- `MessagesLogPath` (string): Path to the messages log file.
- `TimeDisplay` (integer): Format for time display.
- `DisplayEffect` (boolean): Whether to display effects.
- `DisplayBlink` (boolean): Whether to display blinking indicators.
- `SystemTray` (boolean): Whether to enable system tray icon.
- `StartMinimized` (boolean): Whether to start minimized.
- `KeepOnTop` (boolean): Whether to keep the main window on top.
- `AlsaSeqEnabled` (boolean): Whether ALSA sequencer is enabled.
- `DBusEnabled` (boolean): Whether D-Bus interface is enabled.
#### `[Presets]`
- `DefPreset` (string): The name of the default preset.
#### `[]` (e.g., `[default]`)
These sections define specific JACK server configurations.
- `ServerPrefix` (string): Prefix for the JACK server command.
- `ServerName` (string): Name of the JACK server instance.
- `Realtime` (boolean): Enable real-time scheduling.
- `SoftMode` (boolean): Enable soft real-time mode.
- `Monitor` (boolean): Enable JACK monitor.
- `Shorts` (boolean): Use short names for ports.
- `NoMemLock` (boolean): Disable memory locking.
- `HWMeter` (boolean): Enable hardware meter.
- `IgnoreHW` (boolean): Ignore hardware settings.
- `Priority` (integer): Real-time priority.
- `Frames` (integer): Buffer size in frames.
- `SampleRate` (integer): Sample rate in Hz.
- `Periods` (integer): Number of periods per buffer.
- `WordLength` (integer): Bit depth of audio samples.
- `Wait` (integer): Wait time in microseconds.
- `Chan` (integer): Number of channels.
- `Driver` (string): Audio driver (e.g., `alsa`, `oss`).
- `Interface` (string): Audio interface name (e.g., `hw:0`).
- `Audio` (integer): Audio device number.
- `Dither` (integer): Dithering type.
- `Timeout` (integer): Timeout in milliseconds.
- `InDevice` (string): Input device name.
- `OutDevice` (string): Output device name.
- `InChannels` (integer): Number of input channels.
- `OutChannels` (integer): Number of output channels.
- `InLatency` (integer): Input latency in frames.
- `OutLatency` (integer): Output latency in frames.
- `StartDelay` (integer): Delay in milliseconds before starting JACK.
- `Sync` (boolean): Enable sample rate synchronization.
- `Verbose` (boolean): Enable verbose output.
- `PortMax` (integer): Maximum number of ports.
- `MidiDriver` (string): MIDI driver (e.g., `none`, `alsa`).
### Example Configuration Snippet
```ini
[Options]
Singleton=true
ServerName=default
ActivePatchbay=true
ActivePatchbayPath=/home/user/.config/qjackctl/default.xml
[Presets]
DefPreset=default
[default]
ServerPrefix=jackd
Realtime=true
Frames=1024
SampleRate=48000
Periods=2
Driver=alsa
Interface=hw:0
```
```
--------------------------------
### Define qjackctlPreset Structure (C++)
Source: https://context7.com/rncbc/qjackctl/llms.txt
Defines the structure for JACK server settings presets, including server path, name, realtime settings, buffer sizes, sample rate, and driver information. Used for saving and loading JACK configurations.
```cpp
// Server settings preset - defined in qjackctlSetup.h
struct qjackctlPreset
{
QString sServerPrefix; // Server executable path (e.g., "jackd")
QString sServerName; // JACK server name
bool bRealtime; // Enable realtime scheduling
bool bSoftMode; // Soft mode (ignore xruns)
bool bMonitor; // Enable monitor ports
bool bShorts; // Use 16-bit samples
bool bNoMemLock; // Do not lock memory
bool bUnlockMem; // Unlock memory
bool bHWMeter; // Enable hardware metering
bool bIgnoreHW; // Ignore hardware
int iPriority; // Realtime priority (0-99)
int iFrames; // Buffer size in frames (64-4096)
int iSampleRate; // Sample rate (22050-192000)
int iPeriods; // Number of periods (2-4)
int iWordLength; // Word length in bits
int iWait; // Wait time in microseconds
int iChan; // Number of channels
QString sDriver; // Audio driver (alsa, dummy, etc.)
QString sInterface; // Audio interface (hw:0, etc.)
int iAudio; // Audio mode (duplex=0, capture=1, playback=2)
int iDither; // Dither mode
int iTimeout; // Client timeout in milliseconds
QString sInDevice; // Input device
QString sOutDevice; // Output device
int iInChannels; // Input channels
int iOutChannels; // Output channels
int iInLatency; // Input latency
int iOutLatency; // Output latency
int iStartDelay; // Startup delay in seconds
bool bSync; // Synchronous mode
bool bVerbose; // Verbose output
int iPortMax; // Maximum number of ports
QString sMidiDriver; // MIDI driver (none, seq, raw)
QString sServerSuffix; // Additional server arguments
uchar ucClockSource; // Clock source
uchar ucSelfConnectMode;// Self-connect mode
};
```
--------------------------------
### Deploy Qt Dependencies on macOS
Source: https://github.com/rncbc/qjackctl/blob/main/src/CMakeLists.txt
Configures a post-build custom command to run macdeployqt for deploying Qt dependencies on macOS when CONFIG_INSTALL_QT is enabled.
```cmake
if (APPLE AND CONFIG_INSTALL_QT)
get_target_property (_qt_qmake_location Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
get_filename_component (_qt_bin_dir "${_qt_qmake_location}" DIRECTORY)
find_program(QT_MACDEPLOYQT macdeployqt HINTS "${_qt_bin_dir}")
if (EXISTS ${QT_MACDEPLOYQT})
add_custom_command (TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND "${QT_MACDEPLOYQT}" "$/../.."
USES_TERMINAL
)
endif ()
endif ()
```
--------------------------------
### D-Bus: Save as Template
Source: https://context7.com/rncbc/qjackctl/llms.txt
Saves the current JACK session as a template configuration using D-Bus.
```bash
dbus-send --system / org.rncbc.qjackctl.savetemplate
```
--------------------------------
### Comment Out Qt Version Check in Configure
Source: https://github.com/rncbc/qjackctl/wiki/Build-from-source
If the configure script reports 'Qt 5.1 or greater is required' incorrectly, comment out specific lines in the configure script to bypass this check.
```bash
if ac_fn_cxx_try_compile "$LINENO"; then :
ac_cv_qtversion="yes"
#else
#
# echo "no; Qt 5.1 or greater is required"
# exit 1
#
fi
```
--------------------------------
### Display Configuration Options
Source: https://github.com/rncbc/qjackctl/blob/main/CMakeLists.txt
Uses the SHOW_OPTION macro to display the status of various build configuration flags. Each call checks a specific feature's support and prints its status.
```cmake
show_option (" JACK Audio Connection Kit support . . . . . . . ." CONFIG_JACK)
```
```cmake
show_option (" JACK Realtime support . . . . . . . . . . . . . ." CONFIG_JACK_REALTIME)
```
```cmake
show_option (" JACK Transport support . . . . . . . . . . . . . ." CONFIG_JACK_TRANSPORT)
```
```cmake
show_option (" JACK XRUN delay support . . . . . . . . . . . . ." CONFIG_JACK_XRUN_DELAY)
```
```cmake
show_option (" JACK Maximum scheduling delay support . . . . . ." CONFIG_JACK_MAX_DELAY)
```
```cmake
show_option (" JACK Port aliases support . . . . . . . . . . . ." CONFIG_JACK_PORT_ALIASES)
```
```cmake
show_option (" JACK Metadata support . . . . . . . . . . . . . ." CONFIG_JACK_METADATA)
```
```cmake
show_option (" JACK MIDI support . . . . . . . . . . . . . . . ." CONFIG_JACK_MIDI)
```
```cmake
show_option (" JACK CV support . . . . . . . . . . . . . . . ." CONFIG_JACK_CV)
```
```cmake
show_option (" JACK OSC support . . . . . . . . . . . . . . . ." CONFIG_JACK_OSC)
```
```cmake
show_option (" JACK Session support . . . . . . . . . . . . . ." CONFIG_JACK_SESSION)
```
```cmake
show_option (" JACK Version support (JACK2) . . . . . . . . . ." CONFIG_JACK_VERSION)
```
```cmake
show_option (" ALSA MIDI Sequencer support . . . . . . . . . ." CONFIG_ALSA_SEQ)
```
```cmake
show_option (" System tray icon support . . . . . . . . . . . ." CONFIG_SYSTEM_TRAY)
```
```cmake
show_option (" D-Bus interface support . . . . . . . . . . . ." CONFIG_DBUS)
```
```cmake
show_option (" PortAudio interface support . . . . . . . . . ." CONFIG_PORTAUDIO)
```
```cmake
show_option (" CoreAudio interface support . . . . . . . . . ." CONFIG_COREAUDIO)
```
```cmake
show_option (" System tray icon support . . . . . . . . . . . ." CONFIG_SYSTEM_TRAY)
```
```cmake
show_option (" Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE)
```
```cmake
show_option (" Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE)
```
```cmake
show_option (" Install Qt on MacOS / Windows . . . . . . . . . ." CONFIG_INSTALL_QT)
```
--------------------------------
### D-Bus: Show About Dialog
Source: https://context7.com/rncbc/qjackctl/llms.txt
Displays the QjackCtl about dialog, showing version and license information, through D-Bus.
```bash
dbus-send --system / org.rncbc.qjackctl.about
```
--------------------------------
### Main Form API
Source: https://context7.com/rncbc/qjackctl/llms.txt
The qjackctlMainForm class provides the primary interface for controlling JACK server operations, managing connections, and monitoring status.
```APIDOC
## Main Form API
The qjackctlMainForm class is the primary interface controlling JACK server operations, providing methods for server control, connection management, and status monitoring.
### Methods
#### Setup and Configuration
- `bool setup(qjackctlSetup *pSetup)`: Sets up the main form with provided setup parameters.
- `qjackctlSetup *setup() const`: Returns the current setup configuration.
#### JACK Client Accessor
- `jack_client_t *jackClient() const`: Returns the JACK client pointer.
#### ALSA Sequencer Accessor
- `snd_seq_t *alsaSeq() const`: Returns the ALSA sequencer pointer.
#### Message Logging
- `void appendMessages(const QString& s)`: Appends a message to the JACK log.
#### Patchbay Management
- `bool isActivePatchbay(const QString& sPatchbayPath) const`: Checks if a patchbay is active.
- `void updateActivePatchbay()`: Updates the active patchbay status.
- `void setActivePatchbay(const QString& sPatchbayPath)`: Sets a specific patchbay as active.
- `void setRecentPatchbays(const QStringList& patchbays)`: Sets the list of recently used patchbays.
#### UI Stabilization
- `void stabilizeForm()`: Stabilizes the user interface.
#### Statistics Refresh
- `void refreshXrunStats()`: Refreshes the xrun (underrun/overrun) statistics.
#### Connection Refresh
- `void refreshJackConnections(bool bClear = false)`: Refreshes JACK connections.
- `void refreshAlsaConnections(bool bClear = false)`: Refreshes ALSA connections.
- `void refreshPatchbay()`: Refreshes the patchbay view.
#### Buffer Size Control
- `bool resetBuffSize(jack_nframes_t nframes)`: Resets the buffer size.
#### Server Control
- `void restartJack()`: Restarts the JACK server.
- `bool isJackDetach() const`: Checks if JACK is detached.
### Slots
#### Server Control Slots
- `void startJack()`: Starts the JACK server.
- `void stopJack()`: Stops the JACK server.
- `void toggleJack()`: Toggles the JACK server state (start/stop).
#### Dialog Control Slots
- `void showSetupForm()`: Shows the setup dialog.
- `void showAboutForm()`: Shows the about dialog.
#### Statistics Slots
- `void resetXrunStats()`: Resets the xrun statistics.
#### Preset/Patchbay Activation Slots
- `void activatePreset(const QString& sPreset)`: Activates a JACK preset.
- `void activatePatchbay(const QString& sPatchbayPath)`: Activates a specific patchbay.
### Example Usage
```cpp
// Main form singleton access - defined in qjackctlMainForm.h
class qjackctlMainForm : public QWidget
{
public:
// Get singleton instance
static qjackctlMainForm *getInstance();
// Setup and configuration
bool setup(qjackctlSetup *pSetup);
qjackctlSetup *setup() const;
// JACK client accessor
jack_client_t *jackClient() const;
// ALSA sequencer accessor
snd_seq_t *alsaSeq() const;
// Message logging
void appendMessages(const QString& s);
// Patchbay management
bool isActivePatchbay(const QString& sPatchbayPath) const;
void updateActivePatchbay();
void setActivePatchbay(const QString& sPatchbayPath);
void setRecentPatchbays(const QStringList& patchbays);
// UI stabilization
void stabilizeForm();
// Statistics refresh
void refreshXrunStats();
// Connection refresh
void refreshJackConnections(bool bClear = false);
void refreshAlsaConnections(bool bClear = false);
void refreshPatchbay();
// Buffer size control
bool resetBuffSize(jack_nframes_t nframes);
// Server control
void restartJack();
bool isJackDetach() const;
public slots:
// Server control slots
void startJack();
void stopJack();
void toggleJack();
// Dialog control
void showSetupForm();
void showAboutForm();
// Statistics
void resetXrunStats();
// Preset/patchbay activation
void activatePreset(const QString& sPreset);
void activatePatchbay(const QString& sPatchbayPath);
};
// Example usage in external code:
qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
if (pMainForm) {
pMainForm->startJack();
pMainForm->appendMessages("JACK server started");
}
```
```
--------------------------------
### D-Bus: Load Session
Source: https://context7.com/rncbc/qjackctl/llms.txt
Loads a previously saved JACK session configuration using D-Bus.
```bash
dbus-send --system / org.rncbc.qjackctl.load
```
--------------------------------
### Configure Windows Executable Properties
Source: https://github.com/rncbc/qjackctl/blob/main/src/CMakeLists.txt
Sets properties for Windows executables, including defining _USE_MATH_DEFINES.
```cmake
if (WIN32)
set_target_properties (${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE true)
target_compile_definitions (${PROJECT_NAME} PUBLIC _USE_MATH_DEFINES)
endif ()
```
--------------------------------
### Configure macOS Bundle Properties
Source: https://github.com/rncbc/qjackctl/blob/main/src/CMakeLists.txt
Sets properties for macOS bundles, enabling the creation of a .app bundle.
```cmake
if (APPLE)
set_target_properties (${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE true)
endif ()
```
--------------------------------
### Define SHOW_OPTION Macro
Source: https://github.com/rncbc/qjackctl/blob/main/CMakeLists.txt
Defines a CMake macro to conditionally display configuration options. Use this macro to print whether a specific build configuration option is enabled or disabled.
```cmake
macro (SHOW_OPTION text value)
if (${value})
message ("${text}: yes")
else ()
message ("${text}: no")
endif ()
endmacro ()
```
--------------------------------
### Link Core Qt Libraries
Source: https://github.com/rncbc/qjackctl/blob/main/src/CMakeLists.txt
Links the essential Qt Widgets, Xml, and Svg libraries to the project.
```cmake
target_link_libraries (${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Xml Qt${QT_VERSION_MAJOR}::Svg)
```
--------------------------------
### D-Bus: Show/Toggle Session Window
Source: https://context7.com/rncbc/qjackctl/llms.txt
Controls the QjackCtl session management window's visibility using D-Bus.
```bash
dbus-send --system / org.rncbc.qjackctl.session
```
--------------------------------
### D-Bus: Show/Toggle Messages Window
Source: https://context7.com/rncbc/qjackctl/llms.txt
Manages the display of the QjackCtl messages window using D-Bus.
```bash
dbus-send --system / org.rncbc.qjackctl.messages
```
--------------------------------
### Check for JACK Functions
Source: https://github.com/rncbc/qjackctl/blob/main/CMakeLists.txt
Verifies the existence of specific JACK functions like jack_is_realtime, jack_free, jack_set_port_rename_callback, jack_transport_query, jack_get_xrun_delayed_usecs, and jack_get_max_delayed_usecs. Sets corresponding configuration variables.
```cmake
# Check for jack_is_realtime function.
check_symbol_exists (jack_is_realtime "jack/jack.h" CONFIG_JACK_REALTIME)
# Check for jack_free function.
check_symbol_exists (jack_free "jack/jack.h" CONFIG_JACK_FREE)
# Check for jack_set_port_rename_callback
check_symbol_exists (jack_set_port_rename_callback "jack/jack.h" CONFIG_JACK_PORT_RENAME)
# Check for jack_transport_query function.
check_symbol_exists (jack_transport_query "jack/transport.h" CONFIG_JACK_TRANSPORT)
# Check for jack_get_xrun_delayed_usecs function.
check_symbol_exists (jack_get_xrun_delayed_usecs "jack/statistics.h" CONFIG_JACK_XRUN_DELAY)
# Check for jack_get_max_delayed_usecs function.
check_symbol_exists (jack_get_max_delayed_usecs "jack/statistics.h" CONFIG_JACK_MAX_DELAY)
```
--------------------------------
### Debug Build with Stack Trace Support
Source: https://context7.com/rncbc/qjackctl/llms.txt
Configures the build for debugging with stack trace support enabled. This is invaluable for diagnosing issues and understanding program flow during development.
```bash
# Debug build with stack trace support
cmake -DCMAKE_BUILD_TYPE=Debug -DCONFIG_STACKTRACE=ON -B build
cmake --build build
```
--------------------------------
### D-Bus: Set Active Patchbay File
Source: https://context7.com/rncbc/qjackctl/llms.txt
Configures QjackCtl to use a specific patchbay definition file for connections via D-Bus. The file path must be a string.
```bash
dbus-send --system / org.rncbc.qjackctl.active-patchbay string:"/path/to/patchbay.xml"
```
--------------------------------
### D-Bus: Save and Quit
Source: https://context7.com/rncbc/qjackctl/llms.txt
Saves the current JACK session and then quits QjackCtl via D-Bus.
```bash
dbus-send --system / org.rncbc.qjackctl.savequit
```
--------------------------------
### D-Bus: Activate Specific Preset
Source: https://context7.com/rncbc/qjackctl/llms.txt
Applies a named JACK server preset configuration using D-Bus. The preset name must be a string.
```bash
dbus-send --system / org.rncbc.qjackctl.preset string:"Studio 48kHz"
```
--------------------------------
### Check for JACK MIDI Headers
Source: https://github.com/rncbc/qjackctl/blob/main/CMakeLists.txt
Checks for the 'jack/midiport.h' header if JACK MIDI support is enabled. Sets CONFIG_JACK_MIDI to 0 if the header is not found.
```cmake
# Check for JACK MIDI headers availability.
if (CONFIG_JACK_MIDI)
check_include_file (jack/midiport.h HAVE_JACK_MIDIPORT_H)
if (NOT HAVE_JACK_MIDIPORT_H)
set (CONFIG_JACK_MIDI 0)
endif ()
endif ()
```
--------------------------------
### Check for PortAudio Libraries
Source: https://github.com/rncbc/qjackctl/blob/main/CMakeLists.txt
Finds the PortAudio package if PortAudio support is enabled. If found, it sets CONFIG_PORTAUDIO to 1. If not found, it issues a warning and sets CONFIG_PORTAUDIO to 0.
```cmake
# Check for PORTAUDIO libraries.
if (CONFIG_PORTAUDIO)
find_package (PortAudio)
if (PortAudio_FOUND)
set (CONFIG_PORTAUDIO 1)
#set (CMAKE_REQUIRED_LIBRARIES "${PORTAUDIO_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
else ()
message (WARNING "*** PORTAUDIO library not found.")
set (CONFIG_PORTAUDIO 0)
endif ()
endif ()
```
--------------------------------
### D-Bus: Show/Toggle Graph Window
Source: https://context7.com/rncbc/qjackctl/llms.txt
Toggles the display of the QjackCtl graph window via D-Bus.
```bash
dbus-send --system / org.rncbc.qjackctl.graph
```
--------------------------------
### D-Bus: Show/Toggle Main Window
Source: https://context7.com/rncbc/qjackctl/llms.txt
Controls the visibility of the QjackCtl main window through a D-Bus message.
```bash
dbus-send --system / org.rncbc.qjackctl.main
```
--------------------------------
### QjackCtl Configuration File - Presets Section
Source: https://context7.com/rncbc/qjackctl/llms.txt
Specifies the default preset name used by QjackCtl. This section typically points to a named section defining the preset's parameters.
```ini
[Presets]
DefPreset=default
```
--------------------------------
### Add Source Subdirectory
Source: https://github.com/rncbc/qjackctl/blob/main/CMakeLists.txt
Includes the 'src' subdirectory, which likely contains the project's source files and their build configurations.
```cmake
add_subdirectory (src)
```
--------------------------------
### D-Bus: Show/Toggle Patchbay Window
Source: https://context7.com/rncbc/qjackctl/llms.txt
Controls the visibility of the QjackCtl patchbay window using D-Bus.
```bash
dbus-send --system / org.rncbc.qjackctl.patchbay
```
--------------------------------
### Link Qt Network Library
Source: https://github.com/rncbc/qjackctl/blob/main/src/CMakeLists.txt
Conditionally links the Qt Network library if CONFIG_XUNIQUE is enabled.
```cmake
if (CONFIG_XUNIQUE)
target_link_libraries (${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Network)
endif ()
```
--------------------------------
### D-Bus: Save Session
Source: https://context7.com/rncbc/qjackctl/llms.txt
Saves the current JACK session configuration using D-Bus.
```bash
dbus-send --system / org.rncbc.qjackctl.save
```
--------------------------------
### D-Bus: Transport Control - Play
Source: https://context7.com/rncbc/qjackctl/llms.txt
Initiates playback for the JACK transport using a D-Bus command.
```bash
dbus-send --system / org.rncbc.qjackctl.play
```
--------------------------------
### Session Management API
Source: https://context7.com/rncbc/qjackctl/llms.txt
Provides the qjackctlSession class for saving and restoring JACK session states, including client connections and configurations. Use for complete session persistence.
```cpp
// Session management - defined in qjackctlSession.h
class qjackctlSession
{
public:
qjackctlSession();
~qjackctlSession();
// Container structures
struct ConnectItem {
QString client_name;
QString port_name;
bool connected;
};
struct PortItem {
QString port_name;
int port_type;
int connected;
QList connects;
};
struct ClientItem {
QString client_name;
QString client_uuid;
QString client_command;
int connected;
QList ports;
};
typedef QHash ClientList;
// Client list accessor
const ClientList& clients() const;
// Cleanup
void clear();
// Session save types
enum SaveType { Save = 0, SaveAndQuit, SaveTemplate };
// Session I/O
bool save(const QString& sSessionDir, SaveType stype = SaveType::Save);
bool load(const QString& sSessionDir);
// Update connections
bool update();
// Infra-client management (non-JACK-session clients)
struct InfraClientItem {
QString client_name;
QString client_command;
};
typedef QHash InfraClientList;
InfraClientList& infra_clients();
void loadInfraClients(QSettings& settings);
void saveInfraClients(QSettings& settings);
void clearInfraClients();
// Client existence check
bool isJackClient(const QString& sClientName) const;
};
```