JackClientControl.h 2.62 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
You should have received a copy of the GNU Lesser General Public License
16
along with this program; if not, write to the Free Software
sletz's avatar
sletz committed
17
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"
28
#include "session.h"
Torben Hohn's avatar
Torben Hohn committed
29

sletz's avatar
sletz committed
30
31
32
33
namespace Jack
{

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

37
struct JackClientControl : public JackShmMemAble
sletz's avatar
sletz committed
38
39
{
    char fName[JACK_CLIENT_NAME_SIZE + 1];
sletz's avatar
sletz committed
40
41
    bool fCallback[kMaxNotification];
    volatile jack_transport_state_t fTransportState;
sletz's avatar
sletz committed
42
43
    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
44
    int fRefNum;
45
    int fPID;
sletz's avatar
sletz committed
46
    bool fActive;
sletz's avatar
sletz committed
47

Torben Hohn's avatar
Torben Hohn committed
48
    int fSessionID;
49
    char fSessionCommand[JACK_SESSION_COMMAND_SIZE];
Torben Hohn's avatar
Torben Hohn committed
50
51
    jack_session_flags_t fSessionFlags;

52
    JackClientControl(const char* name, int pid, int refnum, int uuid)
sletz's avatar
sletz committed
53
    {
54
        Init(name, pid, refnum, uuid);
sletz's avatar
sletz committed
55
56
57
58
    }

    JackClientControl(const char* name)
    {
59
        Init(name, 0, -1, -1);
sletz's avatar
sletz committed
60
61
62
63
    }

    JackClientControl()
    {
64
        Init("", 0, -1, -1);
sletz's avatar
sletz committed
65
66
    }

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

87
        fSessionID = uuid;
sletz's avatar
sletz committed
88
89
    }

sletz's avatar
sletz committed
90
} POST_PACKED_STRUCTURE;
sletz's avatar
sletz committed
91
92
93
94
95

} // end of namespace


#endif