2
Copyright (C) 2003-2008 Fons Adriaensen <fons@kokkinizita.net>
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.
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.
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.
25
#include <clthreads.h>
27
#include <clalsadrv.h>
29
#include <jack/jack.h>
37
class Audio : public A_thread
41
Audio (const char *jname, Lfq_u32 *qnote, Lfq_u32 *qcomm);
42
virtual ~Audio (void);
44
void init_alsa (const char *device, int fsamp, int fsize, int nfrag);
46
void init_jack (bool bform, Lfq_u8 *qmidi);
49
const char *appname (void) const { return _appname; }
50
uint16_t *midimap (void) const { return (uint16_t *) _midimap; }
51
int policy (void) const { return _policy; }
52
int abspri (void) const { return _abspri; }
53
int relpri (void) const { return _relpri; }
57
enum { VOLUME, REVSIZE, REVTIME, STPOSIT };
59
void init_audio (void);
61
void close_alsa (void);
63
void close_jack (void);
64
virtual void thr_main (void);
65
void jack_shutdown (void);
66
int jack_callback (jack_nframes_t);
67
void proc_jmidi (int);
68
void proc_queue (Lfq_u32 *);
69
void proc_synth (int);
70
void proc_keys1 (void);
71
void proc_keys2 (void);
72
void proc_mesg (void);
74
void key_off (int n, int b)
80
void key_on (int n, int b)
82
_keymap [n] |= b | 128;
85
void cond_key_off (int m, int b)
90
for (i = 0, p = _keymap; i < NNOTES; i++, p++)
100
void cond_key_on (int m, int b)
105
for (i = 0, p = _keymap; i < NNOTES; i++, p++)
114
static void jack_static_shutdown (void *);
115
static int jack_static_callback (jack_nframes_t, void *);
117
const char *_appname;
118
uint16_t _midimap [16];
122
volatile bool _running;
124
Alsa_driver *_alsa_handle;
126
jack_client_t *_jack_handle;
127
jack_port_t *_jack_opport [8];
128
jack_port_t *_jack_midipt;
142
Asection *_asectp [NASECT];
143
Division *_divisp [NDIVIS];
146
unsigned char _keymap [NNOTES];
151
static const char *_ports_stereo [2];
152
static const char *_ports_ambis1 [4];