From 067f552837db21adfa226b5023d538288562778c Mon Sep 17 00:00:00 2001 From: audioprog Date: Wed, 13 Aug 2025 23:50:59 +0200 Subject: [PATCH] Jack_client_name added --- .gitignore | 12 ++++++++++++ src/butt.cpp | 10 ++++++++++ src/cfg.cpp | 8 ++++++++ src/cfg.h | 3 +++ src/port_audio.cpp | 13 +++++++++++++ 5 files changed, 46 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d1e9438 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +**.o +**/.deps +src/FLTK/.dirstamp +src/butt +po/Makefile +po/Makefile.in +po/POTFILES +src/Makefile +stamp-h1 +Makefile +config.status +config.log diff --git a/src/butt.cpp b/src/butt.cpp index 23d7c74..a75d68f 100644 --- a/src/butt.cpp +++ b/src/butt.cpp @@ -437,7 +437,11 @@ int main(int argc, char *argv[]) // Parse command line parameters DEBUG_LOG("Parsing command line parameters"); +#ifndef WIN32 + while ((opt = getopt(argc, argv, ":vhc:AULxs:drtnqu:a:p:SM:m:O:o:j:")) != -1) { +#else while ((opt = getopt(argc, argv, ":vhc:AULxs:drtnqu:a:p:SM:m:O:o:")) != -1) { +#endif switch (opt) { #ifndef BUILD_CLIENT case 'A': @@ -603,6 +607,12 @@ int main(int argc, char *argv[]) printf(_("Option -%c requires an argument\n"), optopt); print_usage(); return 1; +#ifndef WIN32 + case 'j': + jack_client_name = (char *)malloc((strlen(optarg) + 1) * sizeof(char)); + strcpy(jack_client_name, optarg); + break; +#endif default: printf(_("Command line parsing failed\n")); print_usage(); diff --git a/src/cfg.cpp b/src/cfg.cpp index 06bf27f..464d043 100644 --- a/src/cfg.cpp +++ b/src/cfg.cpp @@ -39,6 +39,9 @@ const char *lang_array_old[] = {"system", "de", "en", "fr", "pt_BR"}; config_t cfg; char *cfg_path; +#ifndef WIN32 +char *jack_client_name; +#endif int cfg_write_file(char *path) { @@ -49,6 +52,11 @@ int cfg_write_file(char *path) if (path == NULL) { path = cfg_path; } +#ifndef WIN32 + if (jack_client_name == NULL) { + jack_client_name = strdup("butt"); + } +#endif cfg_fd = fl_fopen(path, "wb"); if (cfg_fd == NULL) { diff --git a/src/cfg.h b/src/cfg.h index 49fcff7..7d311bc 100644 --- a/src/cfg.h +++ b/src/cfg.h @@ -391,6 +391,9 @@ typedef struct { } config_t; extern char *cfg_path; // Path to config file +#ifndef WIN32 +extern char *jack_client_name; // JACK client name +#endif extern config_t cfg; // Holds config parameters int cfg_write_file(char *path); // Writes current config_t struct to path or cfg_path if path is NULL diff --git a/src/port_audio.cpp b/src/port_audio.cpp index e7ccc60..39a6d15 100644 --- a/src/port_audio.cpp +++ b/src/port_audio.cpp @@ -24,6 +24,9 @@ #ifdef WIN32 #include +#else +#include +#include #endif #include "gettext.h" @@ -126,6 +129,16 @@ int snd_init(void) { char info_buf[256]; +#ifndef WIN32 + // JACK: Set client name before Pa_Initialize + if (jack_client_name && strlen(jack_client_name) > 0) { + PaJack_SetClientName(jack_client_name); + } else { + jack_client_name = strdup("butt"); + PaJack_SetClientName(jack_client_name); + } +#endif + PaError p_err; if ((p_err = Pa_Initialize()) != paNoError) { snprintf(info_buf, sizeof(info_buf), _("PortAudio init failed:\n%s\n"), Pa_GetErrorText(p_err));