Debian Codegraph @

source/audiothr.h

raw
1 // ----------------------------------------------------------------------------
2 //
3 // Copyright (C) 2003-2013 Fons Adriaensen <[email protected]>
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 #include <stdlib.h>
22 #include <clthreads.h>
23 #include <zita-alsa-pcmi.h>
24 #include <jack/jack.h>
25 #include "shdata.h"
26
27
28 #define DECAY 30.0f // Meter decay in dB/s
29
30
31 class Audiothr : public P_thread
32 {
33 public:
34
35 enum { N_IP = 8, N_OP = 8 };
36
37 Audiothr (Shdata *shdata);
38 virtual ~Audiothr (void);
39
40 private:
41
42 virtual void thr_main (void);
43
44 void init_alsa (void);
45 void close_alsa (void);
46 void init_jack (const char *server = 0);
47 void close_jack (void);
48 void jack_shutdown (void);
49 int jack_callback (jack_nframes_t nframes);
50 void init (void);
51 void process (void);
52
53 Shdata *_shdata;
54
55 volatile bool _run_alsa;
56 Alsa_pcmi *_alsa_handle;
57 Esync _alsa_sync;
58
59 volatile bool _run_jack;
60 jack_client_t *_jack_handle;
61 jack_port_t *_jack_ip [N_IP];
62 jack_port_t *_jack_op [N_OP];
63
64 float *_ip [N_IP];
65 float *_op [N_OP];
66 U32 _fsamp;
67 S32 _nplay;
68 S32 _ncapt;
69 U32 _fsize;
70 U32 _scnt;
71 float _decay;
72
73 static void jack_static_shutdown (void *arg);
74 static int jack_static_callback (jack_nframes_t nframes, void *arg);
75 };
76
77