Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
jack.h
1// SPDX-FileCopyrightText: © 2024-2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "zrythm-config.h"
7
8#ifdef HAVE_JACK
9
10# include "utils/utf8_string.h"
11
12# include <QString>
13
14# include "weakjack/weak_libjack.h"
15
16using namespace Qt::StringLiterals;
17
18namespace zrythm::utils::jack
19{
20
21static inline utils::Utf8String
22get_error_message (jack_status_t status)
23{
24 return utils::Utf8String::from_qstring ([status] () -> QString {
25 if (status & JackFailure)
26 {
27 return
28 /* TRANSLATORS: JACK failure messages */
29 QObject::tr ("Overall operation failed");
30 }
31 if (status & JackInvalidOption)
32 {
33 return QObject::tr (
34 "The operation contained an invalid or unsupported option");
35 }
36 if (status & JackNameNotUnique)
37 {
38 return QObject::tr ("The desired client name was not unique");
39 }
40 if (status & JackServerFailed)
41 {
42 return QObject::tr ("Unable to connect to the JACK server");
43 }
44 if (status & JackServerError)
45 {
46 return QObject::tr ("Communication error with the JACK server");
47 }
48 if (status & JackNoSuchClient)
49 {
50 return QObject::tr ("Requested client does not exist");
51 }
52 if (status & JackLoadFailure)
53 {
54 return QObject::tr ("Unable to load internal client");
55 }
56 if (status & JackInitFailure)
57 {
58 return QObject::tr ("Unable to initialize client");
59 }
60 if (status & JackShmFailure)
61 {
62 return QObject::tr ("Unable to access shared memory");
63 }
64 if (status & JackVersionError)
65 {
66 return QObject::tr ("Client's protocol version does not match");
67 }
68 if (status & JackBackendError)
69 {
70 return QObject::tr ("Backend error");
71 }
72 if (status & JackClientZombie)
73 {
74 return QObject::tr ("Client zombie");
75 }
76
77 z_return_val_if_reached (u"unknown JACK error"_s);
78 }());
79}
80}
81
82#endif // defined(HAVE_JACK)