Jack2  1.9.8
JackServer.h
00001 /*
00002 Copyright (C) 2001 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 General Public License as published by
00007 the Free Software Foundation; either version 2 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 General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 
00019 */
00020 
00021 #ifndef __JackServer__
00022 #define __JackServer__
00023 
00024 #include "JackCompilerDeps.h"
00025 #include "driver_interface.h"
00026 #include "JackDriverLoader.h"
00027 #include "JackConnectionManager.h"
00028 #include "JackGlobals.h"
00029 #include "JackPlatformPlug.h"
00030 #include "jslist.h"
00031 
00032 namespace Jack
00033 {
00034 
00035 class JackGraphManager;
00036 class JackDriverClientInterface;
00037 struct JackEngineControl;
00038 class JackLockedEngine;
00039 class JackLoadableInternalClient;
00040 
00045 class SERVER_EXPORT JackServer
00046 {
00047 
00048     private:
00049 
00050         JackDriverInfo* fDriverInfo;
00051         JackDriverClientInterface* fAudioDriver;
00052         JackDriverClientInterface* fFreewheelDriver;
00053         JackDriverClientInterface* fThreadedFreewheelDriver;
00054         JackLockedEngine* fEngine;
00055         JackEngineControl* fEngineControl;
00056         JackGraphManager* fGraphManager;
00057         JackServerChannel fChannel;
00058         JackConnectionManager fConnectionState;
00059         JackSynchro fSynchroTable[CLIENT_NUM];
00060         bool fFreewheel;
00061 
00062         int InternalClientLoadAux(JackLoadableInternalClient* client, const char* so_name, const char* client_name, int options, int* int_ref, int uuid, int* status);
00063 
00064     public:
00065 
00066         JackServer(bool sync, bool temporary, int timeout, bool rt, int priority, int port_max, bool verbose, jack_timer_type_t clock, const char* server_name);
00067         ~JackServer();
00068 
00069         int Open(jack_driver_desc_t* driver_desc, JSList* driver_params);
00070         int Close();
00071 
00072         int Start();
00073         int Stop();
00074         bool IsRunning();
00075 
00076         // RT thread
00077         void Notify(int refnum, int notify, int value);
00078 
00079         // Command thread : API
00080         int SetBufferSize(jack_nframes_t buffer_size);
00081         int SetFreewheel(bool onoff);
00082         int InternalClientLoad1(const char* client_name, const char* so_name, const char* objet_data, int options, int* int_ref, int uuid, int* status);
00083         int InternalClientLoad2(const char* client_name, const char* so_name, const JSList * parameters, int options, int* int_ref, int uuid, int* status);
00084         void ClientKill(int refnum);
00085 
00086         // Transport management
00087         int ReleaseTimebase(int refnum);
00088         int SetTimebaseCallback(int refnum, int conditional);
00089 
00090         // Backend management
00091         JackDriverInfo* AddSlave(jack_driver_desc_t* driver_desc, JSList* driver_params);
00092         void RemoveSlave(JackDriverInfo* info);
00093         int SwitchMaster(jack_driver_desc_t* driver_desc, JSList* driver_params);
00094 
00095         // Object access
00096         JackLockedEngine* GetEngine();
00097         JackEngineControl* GetEngineControl();
00098         JackSynchro* GetSynchroTable();
00099         JackGraphManager* GetGraphManager();
00100 
00101 };
00102 
00103 } // end of namespace
00104 
00105 
00106 #endif