1 // ------------------------------------------------------------------------
2 //
3 //  Copyright (C) 2010-2011 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 2 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, write to the Free Software
17 //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //
19 // ------------------------------------------------------------------------
20 
21 
22 #ifndef __JCLIENT_H
23 #define __JCLIENT_H
24 
25 
26 #include <inttypes.h>
27 #include <stdlib.h>
28 #include <stdio.h>
29 #include <clthreads.h>
30 #include <jack/jack.h>
31 #include "global.h"
32 #include "ebu_r128_proc.h"
33 #include "peak_proc.h"
34 
35 
36 class Jclient : public A_thread
37 {
38 public:
39 
40     Jclient (const char *jname, const char *jserv);
41     ~Jclient (void);
42 
jname(void)43     const char *jname (void) const { return _jname; }
ebu_r128()44     Ebu_r128_proc* ebu_r128 () const { return (Ebu_r128_proc *) &_ebu_r128; }
peakproc()45     Peak_proc*     peakproc () const { return (Peak_proc *) &_peakproc; }
46 
47 private:
48 
49     void  init_jack (const char *jname, const char *jserv);
50     void  close_jack (void);
51     void  jack_shutdown (void);
52     int   jack_process (int frames);
53 
thr_main(void)54     virtual void thr_main (void) {}
55 
56     jack_client_t  *_jack_client;
57     jack_port_t    *_jack_testip;
58     jack_port_t    *_inpports [2];
59     const char     *_jname;
60     unsigned int    _fsamp;
61     int             _state;
62     Ebu_r128_proc   _ebu_r128;
63     Peak_proc       _peakproc;
64 
65 
66     static void jack_static_shutdown (void *arg);
67     static int  jack_static_process (jack_nframes_t nframes, void *arg);
68 };
69 
70 
71 #endif
72