JackClientControl.h 2.39 KB
Newer Older
sletz's avatar
sletz committed
1
2
/*
Copyright (C) 2003 Paul Davis
sletz's avatar
sletz committed
3
Copyright (C) 2004-2008 Grame
sletz's avatar
sletz committed
4
5

This program is free software; you can redistribute it and/or modify
sletz's avatar
sletz committed
6
7
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
sletz's avatar
sletz committed
8
9
10
11
12
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
sletz's avatar
sletz committed
13
GNU Lesser General Public License for more details.
sletz's avatar
sletz committed
14

sletz's avatar
sletz committed
15
16
17
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software 
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
sletz's avatar
sletz committed
18
19
20
21
22
23
24
25
26

*/

#ifndef __JackClientControl__
#define __JackClientControl__

#include "JackShmMem.h"
#include "JackPort.h"
#include "JackSynchro.h"
27
#include "JackNotification.h"
sletz's avatar
sletz committed
28
29
30
31
32

namespace Jack
{

/*!
33
\brief Client control possibly in shared memory.
sletz's avatar
sletz committed
34
35
*/

36
struct JackClientControl : public JackShmMemAble
sletz's avatar
sletz committed
37
38
{
    char fName[JACK_CLIENT_NAME_SIZE + 1];
sletz's avatar
sletz committed
39
40
    bool fCallback[kMaxNotification];
    volatile jack_transport_state_t fTransportState;
sletz's avatar
sletz committed
41
42
    volatile bool fTransportSync;      /* Will be true when slow-sync cb has to be called */
    volatile bool fTransportTimebase;  /* Will be true when timebase cb is called with new_pos on */
sletz's avatar
sletz committed
43
    int fRefNum;
44
    int fPID;
sletz's avatar
sletz committed
45
    bool fActive;
sletz's avatar
sletz committed
46

47
    JackClientControl(const char* name, int pid, int refnum)
sletz's avatar
sletz committed
48
    {
49
        Init(name, pid, refnum);
sletz's avatar
sletz committed
50
51
52
53
    }

    JackClientControl(const char* name)
    {
54
        Init(name, 0, -1);
sletz's avatar
sletz committed
55
56
57
58
    }

    JackClientControl()
    {
59
        Init("", 0, -1);
sletz's avatar
sletz committed
60
61
    }

62
    void Init(const char* name, int pid, int refnum)
sletz's avatar
sletz committed
63
64
    {
        strcpy(fName, name);
sletz's avatar
sletz committed
65
66
67
68
69
70
71
72
73
74
        for (int i = 0; i < kMaxNotification; i++)
            fCallback[i] = false;
        // Always activated
        fCallback[kAddClient] = true;
        fCallback[kRemoveClient] = true;
        fCallback[kActivateClient] = true;
        // So that driver synchro are correctly setup in "flush" or "normal" mode
        fCallback[kStartFreewheelCallback] = true;
        fCallback[kStopFreewheelCallback] = true;
        fRefNum = refnum;
75
        fPID = pid;
sletz's avatar
sletz committed
76
        fTransportState = JackTransportStopped;
sletz's avatar
sletz committed
77
78
        fTransportSync = false;
        fTransportTimebase = false;
sletz's avatar
sletz committed
79
80
81
        fActive = false;
    }

sletz's avatar
sletz committed
82
} POST_PACKED_STRUCTURE;
sletz's avatar
sletz committed
83
84
85
86
87

} // end of namespace


#endif