~ubuntu-branches/ubuntu/quantal/tetraproc/quantal

« back to all changes in this revision

Viewing changes to source/jclient.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2011-03-24 14:56:48 UTC
  • Revision ID: james.westby@ubuntu.com-20110324145648-r9qi83fs3wej4801
Tags: upstream-0.8.2
ImportĀ upstreamĀ versionĀ 0.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ----------------------------------------------------------------------------
 
2
//
 
3
//  Copyright (C) 2007-2010 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 <clthreads.h>
 
27
#include <jack/jack.h>
 
28
#include "abprocess.h"
 
29
#include "kmeterdsp.h"
 
30
#include "virtmic.h"
 
31
#include "global.h"
 
32
 
 
33
 
 
34
class Jclient : public A_thread
 
35
{
 
36
public:
 
37
 
 
38
    Jclient (const char *jname);
 
39
    ~Jclient (void);
 
40
 
 
41
    enum { METER_INP, METER_MON }; 
 
42
    enum { MONIT_REC, MONIT_EXT }; 
 
43
 
 
44
    const char *jname (void) const { return _jname; }
 
45
 
 
46
    void set_hpfil (float v) { _abproc.set_hpfil (v); }
 
47
    void set_mute (int m) { _abproc.set_mute (m); }
 
48
    void set_invb (int m) { _abproc.set_invb (m); }
 
49
    void set_endf (int m) { _abproc.set_endf (m); }
 
50
    void set_form (int k)
 
51
    {
 
52
        _abproc.set_form (k);
 
53
        _virtmic.set_form (k);
 
54
    }
 
55
    int  set_lffilt (ABconfig *C) { return _abproc.set_lffilt (C); }
 
56
    int  set_matrix (ABconfig *C) { return _abproc.set_matrix (C); }
 
57
    int  set_convol (ABconfig *C) { return _abproc.set_convol (C); }
 
58
    int  set_hffilt (ABconfig *C) { return _abproc.set_hffilt (C); }
 
59
 
 
60
    void set_meter (int k) { _meter = k; }
 
61
    void set_monit (int k) { _monit = k; }
 
62
    void set_azim  (float v) { _virtmic.set_azim (v); }
 
63
    void set_elev  (float v) { _virtmic.set_elev (v); }
 
64
    void set_angle (float v) { _virtmic.set_angle (v); }
 
65
    void set_direc (float v) { _virtmic.set_direc (v); }
 
66
    void set_xtalk (bool b)  { _virtmic.set_xtalk (b); }
 
67
    void set_mono  (bool b)  { _virtmic.set_mono (b); }
 
68
    void set_volum (float v) { _voldb1 = v; }
 
69
 
 
70
    void get_level (int i, float *rms, float *dpk) { _kmdsp [i].read (rms, dpk); }
 
71
 
 
72
private:
 
73
 
 
74
    enum { S_IDLE, S_PROC };
 
75
 
 
76
    virtual void thr_main (void) {}
 
77
 
 
78
    void init_jack (void);
 
79
    void init_proc (void);
 
80
    void close_jack (void);
 
81
    void jack_shutdown (void);
 
82
    int  jack_process (jack_nframes_t nframes);
 
83
    void monitor (unsigned int n, float *p [4]);
 
84
    void measure (unsigned int n, float *p [4]);
 
85
 
 
86
    jack_client_t  *_jack_client;
 
87
    jack_port_t    *_jack_ipports [8];
 
88
    jack_port_t    *_jack_opports [10];
 
89
    const char     *_jname;
 
90
    unsigned int    _state;
 
91
    unsigned int    _fsamp;
 
92
    unsigned int    _fsize;
 
93
    unsigned int    _psize;
 
94
 
 
95
    float           _vgain;
 
96
    float           _voldb0;
 
97
    float           _voldb1;
 
98
    float           _dvoldb;
 
99
    ABprocess       _abproc;
 
100
    Virtmic         _virtmic;
 
101
 
 
102
    int             _meter;
 
103
    int             _monit;
 
104
    Kmeterdsp       _kmdsp [4];
 
105
 
 
106
    static void jack_static_shutdown (void *arg);
 
107
    static int  jack_static_process (jack_nframes_t nframes, void *arg);
 
108
    static const char *ipp_names [8];
 
109
    static const char *opp_names [10];
 
110
};
 
111
 
 
112
 
 
113
#endif