1 // ---------------------------------------------------------------------------- 2 // 3 // Copyright (C) 2008-2017 Fons Adriaensen <fons@linuxaudio.org> 4 // 5 // This program is free software; you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation; either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with this program. If not, see <http://www.gnu.org/licenses/>. 17 // 18 // ---------------------------------------------------------------------------- 19 20 21 #ifndef __JCLIENT_H 22 #define __JCLIENT_H 23 24 25 #include <inttypes.h> 26 #include <stdlib.h> 27 #include <math.h> 28 #include <clthreads.h> 29 #include <jack/jack.h> 30 #include "dplimit1.h" 31 #include "global.h" 32 33 34 class Jclient : public A_thread 35 { 36 public: 37 38 Jclient (const char *jname, const char *jserv, int nchan); 39 ~Jclient (void); 40 jname(void)41 const char *jname (void) const { return _jname; } 42 set_inpgain(float v)43 void set_inpgain (float v) 44 { 45 _ipg0 = powf (10.0f, 0.05f * v); 46 } 47 set_threshd(float v)48 void set_threshd (float v) 49 { 50 _dplimit.set_threshd (v); 51 } 52 set_reltime(float v)53 void set_reltime (float v) 54 { 55 _dplimit.set_reltime (v); 56 } 57 dplimit(void)58 Dplimit1 *dplimit (void) const { return (Dplimit1 *) &_dplimit; } 59 60 private: 61 62 void init_jack (const char *jname, const char *jserv); 63 void close_jack (void); 64 void jack_shutdown (void); 65 int jack_process (int nframes); 66 thr_main(void)67 virtual void thr_main (void) {} 68 69 jack_client_t *_jack_client; 70 jack_port_t *_inpports [MAXCHAN]; 71 jack_port_t *_outports [MAXCHAN]; 72 bool _active; 73 const char *_jname; 74 unsigned int _fsamp; 75 int _nchan; 76 int _fragm; 77 int _nsamp; 78 float _ipg0; 79 float _ipg1; 80 float _dipg; 81 Dplimit1 _dplimit; 82 83 static void jack_static_shutdown (void *arg); 84 static int jack_static_process (jack_nframes_t nframes, void *arg); 85 }; 86 87 88 #endif 89