Guitarix
Loading...
Searching...
No Matches
gx_jack_wrapper.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009, 2010 Hermann Meyer, James Warden, Andreas Degert
3 * Copyright (C) 2011 Pete Shorthose
4 * Copyright (C) 2022 Maxim Alexanian
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 * --------------------------------------------------------------------------
20 */
21
22/*** This is a wrapper around the jack dependency in the guitarix engine.
23 * use this instead gx_jack.h to build guitarix as plugin
24***/
25
26/* ------- This is the JACK namespace ------- */
27
28#pragma once
29
30#ifndef SRC_HEADERS_GX_JACK_WRAPPER_H_
31#define SRC_HEADERS_GX_JACK_WRAPPER_H_
32
33#include <atomic>
34
35#ifdef GUITARIX_AS_PLUGIN
36
37#include <sigc++/sigc++.h>
38
39typedef uint32_t jack_nframes_t;
40namespace gx_engine { class GxEngine; }
41namespace gx_system { class CmdlineOptions; class JsonParser; }
42
43namespace gx_jack {
44
45/****************************************************************
46 ** class GxJack
47 */
48
49class GxJack: public sigc::trackable {
50 private:
52
53 bool connected;
54
55 std::string client_instance;
56 jack_nframes_t jack_sr; // jack sample rate
57 jack_nframes_t jack_bs; // jack buffer size
58 float *insert_buffer;
59 bool gx_jack_init(bool startserver, int wait_after_connect,
60 const gx_system::CmdlineOptions& opt);
61public:
62
63 jack_nframes_t get_jack_sr() { return jack_sr; }
64 jack_nframes_t get_jack_bs() { return jack_bs; }
65 float get_jcpu_load() { return -1; }
66 bool get_is_rt() { return true; }
67 jack_nframes_t get_time_is() { return 0; }
68
69public:
71 ~GxJack();
72
73 void set_jack_insert(bool v) {}
74 bool gx_jack_connection(bool connect, bool startserver,
75 int wait_after_connect, const gx_system::CmdlineOptions& opt);
76 void send_midi_cc(int cc_num, int pgm_num, int bgn, int num) {}
77 void gx_jack_cleanup();
78 static std::string get_default_instancename();
79 const std::string& get_instancename() { return client_instance; }
80
82
83 void process(jack_nframes_t nframes, float* input_buffer, float *output_buffer[2]);
84 void process_mono(jack_nframes_t nframes, float* input_buffer, float *output_buffer);
85 void process_stereo(jack_nframes_t nframes, float* input_buffer[2], float *output_buffer[2]);
86 void process_ramp(jack_nframes_t nframes);
87 void process_ramp_mono(jack_nframes_t nframes);
88 void process_ramp_stereo(jack_nframes_t nframes);
89 void finish_process();
90 void srate_callback(jack_nframes_t samplerate);
91 void buffersize_callback(jack_nframes_t nframes);
92
94};
95
96} /* end of jack namespace */
97
98#endif // GUITARIX_AS_PLUGIN
99
100#endif // SRC_HEADERS_GX_JACK_WRAPPER_H_
gx_engine::GxEngine & get_engine()
Definition gx_jack.h:253
bool gx_jack_init(bool startserver, int wait_after_connect, const gx_system::CmdlineOptions &opt)
static string get_default_instancename()
bool send_midi_cc(int cc_num, int pgm_num, int bgn, int num)
Definition gx_jack.h:268
jack_nframes_t get_jack_sr()
Definition gx_jack.h:215
void gx_jack_cleanup()
void set_jack_insert(bool v)
Definition gx_jack.h:228
const string & get_instancename()
Definition gx_jack.h:238
float * insert_buffer
Definition gx_jack.h:186
gx_engine::GxEngine & engine
Definition gx_jack.h:149
float get_jcpu_load()
Definition gx_jack.h:217
void read_connections(gx_system::JsonParser &jp)
GxJack(gx_engine::GxEngine &engine_)
jack_nframes_t jack_bs
Definition gx_jack.h:185
bool gx_jack_connection(bool connect, bool startserver, int wait_after_connect, const gx_system::CmdlineOptions &opt)
jack_nframes_t jack_sr
Definition gx_jack.h:184
bool get_is_rt()
Definition gx_jack.h:218
jack_nframes_t get_time_is()
Definition gx_jack.h:219
string client_instance
Definition gx_jack.h:183
jack_nframes_t get_jack_bs()
Definition gx_jack.h:216