Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
jack.h
1// SPDX-FileCopyrightText: © 2023-2024 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#include "zrythm-config.h"
5#include "zrythm-test-config.h"
6
7#include <string>
8
9#include "engine/device_io/engine.h"
10#include "gui/backend/backend/project.h"
11#include "gui/backend/backend/zrythm.h"
12
13#ifdef HAVE_JACK
14
15# include <jack/jack.h>
16
17static bool
18test_jack_port_exists (const std::string &port_name);
19
20static bool
21test_jack_port_exists (const std::string &port_name)
22{
23 /* get all input ports */
24 const char ** ports =
25 jack_get_ports (AUDIO_ENGINE->client_, port_name.c_str (), nullptr, 0);
26
27 bool ret = ports && ports[0] != NULL;
28
29 if (ports)
30 {
31 int i = 0;
32 while (ports[i] != nullptr)
33 {
34 // jack_free (ports[i]);
35 i++;
36 }
37 }
38
39 return ret;
40}
41
42# define assert_jack_port_exists(name) \
43 ASSERT_TRUE (test_jack_port_exists (name))
44
45#endif // defined(HAVE_JACK)