Jack_client_name added

This commit is contained in:
audioprog 2025-08-13 23:50:59 +02:00
parent 031ca812ad
commit 067f552837
5 changed files with 46 additions and 0 deletions

12
.gitignore vendored Normal file
View file

@ -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

View file

@ -437,7 +437,11 @@ int main(int argc, char *argv[])
// Parse command line parameters // Parse command line parameters
DEBUG_LOG("Parsing 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) { while ((opt = getopt(argc, argv, ":vhc:AULxs:drtnqu:a:p:SM:m:O:o:")) != -1) {
#endif
switch (opt) { switch (opt) {
#ifndef BUILD_CLIENT #ifndef BUILD_CLIENT
case 'A': case 'A':
@ -603,6 +607,12 @@ int main(int argc, char *argv[])
printf(_("Option -%c requires an argument\n"), optopt); printf(_("Option -%c requires an argument\n"), optopt);
print_usage(); print_usage();
return 1; return 1;
#ifndef WIN32
case 'j':
jack_client_name = (char *)malloc((strlen(optarg) + 1) * sizeof(char));
strcpy(jack_client_name, optarg);
break;
#endif
default: default:
printf(_("Command line parsing failed\n")); printf(_("Command line parsing failed\n"));
print_usage(); print_usage();

View file

@ -39,6 +39,9 @@ const char *lang_array_old[] = {"system", "de", "en", "fr", "pt_BR"};
config_t cfg; config_t cfg;
char *cfg_path; char *cfg_path;
#ifndef WIN32
char *jack_client_name;
#endif
int cfg_write_file(char *path) int cfg_write_file(char *path)
{ {
@ -49,6 +52,11 @@ int cfg_write_file(char *path)
if (path == NULL) { if (path == NULL) {
path = cfg_path; path = cfg_path;
} }
#ifndef WIN32
if (jack_client_name == NULL) {
jack_client_name = strdup("butt");
}
#endif
cfg_fd = fl_fopen(path, "wb"); cfg_fd = fl_fopen(path, "wb");
if (cfg_fd == NULL) { if (cfg_fd == NULL) {

View file

@ -391,6 +391,9 @@ typedef struct {
} config_t; } config_t;
extern char *cfg_path; // Path to config file 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 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 int cfg_write_file(char *path); // Writes current config_t struct to path or cfg_path if path is NULL

View file

@ -24,6 +24,9 @@
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
#else
#include <portaudio.h>
#include <pa_jack.h>
#endif #endif
#include "gettext.h" #include "gettext.h"
@ -126,6 +129,16 @@ int snd_init(void)
{ {
char info_buf[256]; 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; PaError p_err;
if ((p_err = Pa_Initialize()) != paNoError) { if ((p_err = Pa_Initialize()) != paNoError) {
snprintf(info_buf, sizeof(info_buf), _("PortAudio init failed:\n%s\n"), Pa_GetErrorText(p_err)); snprintf(info_buf, sizeof(info_buf), _("PortAudio init failed:\n%s\n"), Pa_GetErrorText(p_err));