Jack2 1.9.7
JackClientControl.h
00001 /*
00002 Copyright (C) 2003 Paul Davis
00003 Copyright (C) 2004-2008 Grame
00004 
00005 This program is free software; you can redistribute it and/or modify
00006 it under the terms of the GNU Lesser General Public License as published by
00007 the Free Software Foundation; either version 2.1 of the License, or
00008 (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU Lesser General Public License for more details.
00014 
00015 You should have received a copy of the GNU Lesser General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 
00019 */
00020 
00021 #ifndef __JackClientControl__
00022 #define __JackClientControl__
00023 
00024 #include "JackShmMem.h"
00025 #include "JackPort.h"
00026 #include "JackSynchro.h"
00027 #include "JackNotification.h"
00028 #include "session.h"
00029 
00030 namespace Jack
00031 {
00032 
00037 struct JackClientControl : public JackShmMemAble
00038 {
00039     char fName[JACK_CLIENT_NAME_SIZE + 1];
00040     bool fCallback[kMaxNotification];
00041     volatile jack_transport_state_t fTransportState;
00042     volatile bool fTransportSync;      /* Will be true when slow-sync cb has to be called */
00043     volatile bool fTransportTimebase;  /* Will be true when timebase cb is called with new_pos on */
00044     int fRefNum;
00045     int fPID;
00046     bool fActive;
00047 
00048     int fSessionID;
00049     char fSessionCommand[JACK_SESSION_COMMAND_SIZE];
00050     jack_session_flags_t fSessionFlags;
00051 
00052     JackClientControl(const char* name, int pid, int refnum, int uuid)
00053     {
00054         Init(name, pid, refnum, uuid);
00055     }
00056 
00057     JackClientControl(const char* name)
00058     {
00059         Init(name, 0, -1, -1);
00060     }
00061 
00062     JackClientControl()
00063     {
00064         Init("", 0, -1, -1);
00065     }
00066 
00067     void Init(const char* name, int pid, int refnum, int uuid)
00068     {
00069         strcpy(fName, name);
00070         for (int i = 0; i < kMaxNotification; i++)
00071             fCallback[i] = false;
00072         // Always activated
00073         fCallback[kAddClient] = true;
00074         fCallback[kRemoveClient] = true;
00075         fCallback[kActivateClient] = true;
00076         fCallback[kLatencyCallback] = true;
00077         // So that driver synchro are correctly setup in "flush" or "normal" mode
00078         fCallback[kStartFreewheelCallback] = true;
00079         fCallback[kStopFreewheelCallback] = true;
00080         fRefNum = refnum;
00081         fPID = pid;
00082         fTransportState = JackTransportStopped;
00083         fTransportSync = false;
00084         fTransportTimebase = false;
00085         fActive = false;
00086 
00087         fSessionID = uuid;
00088     }
00089 
00090 } POST_PACKED_STRUCTURE;
00091 
00092 } // end of namespace
00093 
00094 
00095 #endif