| 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 |
#ifndef __SHDATA_H |
| 22 |
#define __SHDATA_H |
| 23 |
|
| 24 |
|
| 25 |
#include <limits.h> |
| 26 |
#include "itypes.h" |
| 27 |
#include "lfqueue.h" |
| 28 |
|
| 29 |
|
| 30 |
#define SHM_SIZE 4096 |
| 31 |
|
| 32 |
|
| 33 |
class Evport |
| 34 |
{ |
| 35 |
public: |
| 36 |
|
| 37 |
Evport (void) : _txe (0), _rxe (0) {} |
| 38 |
|
| 39 |
void eput (U32 e) |
| 40 |
{ |
| 41 |
e &= ~(_txe ^ _rxe); |
| 42 |
_txe ^= e; |
| 43 |
} |
| 44 |
|
| 45 |
U32 eget (U32 m = ~0) |
| 46 |
{ |
| 47 |
m &= (_txe ^ _rxe); |
| 48 |
m ^= m & (m - 1); |
| 49 |
_rxe ^= m; |
| 50 |
return m; |
| 51 |
} |
| 52 |
|
| 53 |
private: |
| 54 |
|
| 55 |
U32 _txe; |
| 56 |
U32 _rxe; |
| 57 |
}; |
| 58 |
|
| 59 |
|
| 60 |
class Ipdata |
| 61 |
{ |
| 62 |
public: |
| 63 |
|
| 64 |
char _name [64]; |
| 65 |
U32 _stat; |
| 66 |
U32 _type; |
| 67 |
U32 _chan0; |
| 68 |
Fltlfq *_queue; |
| 69 |
}; |
| 70 |
|
| 71 |
|
| 72 |
class Opdata |
| 73 |
{ |
| 74 |
public: |
| 75 |
|
| 76 |
char _name [1024]; |
| 77 |
U32 _stat; |
| 78 |
U32 _chan; |
| 79 |
Fltlfq *_queue; |
| 80 |
}; |
| 81 |
|
| 82 |
|
| 83 |
class Shdata |
| 84 |
{ |
| 85 |
public: |
| 86 |
|
| 87 |
enum { X_EXIT = 1, X_INIT = 2, X_TICK = 4, X_STOP = 8, X_TEST = 16, X_CAPT = 32, X_TRIG = 64 }; |
| 88 |
enum { A_JACK = 1, A_ALSA = 2, A_NORT = 4, A_FAIL = 8, A_KILL = 16, A_SIZE = 32 }; |
| 89 |
enum { M_PLAY = 1, M_MEAS = 2, M_CAPT = 4 }; |
| 90 |
enum { S_NONE, S_OPEN, S_ERROR }; |
| 91 |
|
| 92 |
// Versions |
| 93 |
U32 _pversion; |
| 94 |
U32 _cversion; |
| 95 |
|
| 96 |
// Event ports |
| 97 |
Evport _par2cld; |
| 98 |
Evport _cld2par; |
| 99 |
|
| 100 |
// Audio driver params |
| 101 |
U32 _fsamp; |
| 102 |
U32 _nplay; |
| 103 |
U32 _ncapt; |
| 104 |
U32 _fsize; |
| 105 |
U32 _nfrag; |
| 106 |
S32 _class; |
| 107 |
S32 _prior; |
| 108 |
U32 _state; |
| 109 |
char _ident [64]; |
| 110 |
|
| 111 |
// Audio work params |
| 112 |
U32 _mode; |
| 113 |
U32 _opsel; |
| 114 |
S32 _niter; |
| 115 |
S32 _itlen; |
| 116 |
S32 _oplen; |
| 117 |
S32 _iplen; |
| 118 |
float _level; |
| 119 |
Opdata _opdat; |
| 120 |
Ipdata _ipdat [8]; |
| 121 |
float _meter [8]; |
| 122 |
char _error [96]; |
| 123 |
|
| 124 |
// Session path |
| 125 |
char _sessdir [1024]; |
| 126 |
}; |
| 127 |
|
| 128 |
|
| 129 |
#endif |
| 130 |
|