JackInternalClient.cpp

00001 /*
00002 Copyright (C) 2001 Paul Davis 
00003 Copyright (C) 2004-2006 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 #ifdef WIN32 
00022 #pragma warning (disable : 4786)
00023 #endif
00024 
00025 #include "JackInternalClient.h"
00026 #include "JackEngine.h"
00027 #include "JackServer.h"
00028 #include "JackGraphManager.h"
00029 #include "JackEngineControl.h"
00030 #include "JackClientControl.h"
00031 #include "JackInternalClientChannel.h"
00032 #include <assert.h>
00033 
00034 
00035 namespace Jack
00036 {
00037 
00038 JackGraphManager* JackInternalClient::fGraphManager = NULL;
00039 JackEngineControl* JackInternalClient::fEngineControl = NULL;
00040 
00041 // Used for external C API (JackAPI.cpp)
00042 JackGraphManager* GetGraphManager()
00043 {
00044     return JackServer::fInstance->GetGraphManager();
00045 }
00046 
00047 JackEngineControl* GetEngineControl()
00048 {
00049     return JackServer::fInstance->GetEngineControl();
00050 }
00051 
00052 JackSynchro** GetSynchroTable()
00053 {
00054     return JackServer::fInstance->GetSynchroTable();
00055 }
00056 
00057 JackInternalClient::JackInternalClient(JackServer* server, JackSynchro** table): JackClient(table)
00058 {
00059     fClientControl = new JackClientControl();
00060     fChannel = new JackInternalClientChannel(server);
00061 }
00062 
00063 JackInternalClient::~JackInternalClient()
00064 {
00065     delete fClientControl;
00066     delete fChannel;
00067 }
00068 
00069 int JackInternalClient::Open(const char* name)
00070 {
00071     int result;
00072     JackLog("JackInternalClient::Open name = %s\n", name);
00073     strcpy(fClientControl->fName, name);
00074 
00075     // Require new client
00076     fChannel->ClientNew(name, &fClientControl->fRefNum, &fEngineControl, &fGraphManager, this, &result);
00077     if (result < 0) {
00078         jack_error("Cannot open client name = %s", name);
00079         goto error;
00080     }
00081 
00082     SetupDriverSync(false);
00083     return 0;
00084 
00085 error:
00086     fChannel->Stop();
00087     fChannel->Close();
00088     return -1;
00089 }
00090 
00091 JackGraphManager* JackInternalClient::GetGraphManager() const
00092 {
00093     assert(fGraphManager);
00094     return fGraphManager;
00095 }
00096 
00097 JackEngineControl* JackInternalClient::GetEngineControl() const
00098 {
00099     assert(fEngineControl);
00100     return fEngineControl;
00101 }
00102 
00103 JackClientControl* JackInternalClient::GetClientControl() const
00104 {
00105     return fClientControl;
00106 }
00107 
00108 } // end of namespace
00109 

Generated on Wed Jan 10 11:42:45 2007 for Jackdmp by  doxygen 1.4.5