~ubuntu-branches/ubuntu/trusty/aeolus/trusty

« back to all changes in this revision

Viewing changes to audio.h

  • Committer: Bazaar Package Importer
  • Author(s): Free Ekanayaka
  • Date: 2007-05-14 22:18:54 UTC
  • Revision ID: james.westby@ubuntu.com-20070514221854-274rj6fqs5tegu7q
Tags: upstream-0.6.6+2
ImportĀ upstreamĀ versionĀ 0.6.6+2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (C) 2003-2005 Fons Adriaensen <fons.adriaensen@skynet.be>
 
3
    
 
4
    This program is free software; you can redistribute it and/or modify
 
5
    it under the terms of the GNU General Public License as published by
 
6
    the Free Software Foundation; either version 2 of the License, or
 
7
    (at your option) any later version.
 
8
 
 
9
    This program is distributed in the hope that it will be useful,
 
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
    GNU General Public License for more details.
 
13
 
 
14
    You should have received a copy of the GNU General Public License
 
15
    along with this program; if not, write to the Free Software
 
16
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
17
*/
 
18
 
 
19
 
 
20
#ifndef __AUDIO_H
 
21
#define __AUDIO_H
 
22
 
 
23
 
 
24
#include <stdlib.h>
 
25
#include <clthreads.h>
 
26
#include <clalsadrv.h>
 
27
#include <jack/jack.h>
 
28
#include "asection.h"
 
29
#include "division.h"
 
30
#include "lfqueue.h"
 
31
#include "reverb.h"
 
32
#include "global.h"
 
33
 
 
34
 
 
35
class Audio : public A_thread
 
36
{
 
37
public:
 
38
 
 
39
    Audio (const char *name);
 
40
    virtual ~Audio (void);
 
41
 
 
42
    void  init_alsa (int ncapt, int nplay, bool bform, const char *device, int fsamp, int fsize, int nfrag);
 
43
    void  init_jack (int ncapt, int nplay, bool bform);
 
44
 
 
45
    int policy (void) const { return _policy; }
 
46
    int prioty (void) const { return _prioty; }
 
47
    Lfq_u32 *qnote (void) { return &_qnote; }
 
48
    Lfq_u32 *qcomm (void) { return &_qcomm; }
 
49
 
 
50
private:
 
51
   
 
52
    enum { VOLUME, REVSIZE, REVTIME, STPOSIT };
 
53
 
 
54
    void init_audio (void);
 
55
    void close_alsa (void);
 
56
    void close_jack (void);
 
57
//    void update_div (unsigned int, unsigned int); 
 
58
//    void update_all (unsigned int *, unsigned int *);
 
59
 
 
60
    virtual void thr_main (void);
 
61
    void jack_shutdown (void);
 
62
    int  jack_callback (jack_nframes_t);
 
63
 
 
64
    void proc_comm (Lfq_u32 *);
 
65
    void proc_mesg (void);
 
66
    void proc_synth (unsigned long);
 
67
    void proc_update (void);
 
68
 
 
69
    void note_off (int n, int b)
 
70
    {
 
71
        _keys [n] &= ~b;
 
72
        _keys [n] |= 128;
 
73
    }
 
74
 
 
75
    void note_on (int n, int b)
 
76
    {
 
77
        _keys [n] |= b;
 
78
        _keys [n] |= 128;
 
79
    }
 
80
 
 
81
    static void jack_static_shutdown (void *);
 
82
    static int  jack_static_callback (jack_nframes_t, void *);
 
83
 
 
84
    const char     *_name;
 
85
    volatile bool   _run_alsa;
 
86
    volatile bool   _run_jack;
 
87
    Alsa_driver    *_alsa_handle;
 
88
    jack_client_t  *_jack_handle;
 
89
    jack_port_t    *_jack_in  [8];
 
90
    jack_port_t    *_jack_out [8];
 
91
    int             _policy;
 
92
    int             _prioty;
 
93
    bool            _bform;
 
94
    int             _ncapt;
 
95
    int             _nplay;
 
96
    unsigned int    _fsamp;
 
97
    unsigned int    _fsize;
 
98
    Lfq_u32         _qnote; 
 
99
    Lfq_u32         _qcomm; 
 
100
    int             _nasect;
 
101
    int             _ndivis;
 
102
    Asection       *_asectp [NASECT];
 
103
    Division       *_divisp [NDIVIS];
 
104
    Reverb          _reverb;
 
105
    float          *_out [8];
 
106
    unsigned char   _keys [NNOTES];
 
107
    Fparm           _apar [4];
 
108
    float           _revsize;
 
109
    float           _revtime;
 
110
};
 
111
 
 
112
 
 
113
#endif
 
114