Browse Source

Implementation of server_name setting (-n) in progress

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1638 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.68
sletz 17 years ago
parent
commit
f16634bb6d
56 changed files with 297 additions and 339 deletions
  1. +4
    -0
      ChangeLog
  2. +1
    -3
      common/JackAPI.cpp
  3. +0
    -2
      common/JackAPIWrapper.cpp
  4. +3
    -3
      common/JackChannel.h
  5. +2
    -1
      common/JackClient.h
  6. +2
    -2
      common/JackDebugClient.cpp
  7. +1
    -1
      common/JackDebugClient.h
  8. +3
    -3
      common/JackEngine.cpp
  9. +6
    -2
      common/JackEngineControl.h
  10. +12
    -12
      common/JackFifo.cpp
  11. +6
    -6
      common/JackFifo.h
  12. +5
    -3
      common/JackInternalClient.cpp
  13. +2
    -2
      common/JackInternalClient.h
  14. +2
    -2
      common/JackLibAPI.cpp
  15. +10
    -8
      common/JackLibClient.cpp
  16. +1
    -1
      common/JackLibClient.h
  17. +10
    -10
      common/JackPosixSemaphore.cpp
  18. +5
    -5
      common/JackPosixSemaphore.h
  19. +2
    -2
      common/JackProcessSync.h
  20. +4
    -4
      common/JackServer.cpp
  21. +1
    -1
      common/JackServer.h
  22. +1
    -49
      common/JackServerAPI.cpp
  23. +4
    -4
      common/JackServerGlobals.cpp
  24. +10
    -1
      common/JackServerGlobals.h
  25. +0
    -15
      common/JackShmMem.cpp
  26. +27
    -13
      common/JackShmMem.h
  27. +6
    -2
      common/JackSocketClientChannel.cpp
  28. +1
    -1
      common/JackSocketClientChannel.h
  29. +5
    -2
      common/JackSocketServerChannel.cpp
  30. +1
    -1
      common/JackSocketServerChannel.h
  31. +5
    -2
      common/JackSocketServerNotifyChannel.cpp
  32. +1
    -1
      common/JackSocketServerNotifyChannel.h
  33. +5
    -5
      common/JackSynchro.h
  34. +6
    -22
      common/Jackdmp.cpp
  35. +0
    -4
      common/jack/jack.h
  36. +0
    -12
      common/shm.c
  37. +4
    -2
      common/varargs.h
  38. +7
    -3
      macosx/JackMachClientChannel.cpp
  39. +1
    -1
      macosx/JackMachClientChannel.h
  40. +10
    -10
      macosx/JackMachSemaphore.cpp
  41. +5
    -5
      macosx/JackMachSemaphore.h
  42. +4
    -2
      macosx/JackMachServerChannel.cpp
  43. +1
    -1
      macosx/JackMachServerChannel.h
  44. +4
    -2
      macosx/JackMachServerNotifyChannel.cpp
  45. +1
    -1
      macosx/JackMachServerNotifyChannel.h
  46. +5
    -4
      tests/jack_test.cpp
  47. +6
    -6
      tests/testSem.cpp
  48. +2
    -2
      tests/testSynchroClient.cpp
  49. +2
    -2
      tests/testSynchroServer.cpp
  50. +4
    -4
      tests/testSynchroServerClient.cpp
  51. +36
    -36
      windows/JackWinNamedPipeClientChannel.cpp
  52. +7
    -7
      windows/JackWinNamedPipeClientChannel.h
  53. +41
    -41
      windows/JackWinNamedPipeServerChannel.cpp
  54. +1
    -1
      windows/JackWinNamedPipeServerChannel.h
  55. +1
    -1
      windows/JackWinNamedPipeServerNotifyChannel.cpp
  56. +1
    -1
      windows/JackWinNamedPipeServerNotifyChannel.h

+ 4
- 0
ChangeLog View File

@@ -13,6 +13,10 @@ Tom Szilagyi
Jackdmp changes log
---------------------------

2007-10-24 Stephane Letz <letz@grame.fr>

* Implementation of server_name setting (-n) in progress.

2007-10-23 Stephane Letz <letz@grame.fr>

* Correct jack_acquire_real_time_scheduling on OSX.


+ 1
- 3
common/JackAPI.cpp View File

@@ -53,10 +53,8 @@ extern "C"
EXPORT int jack_internal_client_new (const char *client_name,
const char *load_name,
const char *load_init);
EXPORT jack_client_t* my_jack_internal_client_new(const char* client_name);
EXPORT void jack_internal_client_close (const char *client_name);
EXPORT void my_jack_internal_client_close (jack_client_t* client);
EXPORT int jack_is_realtime (jack_client_t *client);
EXPORT int jack_is_realtime (jack_client_t *client);
EXPORT void jack_on_shutdown (jack_client_t *client,
void (*function)(void *arg), void *arg);
EXPORT int jack_set_process_callback (jack_client_t *client,


+ 0
- 2
common/JackAPIWrapper.cpp View File

@@ -36,9 +36,7 @@ extern "C"
EXPORT int jack_internal_client_new (const char *client_name,
const char *load_name,
const char *load_init);
EXPORT jack_client_t* my_jack_internal_client_new(const char* client_name, const char* dll_name, const char* object_data);
EXPORT void jack_internal_client_close (const char *client_name);
EXPORT void my_jack_internal_client_close (jack_client_t* client);
EXPORT int jack_is_realtime (jack_client_t *client);
EXPORT void jack_on_shutdown (jack_client_t *client,
void (*function)(void *arg), void *arg);


+ 3
- 3
common/JackChannel.h View File

@@ -48,7 +48,7 @@ class JackClientChannelInterface
{}

// Open the Server/Client connection
virtual int Open(const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
virtual int Open(const char* server_name, const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
{
return 0;
}
@@ -170,7 +170,7 @@ class JackServerChannelInterface
{}

// Open the Server/Client connection
virtual int Open(JackServer* server)
virtual int Open(const char* server_name, JackServer* server)
{
return 0;
}
@@ -194,7 +194,7 @@ class JackServerNotifyChannelInterface
{}

// Open the Server RT/Server connection
virtual int Open()
virtual int Open(const char* server_name)
{
return 0;
}


+ 2
- 1
common/JackClient.h View File

@@ -76,6 +76,7 @@ class JackClient : public JackClientInterface, public JackRunnableInterface
void* fTimebaseArg;
void* fSyncArg;
int fConditionnal;
char fServerName[64];

JackThread* fThread; /*! Thread to execute the Process function */
JackClientChannelInterface* fChannel;
@@ -99,7 +100,7 @@ class JackClient : public JackClientInterface, public JackRunnableInterface
JackClient(JackSynchro** table);
virtual ~JackClient();

virtual int Open(const char* name, jack_options_t options, jack_status_t* status) = 0;
virtual int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status) = 0;
virtual int Close();

virtual JackGraphManager* GetGraphManager() const = 0;


+ 2
- 2
common/JackDebugClient.cpp View File

@@ -74,9 +74,9 @@ JackDebugClient::~JackDebugClient()
delete fClient;
}

int JackDebugClient::Open(const char* name, jack_options_t options, jack_status_t* status)
int JackDebugClient::Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status)
{
int res = fClient->Open(name, options, status);
int res = fClient->Open(server_name, name, options, status);
char provstr[256];
char buffer[256];
time_t curtime;


+ 1
- 1
common/JackDebugClient.h View File

@@ -67,7 +67,7 @@ class JackDebugClient : public JackClient
JackDebugClient(JackClient* fTheClient);
virtual ~JackDebugClient();

virtual int Open(const char* name, jack_options_t options, jack_status_t* status);
virtual int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);
int Close();

virtual JackGraphManager* GetGraphManager() const;


+ 3
- 3
common/JackEngine.cpp View File

@@ -67,7 +67,7 @@ int JackEngine::Open()
JackLog("JackEngine::Open\n");

// Open audio thread => request thread communication channel
if (fChannel->Open() < 0) {
if (fChannel->Open(fEngineControl->fServerName) < 0) {
jack_error("Cannot connect to server");
return -1;
} else {
@@ -515,7 +515,7 @@ int JackEngine::ClientExternalOpen(const char* name, int* ref, int* shared_engin
JackExternalClient* client = new JackExternalClient();

if (!fSynchroTable[refnum]->Allocate(name, 0)) {
if (!fSynchroTable[refnum]->Allocate(name, fEngineControl->fServerName, 0)) {
jack_error("Cannot allocate synchro");
goto error;
}
@@ -562,7 +562,7 @@ int JackEngine::ClientInternalOpen(const char* name, int* ref, JackEngineControl
return -1;
}

if (!fSynchroTable[refnum]->Allocate(name, 0)) {
if (!fSynchroTable[refnum]->Allocate(name, fEngineControl->fServerName, 0)) {
jack_error("Cannot allocate synchro");
return -1;
}


+ 6
- 2
common/JackEngineControl.h View File

@@ -47,18 +47,22 @@ struct JackEngineControl : public JackShmMem
UInt64 fPeriod;
UInt64 fComputation;
UInt64 fConstraint;
char fServerName[64];
JackFrameTimer fFrameTimer;
JackTransportEngine fTransport;
bool fVerbose;
JackEngineControl(bool sync, bool temporary, long timeout, bool rt, long priority, bool verbose)
JackEngineControl(bool sync, bool temporary, long timeout, bool rt, long priority, bool verbose, const char* server_name)
:fSyncMode(sync),
fTemporary(temporary),
fTimeOutUsecs(timeout * 1000),
fRealTime(rt),
fPriority(priority),
fVerbose(verbose)
{}
{
snprintf(fServerName, sizeof(fServerName), server_name);
}
void InitFrameTime()
{


+ 12
- 12
common/JackFifo.cpp View File

@@ -29,9 +29,9 @@ This program is free software; you can redistribute it and/or modify
namespace Jack
{

void JackFifo::BuildName(const char* name, char* res)
void JackFifo::BuildName(const char* name, const char* server_name, char* res)
{
sprintf(res, "%s/jack_fifo.%s", jack_client_dir, name);
sprintf(res, "%s/jack_fifo.%s_%s", jack_client_dir, server_name, name);
}

bool JackFifo::Signal()
@@ -103,10 +103,10 @@ bool JackFifo::TimedWait(long usec)
#endif

// Server side
bool JackFifo::Allocate(const char* name, int value)
bool JackFifo::Allocate(const char* name, const char* server_name, int value)
{
struct stat statbuf;
BuildName(name, fName);
BuildName(name, server_name, fName);

JackLog("JackFifo::Allocate name = %s\n", fName);

@@ -138,9 +138,9 @@ bool JackFifo::Allocate(const char* name, int value)
}

// Client side
bool JackFifo::ConnectAux(const char* name, int access)
bool JackFifo::ConnectAux(const char* name, const char* server_name, int access)
{
BuildName(name, fName);
BuildName(name, server_name, fName);
JackLog("JackFifo::ConnectAux name = %s\n", fName);

// Temporary...
@@ -159,19 +159,19 @@ bool JackFifo::ConnectAux(const char* name, int access)
}
}

bool JackFifo::Connect(const char* name)
bool JackFifo::Connect(const char* name, const char* server_name)
{
return ConnectAux(name, O_RDWR);
return ConnectAux(name, server_name, O_RDWR);
}

bool JackFifo::ConnectOutput(const char* name)
bool JackFifo::ConnectOutput(const char* name, const char* server_name)
{
return ConnectAux(name, O_WRONLY | O_NONBLOCK);
return ConnectAux(name, server_name, O_WRONLY | O_NONBLOCK);
}

bool JackFifo::ConnectInput(const char* name)
bool JackFifo::ConnectInput(const char* name, const char* server_name)
{
return ConnectAux(name, O_RDONLY);
return ConnectAux(name, server_name, O_RDONLY);
}

bool JackFifo::Disconnect()


+ 6
- 6
common/JackFifo.h View File

@@ -40,11 +40,11 @@ class JackFifo : public JackSynchro
int fFifo;
pollfd fPoll;

bool ConnectAux(const char* name, int access);
bool ConnectAux(const char* name, const char* server_name, int access);

protected:

void BuildName(const char* name, char* res);
void BuildName(const char* name, const char* server_name, char* res);

public:

@@ -58,10 +58,10 @@ class JackFifo : public JackSynchro
bool Wait();
bool TimedWait(long usec);

bool Allocate(const char* name, int value);
bool Connect(const char* name);
bool ConnectInput(const char* name);
bool ConnectOutput(const char* name);
bool Allocate(const char* name, const char* server_name, int value);
bool Connect(const char* name, const char* server_name);
bool ConnectInput(const char* name, const char* server_name);
bool ConnectOutput(const char* name, const char* server_name);
bool Disconnect();
void Destroy();
};


+ 5
- 3
common/JackInternalClient.cpp View File

@@ -65,11 +65,13 @@ JackInternalClient::~JackInternalClient()
delete fChannel;
}

int JackInternalClient::Open(const char* name, jack_options_t options, jack_status_t* status)
int JackInternalClient::Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status)
{
int result;
char name_res[JACK_CLIENT_NAME_SIZE];
JackLog("JackInternalClient::Open name = %s\n", name);
snprintf(fServerName, sizeof(fServerName), server_name);
fChannel->ClientCheck(name, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result);
if (result < 0) {
@@ -154,9 +156,9 @@ JackLoadableInternalClient::~JackLoadableInternalClient()
UnloadJackModule(fHandle);
}

int JackLoadableInternalClient::Open(const char* name, jack_options_t options, jack_status_t* status)
int JackLoadableInternalClient::Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status)
{
int res = JackInternalClient::Open(name, options, status);
int res = JackInternalClient::Open(server_name, name, options, status);
if (res == 0)
fInitialize((jack_client_t*)this, fObjectData);
return res;


+ 2
- 2
common/JackInternalClient.h View File

@@ -45,7 +45,7 @@ class JackInternalClient : public JackClient
JackInternalClient(JackServer* server, JackSynchro** table);
virtual ~JackInternalClient();

int Open(const char* name, jack_options_t options, jack_status_t* status);
int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);

JackGraphManager* GetGraphManager() const;
JackEngineControl* GetEngineControl() const;
@@ -95,7 +95,7 @@ class JackLoadableInternalClient : public JackInternalClient
JackLoadableInternalClient(JackServer* server, JackSynchro** table, const char* so_name, const char* object_data);
virtual ~JackLoadableInternalClient();
int Open(const char* name, jack_options_t options, jack_status_t* status);
int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);

};



+ 2
- 2
common/JackLibAPI.cpp View File

@@ -77,7 +77,7 @@ static jack_client_t* jack_client_open_aux(const char* client_name, jack_options
va_start(ap, status);
jack_varargs_parse(options, ap, &va);
va_end(ap);
JackLog("jack_client_open %s\n", client_name);
if (client_name == NULL) {
jack_error("jack_client_new called with a NULL client_name");
@@ -100,7 +100,7 @@ static jack_client_t* jack_client_open_aux(const char* client_name, jack_options
JackClient* client = new JackLibClient(GetSynchroTable());
#endif

int res = client->Open(client_name, options, status);
int res = client->Open(va.server_name, client_name, options, status);
if (res < 0) {
delete client;
JackLibGlobals::Destroy(); // jack library destruction


+ 10
- 8
common/JackLibClient.cpp View File

@@ -61,14 +61,16 @@ JackLibClient::~JackLibClient()
delete fChannel;
}

int JackLibClient::Open(const char* name, jack_options_t options, jack_status_t* status)
int JackLibClient::Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status)
{
int shared_engine, shared_client, shared_graph, result;
JackLog("JackLibClient::Open %s\n", name);
snprintf(fServerName, sizeof(fServerName), server_name);
// Open server/client channel
char name_res[JACK_CLIENT_NAME_SIZE];
if (fChannel->Open(name, name_res, this, options, status) < 0) {
if (fChannel->Open(server_name, name, name_res, this, options, status) < 0) {
jack_error("Cannot connect to the server");
goto error;
}
@@ -88,9 +90,9 @@ int JackLibClient::Open(const char* name, jack_options_t options, jack_status_t*

try {
// Map shared memory segments
JackLibGlobals::fGlobals->fEngineControl = shared_engine;
JackLibGlobals::fGlobals->fGraphManager = shared_graph;
fClientControl = shared_client;
JackLibGlobals::fGlobals->fEngineControl.SetShmIndex(shared_engine, fServerName);
JackLibGlobals::fGlobals->fGraphManager.SetShmIndex(shared_graph, fServerName);
fClientControl.SetShmIndex(shared_client, fServerName);
jack_verbose = GetEngineControl()->fVerbose;
} catch (int n) {
jack_error("Map shared memory segments exception %d", n);
@@ -109,7 +111,7 @@ int JackLibClient::Open(const char* name, jack_options_t options, jack_status_t*
#endif
*/
// Connect shared synchro : the synchro must be usable in I/O mode when several clients live in the same process
if (!fSynchroTable[fClientControl->fRefNum]->Connect(name_res)) {
if (!fSynchroTable[fClientControl->fRefNum]->Connect(name_res, fServerName)) {
jack_error("Cannot ConnectSemaphore %s client", name_res);
goto error;
}
@@ -135,8 +137,8 @@ int JackLibClient::ClientNotifyImp(int refnum, const char* name, int notify, int

case kAddClient:
JackLog("JackClient::AddClient name = %s, ref = %ld \n", name, refnum);
// the synchro must be usable in I/O mode when several clients live in the same process
res = fSynchroTable[refnum]->Connect(name) ? 0 : -1;
// the synchro must be usable in I/O mode when several clients live in the same process
res = fSynchroTable[refnum]->Connect(name, fServerName) ? 0 : -1;
break;

case kRemoveClient:


+ 1
- 1
common/JackLibClient.h View File

@@ -44,7 +44,7 @@ class JackLibClient : public JackClient
JackLibClient(JackSynchro** table);
virtual ~JackLibClient();

int Open(const char* name, jack_options_t options, jack_status_t* status);
int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);

int ClientNotifyImp(int refnum, const char* name, int notify, int sync, int value);



+ 10
- 10
common/JackPosixSemaphore.cpp View File

@@ -26,9 +26,9 @@ This program is free software; you can redistribute it and/or modify
namespace Jack
{

void JackPosixSemaphore::BuildName(const char* name, char* res)
void JackPosixSemaphore::BuildName(const char* name, const char* server_name, char* res)
{
sprintf(res, "%s/jack_sem.%s", jack_client_dir, name);
sprintf(res, "%s/jack_sem.%s_%s", jack_client_dir, server_name, name);
}

bool JackPosixSemaphore::Signal()
@@ -123,9 +123,9 @@ bool JackPosixSemaphore::TimedWait(long usec)
}

// Server side : publish the semaphore in the global namespace
bool JackPosixSemaphore::Allocate(const char* name, int value)
bool JackPosixSemaphore::Allocate(const char* name, const char* server_name, int value)
{
BuildName(name, fName);
BuildName(name, server_name, fName);
JackLog("JackPosixSemaphore::Allocate name = %s val = %ld\n", fName, value);

if ((fSemaphore = sem_open(fName, O_CREAT, 0777, value)) == (sem_t*)SEM_FAILED) {
@@ -137,9 +137,9 @@ bool JackPosixSemaphore::Allocate(const char* name, int value)
}

// Client side : get the published semaphore from server
bool JackPosixSemaphore::ConnectInput(const char* name)
bool JackPosixSemaphore::ConnectInput(const char* name, const char* server_name)
{
BuildName(name, fName);
BuildName(name, server_name, fName);
JackLog("JackPosixSemaphore::Connect %s\n", fName);

// Temporary...
@@ -159,14 +159,14 @@ bool JackPosixSemaphore::ConnectInput(const char* name)
}
}

bool JackPosixSemaphore::Connect(const char* name)
bool JackPosixSemaphore::Connect(const char* name, const char* server_name)
{
return ConnectInput(name);
return ConnectInput(name, server_name);
}

bool JackPosixSemaphore::ConnectOutput(const char* name)
bool JackPosixSemaphore::ConnectOutput(const char* name, const char* server_name)
{
return ConnectInput(name);
return ConnectInput(name, server_name);
}

bool JackPosixSemaphore::Disconnect()


+ 5
- 5
common/JackPosixSemaphore.h View File

@@ -42,7 +42,7 @@ class JackPosixSemaphore : public JackSynchro

protected:

void BuildName(const char* name, char* res);
void BuildName(const char* name, const char* server_name, char* res);

public:

@@ -56,10 +56,10 @@ class JackPosixSemaphore : public JackSynchro
bool Wait();
bool TimedWait(long usec);

bool Allocate(const char* name, int value);
bool Connect(const char* name);
bool ConnectInput(const char* name);
bool ConnectOutput(const char* name);
bool Allocate(const char* name, const char* server_name, int value);
bool Connect(const char* name, const char* server_name);
bool ConnectInput(const char* name, const char* server_name);
bool ConnectOutput(const char* name, const char* server_name);
bool Disconnect();
void Destroy();
};


+ 2
- 2
common/JackProcessSync.h View File

@@ -137,7 +137,7 @@ class JackInterProcessSync : public JackSyncInterface

bool Allocate(const char* name)
{
return fSynchro->Allocate(name, 0);
return fSynchro->Allocate(name, "", 0);
}

void Destroy()
@@ -147,7 +147,7 @@ class JackInterProcessSync : public JackSyncInterface

bool Connect(const char* name)
{
return fSynchro->Connect(name);
return fSynchro->Connect(name, "");
}

bool TimedWait(long usec)


+ 4
- 4
common/JackServer.cpp View File

@@ -46,13 +46,13 @@ namespace Jack

JackServer* JackServer::fInstance = NULL;

JackServer::JackServer(bool sync, bool temporary, long timeout, bool rt, long priority, long loopback, bool verbose)
JackServer::JackServer(bool sync, bool temporary, long timeout, bool rt, long priority, long loopback, bool verbose, const char* server_name)
{
JackGlobals::InitServer();
for (int i = 0; i < CLIENT_NUM; i++)
fSynchroTable[i] = JackGlobals::MakeSynchro();
fGraphManager = new JackGraphManager();
fEngineControl = new JackEngineControl(sync, temporary, timeout, rt, priority, verbose);
fEngineControl = new JackEngineControl(sync, temporary, timeout, rt, priority, verbose, server_name);
fEngine = new JackEngine(fGraphManager, fSynchroTable, fEngineControl);
fFreewheelDriver = new JackThreadedDriver(new JackFreewheelDriver("freewheel", fEngine, fSynchroTable));
fLoopbackDriver = new JackLoopbackDriver("loopback", fEngine, fSynchroTable);
@@ -89,7 +89,7 @@ JackServer::~JackServer()

int JackServer::Open(jack_driver_desc_t* driver_desc, JSList* driver_params)
{
if (fChannel->Open(this) < 0) {
if (fChannel->Open(fEngineControl->fServerName, this) < 0) {
jack_error("Server channel open error");
return -1;
}
@@ -179,7 +179,7 @@ int JackServer::InternalClientLoad(const char* client_name, const char* so_name,
*status = 0;
JackLoadableInternalClient* client = new JackLoadableInternalClient(fInstance, GetSynchroTable(), so_name, objet_data);
assert(client);
int res = client->Open(client_name, (jack_options_t)options, (jack_status_t*)status);
int res = client->Open("unused", client_name, (jack_options_t)options, (jack_status_t*)status);
if (res < 0) {
delete client;
*int_ref = 0;


+ 1
- 1
common/JackServer.h View File

@@ -61,7 +61,7 @@ class EXPORT JackServer

public:

JackServer(bool sync, bool temporary, long timeout, bool rt, long priority, long loopback, bool verbose);
JackServer(bool sync, bool temporary, long timeout, bool rt, long priority, long loopback, bool verbose, const char* server_name);
virtual ~JackServer();

int Open(jack_driver_desc_t* driver_desc, JSList* driver_params);


+ 1
- 49
common/JackServerAPI.cpp View File

@@ -41,9 +41,6 @@ extern "C"
{
#endif

EXPORT jack_client_t* my_jack_internal_client_new(const char* client_name, const char* dll_name, const char* object_data);
EXPORT void my_jack_internal_client_close(jack_client_t* ext_client);

EXPORT jack_client_t * jack_client_open (const char *client_name,
jack_options_t options,
jack_status_t *status, ...);
@@ -56,51 +53,6 @@ extern "C"

using namespace Jack;

EXPORT jack_client_t* my_jack_internal_client_new(const char* client_name, const char* dll_name, const char* object_data)
{
jack_status_t my_status = (jack_status_t)0;

JackLog("jack_internal_client_new %s", client_name);
if (client_name == NULL) {
jack_error("jack_internal_client_new called with a NULL client_name");
return NULL;
}
JackClient* client;
try {
#ifdef __CLIENTDEBUG__
client = new JackDebugClient(new JackLoadableInternalClient(JackServer::fInstance, GetSynchroTable(), dll_name, object_data)); // Debug mode
#else
client = new JackLoadableInternalClient(JackServer::fInstance, GetSynchroTable(), dll_name, object_data); // To improve...
#endif
} catch (...) { // Allocation or dynamic code loading failure
return NULL;
}

jack_options_t options = JackUseExactName;
int res = client->Open(client_name, options, &my_status);
if (res < 0) {
delete client;
return NULL;
} else {
return (jack_client_t*)client;
}
}

EXPORT void my_jack_internal_client_close(jack_client_t* ext_client)
{
JackLog("jack_internal_client_close");
JackClient* client = (JackClient*)ext_client;
if (client == NULL) {
jack_error("jack_internal_client_close called with a NULL client");
} else {
client->Close();
delete client;
JackLog("jack_internal_client_close OK");
}
}

EXPORT jack_client_t* jack_client_new(const char* client_name)
{
int options = JackUseExactName;
@@ -150,7 +102,7 @@ EXPORT jack_client_t* jack_client_open(const char* client_name, jack_options_t o
JackClient* client = new JackInternalClient(JackServer::fInstance, GetSynchroTable()); // To improve...
#endif

int res = client->Open(client_name, options, status);
int res = client->Open(va.server_name, client_name, options, status);
if (res < 0) {
delete client;
JackServerGlobals::Destroy(); // jack server destruction


+ 4
- 4
common/JackServerGlobals.cpp View File

@@ -46,7 +46,7 @@ static char* jack_default_server_name(void)
{
char* server_name;
if ((server_name = getenv("JACK_DEFAULT_SERVER")) == NULL)
server_name = "jackdmp_default";
server_name = "default";
return server_name;
}

@@ -141,10 +141,10 @@ jack_cleanup_files(const char *server_name)

#endif

int JackServerGlobals::JackStart(jack_driver_desc_t* driver_desc, JSList* driver_params, int sync, int temporary, int time_out_ms, int rt, int priority, int loopback, int verbose)
int JackServerGlobals::JackStart(const char* server_name, jack_driver_desc_t* driver_desc, JSList* driver_params, int sync, int temporary, int time_out_ms, int rt, int priority, int loopback, int verbose)
{
JackLog("Jackdmp: sync = %ld timeout = %ld rt = %ld priority = %ld verbose = %ld \n", sync, time_out_ms, rt, priority, verbose);
fServer = new JackServer(sync, temporary, time_out_ms, rt, priority, loopback, verbose);
fServer = new JackServer(sync, temporary, time_out_ms, rt, priority, loopback, verbose, server_name);
int res = fServer->Open(driver_desc, driver_params);
return (res < 0) ? res : fServer->Start();
}
@@ -384,7 +384,7 @@ bool JackServerGlobals::Init()
free(argv[i]);
}
int res = JackStart(driver_desc, driver_params, sync, temporary, client_timeout, realtime, realtime_priority, loopback, verbose_aux);
int res = JackStart(server_name, driver_desc, driver_params, sync, temporary, client_timeout, realtime, realtime_priority, loopback, verbose_aux);
if (res < 0) {
jack_error("Cannot start server... exit");
JackDelete();


+ 10
- 1
common/JackServerGlobals.h View File

@@ -46,7 +46,16 @@ struct JackServerGlobals

static bool Init();
static void Destroy();
static int JackStart(jack_driver_desc_t* driver_desc, JSList* driver_params, int sync, int temporary, int time_out_ms, int rt, int priority, int loopback, int verbose);
static int JackStart(const char* server_name,
jack_driver_desc_t* driver_desc,
JSList* driver_params,
int sync,
int temporary,
int time_out_ms,
int rt,
int priority,
int loopback,
int verbose);
static int JackStop();
static int JackDelete();
};


+ 0
- 15
common/JackShmMem.cpp View File

@@ -26,8 +26,6 @@ namespace Jack
{

unsigned long JackShmMem::fSegmentNum = 0;
unsigned long JackShmMem::fSegmentCount = 0;

jack_shm_info_t JackShmMem::gInfo;
size_t JackMem::gSize = 0;

@@ -39,14 +37,6 @@ void* JackShmMem::operator new(size_t size)

snprintf(name, sizeof(name), "/jack_shared%ld", JackShmMem::fSegmentNum++);

if (JackShmMem::fSegmentCount++ == 0) {
JackLog("jack_initialize_shm\n");
if (jack_initialize_shm_server() < 0) {
jack_error("cannot initialize shm", strerror(errno));
goto error;
}
}

if (jack_shmalloc(name, size, &info)) {
jack_error("cannot create shared memory segment of size = %d", size, strerror(errno));
goto error;
@@ -84,11 +74,6 @@ void JackShmMem::operator delete(void* p, size_t size)

jack_release_shm(&info);
jack_destroy_shm(&info);

if (--JackShmMem::fSegmentCount == 0) {
JackLog("jack_cleanup_shm\n");
jack_cleanup_shm();
}
}

void LockMemoryImp(void* ptr, size_t size)


+ 27
- 13
common/JackShmMem.h View File

@@ -100,7 +100,6 @@ class JackShmMem

jack_shm_info_t fInfo;
static unsigned long fSegmentNum;
static unsigned long fSegmentCount;
static jack_shm_info_t gInfo;

public:
@@ -152,11 +151,11 @@ class JackShmReadWritePtr

jack_shm_info_t fInfo;

void Init(int index)
void Init(int index, const char* server_name = "default")
{
if (fInfo.index < 0 && index >= 0) {
JackLog("JackShmReadWritePtr::Init %ld %ld\n", index, fInfo.index);
if (jack_initialize_shm_client() < 0)
if (jack_initialize_shm(server_name) < 0)
throw - 1;
fInfo.index = index;
if (jack_attach_shm(&fInfo)) {
@@ -174,9 +173,9 @@ class JackShmReadWritePtr
fInfo.attached_at = NULL;
}

JackShmReadWritePtr(int index)
JackShmReadWritePtr(int index, const char* server_name)
{
Init(index);
Init(index, server_name);
}

virtual ~JackShmReadWritePtr()
@@ -203,6 +202,11 @@ class JackShmReadWritePtr
Init(index);
return *this;
}
void SetShmIndex(int index, const char* server_name)
{
Init(index, server_name);
}

int GetShmIndex()
{
@@ -227,11 +231,11 @@ class JackShmReadWritePtr1

jack_shm_info_t fInfo;

void Init(int index)
void Init(int index, const char* server_name = "default")
{
if (fInfo.index < 0 && index >= 0) {
JackLog("JackShmReadWritePtr1::Init %ld %ld\n", index, fInfo.index);
if (jack_initialize_shm_client() < 0)
if (jack_initialize_shm(server_name) < 0)
throw - 1;
fInfo.index = index;
if (jack_attach_shm(&fInfo)) {
@@ -255,9 +259,9 @@ class JackShmReadWritePtr1
fInfo.attached_at = NULL;
}

JackShmReadWritePtr1(int index)
JackShmReadWritePtr1(int index, const char* server_name)
{
Init(index);
Init(index, server_name);
}

virtual ~JackShmReadWritePtr1()
@@ -284,6 +288,11 @@ class JackShmReadWritePtr1
Init(index);
return *this;
}
void SetShmIndex(int index, const char* server_name)
{
Init(index, server_name);
}

int GetShmIndex()
{
@@ -308,11 +317,11 @@ class JackShmReadPtr

jack_shm_info_t fInfo;

void Init(int index)
void Init(int index, const char* server_name = "default")
{
if (fInfo.index < 0 && index >= 0) {
JackLog("JackShmPtrRead::Init %ld %ld\n", index, fInfo.index);
if (jack_initialize_shm_client() < 0)
if (jack_initialize_shm(server_name) < 0)
throw - 1;
fInfo.index = index;
if (jack_attach_shm_read(&fInfo)) {
@@ -330,9 +339,9 @@ class JackShmReadPtr
fInfo.attached_at = NULL;
}

JackShmReadPtr(int index)
JackShmReadPtr(int index, const char* server_name)
{
Init(index);
Init(index, server_name);
}

virtual ~JackShmReadPtr()
@@ -359,6 +368,11 @@ class JackShmReadPtr
Init(index);
return *this;
}
void SetShmIndex(int index, const char* server_name)
{
Init(index, server_name);
}

int GetShmIndex()
{


+ 6
- 2
common/JackSocketClientChannel.cpp View File

@@ -41,6 +41,8 @@ JackSocketClientChannel::~JackSocketClientChannel()
int JackSocketClientChannel::ServerCheck(const char* server_name)
{
JackLog("JackSocketClientChannel::ServerCheck = %s\n", server_name);
char jack_server_dir_name[512];
snprintf(jack_server_dir_name, sizeof(jack_server_dir_name), "%s/%s", jack_server_dir, server_name);
// Connect to server
if (fRequestSocket.Connect(jack_server_dir, 0) < 0) {
@@ -52,12 +54,14 @@ int JackSocketClientChannel::ServerCheck(const char* server_name)
}
}

int JackSocketClientChannel::Open(const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
int JackSocketClientChannel::Open(const char* server_name, const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
{
int result = 0;
JackLog("JackSocketClientChannel::Open name = %s\n", name);
char jack_server_dir_name[512];
snprintf(jack_server_dir_name, sizeof(jack_server_dir_name), "%s/%s", jack_server_dir, server_name);

if (fRequestSocket.Connect(jack_server_dir, 0) < 0) {
if (fRequestSocket.Connect(jack_server_dir_name, 0) < 0) {
jack_error("Cannot connect to server socket");
goto error;
}


+ 1
- 1
common/JackSocketClientChannel.h View File

@@ -51,7 +51,7 @@ class JackSocketClientChannel : public JackClientChannelInterface, public JackRu
JackSocketClientChannel();
virtual ~JackSocketClientChannel();

int Open(const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status);
int Open(const char* server_name, const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status);
void Close();

int Start();


+ 5
- 2
common/JackSocketServerChannel.cpp View File

@@ -44,13 +44,16 @@ JackSocketServerChannel::~JackSocketServerChannel()
delete[] fPollTable;
}

int JackSocketServerChannel::Open(JackServer* server)
int JackSocketServerChannel::Open(const char* server_name, JackServer* server)
{
JackLog("JackSocketServerChannel::Open \n");
char jack_server_dir_name[512];
snprintf(jack_server_dir_name, sizeof(jack_server_dir_name), "%s/%s", jack_server_dir, server_name);

fServer = server;

// Prepare request socket
if (fRequestListenSocket.Bind(jack_server_dir, 0) < 0) {
if (fRequestListenSocket.Bind(jack_server_dir_name, 0) < 0) {
JackLog("JackSocketServerChannel::Open : cannot create result listen socket\n");
return -1;
}


+ 1
- 1
common/JackSocketServerChannel.h View File

@@ -57,7 +57,7 @@ class JackSocketServerChannel : public JackServerChannelInterface, public JackRu
JackSocketServerChannel();
virtual ~JackSocketServerChannel();

int Open(JackServer* server); // Open the Server/Client connection
int Open(const char* server_name, JackServer* server); // Open the Server/Client connection
void Close(); // Close the Server/Client connection

// JackRunnableInterface interface


+ 5
- 2
common/JackSocketServerNotifyChannel.cpp View File

@@ -25,9 +25,12 @@ This program is free software; you can redistribute it and/or modify
namespace Jack
{

int JackSocketServerNotifyChannel::Open()
int JackSocketServerNotifyChannel::Open(const char* server_name)
{
if (fRequestSocket.Connect(jack_server_dir, 0) < 0) {
char jack_server_dir_name[512];
snprintf(jack_server_dir_name, sizeof(jack_server_dir_name), "%s/%s", jack_server_dir, server_name);

if (fRequestSocket.Connect(jack_server_dir_name, 0) < 0) {
jack_error("Cannot connect to server socket");
return -1;
} else {


+ 1
- 1
common/JackSocketServerNotifyChannel.h View File

@@ -43,7 +43,7 @@ class JackSocketServerNotifyChannel : public JackServerNotifyChannelInterface
virtual ~JackSocketServerNotifyChannel()
{}

int Open();
int Open(const char* server_name);
void Close();

void ClientNotify(int refnum, int notify, int value);


+ 5
- 5
common/JackSynchro.h View File

@@ -39,7 +39,7 @@ class JackSynchro
char fName[SYNC_MAX_NAME_SIZE];
bool fFlush; // If true, signal are "flushed" : used for drivers that do no consume the signal

virtual void BuildName(const char* name, char* res)
virtual void BuildName(const char* name, const char* server_name, char* res)
{}

public:
@@ -65,19 +65,19 @@ class JackSynchro
{
return true;
}
virtual bool Allocate(const char* name, int value)
virtual bool Allocate(const char* name, const char* server_name, int value)
{
return true;
}
virtual bool Connect(const char* name)
virtual bool Connect(const char* name, const char* server_name)
{
return true;
}
virtual bool ConnectInput(const char* name)
virtual bool ConnectInput(const char* name, const char* server_name)
{
return true;
}
virtual bool ConnectOutput(const char* name)
virtual bool ConnectOutput(const char* name, const char* server_name)
{
return true;
}


+ 6
- 22
common/Jackdmp.cpp View File

@@ -73,7 +73,7 @@ static void usage(FILE* file)
copyright(file);
fprintf(file, "\n"
"usage: jackdmp [ --realtime OR -R [ --realtime-priority OR -P priority ] ]\n"
// " [ --name OR -n server-name ]\n"
" [ --name OR -n server-name ]\n"
// " [ --no-mlock OR -m ]\n"
// " [ --unlock OR -u ]\n"
" [ --timeout OR -t client-timeout-in-msecs ]\n"
@@ -103,10 +103,10 @@ static void DoNothingHandler(int sig)
write(1, buf, strlen(buf));
}

static int JackStart(jack_driver_desc_t* driver_desc, JSList* driver_params, int sync, int temporary, int time_out_ms, int rt, int priority, int loopback, int verbose)
static int JackStart(const char* server_name, jack_driver_desc_t* driver_desc, JSList* driver_params, int sync, int temporary, int time_out_ms, int rt, int priority, int loopback, int verbose)
{
JackLog("Jackdmp: sync = %ld timeout = %ld rt = %ld priority = %ld verbose = %ld \n", sync, time_out_ms, rt, priority, verbose);
fServer = new JackServer(sync, temporary, time_out_ms, rt, priority, loopback, verbose);
fServer = new JackServer(sync, temporary, time_out_ms, rt, priority, loopback, verbose, server_name);
int res = fServer->Open(driver_desc, driver_params);
return (res < 0) ? res : fServer->Start();
}
@@ -141,7 +141,7 @@ static char* jack_default_server_name(void)
{
char* server_name;
if ((server_name = getenv("JACK_DEFAULT_SERVER")) == NULL)
server_name = "jackdmp_default";
server_name = "default";
return server_name;
}

@@ -452,7 +452,7 @@ int main(int argc, char* argv[])
if (!realtime && client_timeout == 0)
client_timeout = 500; /* 0.5 sec; usable when non realtime. */

int res = JackStart(driver_desc, driver_params, sync, temporary, client_timeout, realtime, realtime_priority, loopback, jack_verbose);
int res = JackStart(server_name, driver_desc, driver_params, sync, temporary, client_timeout, realtime, realtime_priority, loopback, jack_verbose);
if (res < 0) {
jack_error("Cannot start server... exit");
JackDelete();
@@ -460,14 +460,6 @@ int main(int argc, char* argv[])
}
/*
jack_client_t* c1 = my_jack_internal_client_new("c1", "inprocess.so", "untitled");
jack_client_t* c2 = my_jack_internal_client_new("c2", "inprocess.so", "untitled");
jack_client_t* c3 = my_jack_internal_client_new("c3", "inprocess.so", "untitled");
jack_client_t* c4 = my_jack_internal_client_new("c4", "inprocess.so", "untitled");
jack_client_t* c5 = my_jack_internal_client_new("c5", "inprocess.so", "untitled");
*/

/*
For testing purpose...
InternalMetro* client1 = new InternalMetro(1200, 0.4, 20, 80, "metro1");
InternalMetro* client2 = new InternalMetro(600, 0.4, 20, 150, "metro2");
@@ -523,15 +515,7 @@ int main(int argc, char* argv[])
sigprocmask(SIG_UNBLOCK, &signals, 0);
}
/*
my_jack_internal_client_close(c1);
my_jack_internal_client_close(c2);
my_jack_internal_client_close(c3);
my_jack_internal_client_close(c4);
my_jack_internal_client_close(c5);
*/
JackStop();
JackStop();

jack_cleanup_shm();
jack_cleanup_files(server_name);


+ 0
- 4
common/jack/jack.h View File

@@ -146,8 +146,6 @@ extern "C"
const char *load_name,
const char *load_init);

jack_client_t* my_jack_internal_client_new(const char* client_name, const char* dll_name, const char* object_data);

/**
* Remove an internal client from a JACK server.
*
@@ -155,8 +153,6 @@ extern "C"
*/
void jack_internal_client_close (const char *client_name);

void my_jack_internal_client_close (jack_client_t* client);

/**
* @param client pointer to JACK client structure.
*


+ 0
- 12
common/shm.c View File

@@ -352,18 +352,6 @@ jack_initialize_shm (const char *server_name)
}


// steph

int jack_initialize_shm_server()
{
return jack_initialize_shm("default");
}

int jack_initialize_shm_client()
{
return jack_initialize_shm("default");
}

char* jack_shm_addr (jack_shm_info_t* si)
{
return (char*)si->attached_at;


+ 4
- 2
common/varargs.h View File

@@ -15,7 +15,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id: varargs.h,v 1.3 2005/11/23 11:24:00 letz Exp $
*/

#ifndef __jack_varargs_h__
@@ -54,9 +53,12 @@ extern "C"
jack_varargs_init (va);

if ((options & JackServerName)) {
printf("jack_varargs_parse :JackServerName\n");
char *sn = va_arg(ap, char *);
if (sn)
if (sn) {
printf("jack_varargs_parse : FOUND SERVER NAME %s\n", sn);
va->server_name = sn;
}
}
if ((options & JackLoadName))
va->load_name = va_arg(ap, char *);


+ 7
- 3
macosx/JackMachClientChannel.cpp View File

@@ -44,9 +44,11 @@ JackMachClientChannel::~JackMachClientChannel()
int JackMachClientChannel::ServerCheck(const char* server_name)
{
JackLog("JackMachClientChannel::ServerCheck = %s\n", server_name);
char jack_server_entry_name[512];
snprintf(jack_server_entry_name, sizeof(jack_server_entry_name), "%s_%s", jack_server_entry, server_name);
// Connect to server
if (!fServerPort.ConnectPort(jack_server_entry)) {
if (!fServerPort.ConnectPort(jack_server_entry_name)) {
jack_error("Cannot connect to server Mach port");
return -1;
} else {
@@ -54,12 +56,14 @@ int JackMachClientChannel::ServerCheck(const char* server_name)
}
}

int JackMachClientChannel::Open(const char* name, char* name_res, JackClient* client, jack_options_t options, jack_status_t* status)
int JackMachClientChannel::Open(const char* server_name, const char* name, char* name_res, JackClient* client, jack_options_t options, jack_status_t* status)
{
JackLog("JackMachClientChannel::Open name = %s\n", name);
char jack_server_entry_name[512];
snprintf(jack_server_entry_name, sizeof(jack_server_entry_name), "%s_%s", jack_server_entry, server_name);

// Connect to server
if (!fServerPort.ConnectPort(jack_server_entry)) {
if (!fServerPort.ConnectPort(jack_server_entry_name)) {
jack_error("Cannot connect to server Mach port");
return -1;
}


+ 1
- 1
macosx/JackMachClientChannel.h View File

@@ -48,7 +48,7 @@ class JackMachClientChannel : public JackClientChannelInterface, public JackRunn
JackMachClientChannel();
virtual ~JackMachClientChannel();

int Open(const char* name, char* name_res, JackClient* client, jack_options_t options, jack_status_t* status);
int Open(const char* server_name, const char* name, char* name_res, JackClient* client, jack_options_t options, jack_status_t* status);
void Close();

int Start();


+ 10
- 10
macosx/JackMachSemaphore.cpp View File

@@ -27,9 +27,9 @@ namespace Jack

mach_port_t JackMachSemaphore::fBootPort = 0;

void JackMachSemaphore::BuildName(const char* name, char* res)
void JackMachSemaphore::BuildName(const char* name, const char* server_name, char* res)
{
sprintf(res, "jack_mach_sem.%s", name);
sprintf(res, "jack_mach_sem.%s_%s", server_name, name);
}

bool JackMachSemaphore::Signal()
@@ -84,9 +84,9 @@ bool JackMachSemaphore::TimedWait(long usec)
}

// Server side : publish the semaphore in the global namespace
bool JackMachSemaphore::Allocate(const char* name, int value)
bool JackMachSemaphore::Allocate(const char* name, const char* server_name, int value)
{
BuildName(name, fName);
BuildName(name, server_name, fName);
mach_port_t task = mach_task_self();
kern_return_t res;

@@ -128,9 +128,9 @@ bool JackMachSemaphore::Allocate(const char* name, int value)
}

// Client side : get the published semaphore from server
bool JackMachSemaphore::ConnectInput(const char* name)
bool JackMachSemaphore::ConnectInput(const char* name, const char* server_name)
{
BuildName(name, fName);
BuildName(name, server_name, fName);
kern_return_t res;

// Temporary... A REVOIR
@@ -157,14 +157,14 @@ bool JackMachSemaphore::ConnectInput(const char* name)
return true;
}

bool JackMachSemaphore::Connect(const char* name)
bool JackMachSemaphore::Connect(const char* name, const char* server_name)
{
return ConnectInput(name);
return ConnectInput(name, server_name);
}

bool JackMachSemaphore::ConnectOutput(const char* name)
bool JackMachSemaphore::ConnectOutput(const char* name, const char* server_name)
{
return ConnectInput(name);
return ConnectInput(name, server_name);
}

bool JackMachSemaphore::Disconnect()


+ 5
- 5
macosx/JackMachSemaphore.h View File

@@ -45,7 +45,7 @@ class JackMachSemaphore : public JackSynchro

protected:

void BuildName(const char* name, char* res);
void BuildName(const char* name, const char* server_name, char* res);

public:

@@ -59,10 +59,10 @@ class JackMachSemaphore : public JackSynchro
bool Wait();
bool TimedWait(long usec);

bool Allocate(const char* name, int value);
bool Connect(const char* name);
bool ConnectInput(const char* name);
bool ConnectOutput(const char* name);
bool Allocate(const char* name, const char* server_name, int value);
bool Connect(const char* name, const char* server_name);
bool ConnectInput(const char* name, const char* server_name);
bool ConnectOutput(const char* name, const char* server_name);
bool Disconnect();
void Destroy();
};


+ 4
- 2
macosx/JackMachServerChannel.cpp View File

@@ -42,11 +42,13 @@ JackMachServerChannel::~JackMachServerChannel()
delete fThread;
}

int JackMachServerChannel::Open(JackServer* server)
int JackMachServerChannel::Open(const char* server_name, JackServer* server)
{
JackLog("JackMachServerChannel::Open\n");
char jack_server_entry_name[512];
snprintf(jack_server_entry_name, sizeof(jack_server_entry_name), "%s_%s", jack_server_entry, server_name);

if (!fServerPort.AllocatePort(jack_server_entry, 16)) { // 16 is the max possible value
if (!fServerPort.AllocatePort(jack_server_entry_name, 16)) { // 16 is the max possible value
jack_error("Cannot check in Jack server");
return -1;
}


+ 1
- 1
macosx/JackMachServerChannel.h View File

@@ -52,7 +52,7 @@ class JackMachServerChannel : public JackServerChannelInterface, public JackRunn
JackMachServerChannel();
virtual ~JackMachServerChannel();

int Open(JackServer* server); // Open the Server/Client connection
int Open(const char* server_name, JackServer* server); // Open the Server/Client connection
void Close(); // Close the Server/Client connection

JackEngine* GetEngine();


+ 4
- 2
macosx/JackMachServerNotifyChannel.cpp View File

@@ -24,11 +24,13 @@ This program is free software; you can redistribute it and/or modify
namespace Jack
{

int JackMachServerNotifyChannel::Open()
int JackMachServerNotifyChannel::Open(const char* server_name)
{
JackLog("JackMachServerChannel::Open\n");
char jack_server_entry_name[512];
snprintf(jack_server_entry_name, sizeof(jack_server_entry_name), "%s_%s", jack_server_entry, server_name);

if (!fClientPort.ConnectPort(jack_server_entry)) {
if (!fClientPort.ConnectPort(jack_server_entry_name)) {
jack_error("Cannot connect to server port");
return -1;
} else {


+ 1
- 1
macosx/JackMachServerNotifyChannel.h View File

@@ -44,7 +44,7 @@ class JackMachServerNotifyChannel : public JackServerNotifyChannelInterface
virtual ~JackMachServerNotifyChannel()
{}

int Open(); // Open the Server/Client connection
int Open(const char* server_name); // Open the Server/Client connection
void Close(); // Close the Server/Client connection

void ClientNotify(int refnum, int notify, int value);


+ 5
- 4
tests/jack_test.cpp View File

@@ -463,7 +463,8 @@ int main (int argc, char *argv[])
{
const char **inports; // array of PHY input/output
const char **outports; // array of PHY input/outputs
const char *server_name = NULL;
//const char *server_name = NULL;
const char *server_name = "titititi";
const char **connexions1;
const char **connexions2;
jack_status_t status;
@@ -479,10 +480,10 @@ int main (int argc, char *argv[])
int connected = 0; // check connect functions of ports
const char *options = "kRnqvt:";
float ratio; // for speed calculation in freewheel mode
jack_options_t jack_options = JackNullOption;
jack_options_t jack_options = JackNullOption;
//jack_options_t jack_options = JackServerName;
struct option long_options[] = {
{"realtime", 0, 0, 'R'
},
{"realtime", 0, 0, 'R'},
{"non-realtime", 0, 0, 'n'},
{"time", 0, 0, 't'},
{"quiet", 0, 0, 'q'},


+ 6
- 6
tests/testSem.cpp View File

@@ -42,8 +42,8 @@ struct ServerThread : public JackRunnableInterface {
ServerThread()
{
fServerSem->Allocate("JackSemServer", 0);
fClientSem->Allocate("JackSemClient", 0);
fServerSem->Allocate("JackSemServer", "default", 0);
fClientSem->Allocate("JackSemClient", "default", 0);
//fThread = new JackMachThread(this);
fThread->SetParams(0, 500*1000, 500*1000);
fThread->Start();
@@ -76,8 +76,8 @@ struct ClientThread : public JackRunnableInterface {
ClientThread()
{
fServerSem->Connect("JackSemServer");
fClientSem->Connect("JackSemClient");
fServerSem->Connect("JackSemServer", "default");
fClientSem->Connect("JackSemClient", "default");
//fThread = new JackMachThread(this);
fThread->SetParams(0, 500*1000, 500*1000);
fThread->Start();
@@ -114,7 +114,7 @@ void server(JackSynchro* sem)
char c;
printf("server\n");
sem->Allocate("JackSem", 0);
sem->Allocate("JackSem", "default", 0);
while (((c = getchar()) != 'q')) {
@@ -141,7 +141,7 @@ void client(JackSynchro* sem)
char c;
printf("client\n");
sem->Connect("JackSem");
sem->Connect("JackSem", "default");
while (((c = getchar()) != 'q')) {


+ 2
- 2
tests/testSynchroClient.cpp View File

@@ -129,8 +129,8 @@ int main(int ac, char *av [])
}
#endif

sem1->ConnectOutput(SERVER);
sem2->ConnectInput(CLIENT);
sem1->ConnectOutput(SERVER, "default");
sem2->ConnectInput(CLIENT, "default");

obj = new Test2(sem1, sem2);



+ 2
- 2
tests/testSynchroServer.cpp View File

@@ -185,8 +185,8 @@ int main(int ac, char *av [])
}
#endif

sem1->Allocate(SERVER, 0);
sem2->Allocate(CLIENT, 0);
sem1->Allocate(SERVER, "default", 0);
sem2->Allocate(CLIENT, "default", 0);

// run test in RT thread
obj = new Test1(sem1, sem2);


+ 4
- 4
tests/testSynchroServerClient.cpp View File

@@ -233,10 +233,10 @@ int main(int ac, char *av [])
}
#endif

sem1->Allocate(SERVER, 0);
sem2->Allocate(CLIENT, 0);
sem3->ConnectOutput(SERVER);
sem4->ConnectInput(CLIENT);
sem1->Allocate(SERVER, "default", 0);
sem2->Allocate(CLIENT, "default", 0);
sem3->ConnectOutput(SERVER, "default");
sem4->ConnectInput(CLIENT, "default");

// run test in RT thread
obj1 = new Test1(sem1, sem2);


+ 36
- 36
windows/JackWinNamedPipeClientChannel.cpp View File

@@ -49,7 +49,7 @@ int JackWinNamedPipeClientChannel::ServerCheck(const char* server_name)
}
}

int JackWinNamedPipeClientChannel::Open(const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
int JackWinNamedPipeClientChannel::Open(const char* server_name, const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
{
int result = 0;
JackLog("JackWinNamedPipeClientChannel::Open name = %s\n", name);
@@ -251,41 +251,41 @@ void JackWinNamedPipeClientChannel::SetTimebaseCallback(int refnum, int conditio
JackSetTimebaseCallbackRequest req(refnum, conditional);
JackResult res;
ServerSyncCall(&req, &res, result);
}
void JackWinNamedPipeClientChannel::GetInternalClientName(int refnum, int int_ref, char* name_res, int* result)
{
JackGetInternalClientNameRequest req(refnum, int_ref);
JackGetInternalClientNameResult res;
ServerSyncCall(&req, &res, result);
strcpy(name_res, res.fName);
}
void JackWinNamedPipeClientChannel::InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result)
{
JackInternalClientHandleRequest req(refnum, client_name);
JackInternalClientHandleResult res;
ServerSyncCall(&req, &res, result);
*int_ref = res.fIntRefNum;
*status = res.fStatus;
}
void JackWinNamedPipeClientChannel::InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result)
{
JackInternalClientLoadRequest req(refnum, client_name, so_name, objet_data, options);
JackInternalClientLoadResult res;
ServerSyncCall(&req, &res, result);
*int_ref = res.fIntRefNum;
*status = res.fStatus;
}
void JackWinNamedPipeClientChannel::InternalClientUnload(int refnum, int int_ref, int* status, int* result)
{
JackInternalClientUnloadRequest req(refnum, int_ref);
JackInternalClientUnloadResult res;
ServerSyncCall(&req, &res, result);
*status = res.fStatus;
}
}
void JackWinNamedPipeClientChannel::GetInternalClientName(int refnum, int int_ref, char* name_res, int* result)
{
JackGetInternalClientNameRequest req(refnum, int_ref);
JackGetInternalClientNameResult res;
ServerSyncCall(&req, &res, result);
strcpy(name_res, res.fName);
}
void JackWinNamedPipeClientChannel::InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result)
{
JackInternalClientHandleRequest req(refnum, client_name);
JackInternalClientHandleResult res;
ServerSyncCall(&req, &res, result);
*int_ref = res.fIntRefNum;
*status = res.fStatus;
}
void JackWinNamedPipeClientChannel::InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result)
{
JackInternalClientLoadRequest req(refnum, client_name, so_name, objet_data, options);
JackInternalClientLoadResult res;
ServerSyncCall(&req, &res, result);
*int_ref = res.fIntRefNum;
*status = res.fStatus;
}
void JackWinNamedPipeClientChannel::InternalClientUnload(int refnum, int int_ref, int* status, int* result)
{
JackInternalClientUnloadRequest req(refnum, int_ref);
JackInternalClientUnloadResult res;
ServerSyncCall(&req, &res, result);
*status = res.fStatus;
}

bool JackWinNamedPipeClientChannel::Init()
{


+ 7
- 7
windows/JackWinNamedPipeClientChannel.h View File

@@ -50,7 +50,7 @@ class JackWinNamedPipeClientChannel : public JackClientChannelInterface, public
JackWinNamedPipeClientChannel();
virtual ~JackWinNamedPipeClientChannel();

int Open(const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status);
int Open(const char* server_name, const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status);
void Close();

int Start();
@@ -78,12 +78,12 @@ class JackWinNamedPipeClientChannel : public JackClientChannelInterface, public
void SetFreewheel(int onoff, int* result);

void ReleaseTimebase(int refnum, int* result);
void SetTimebaseCallback(int refnum, int conditional, int* result);
void GetInternalClientName(int refnum, int int_ref, char* name_res, int* result);
void InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result);
virtual void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result);
virtual void InternalClientUnload(int refnum, int int_ref, int* status, int* result);
void SetTimebaseCallback(int refnum, int conditional, int* result);
void GetInternalClientName(int refnum, int int_ref, char* name_res, int* result);
void InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result);
virtual void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result);
virtual void InternalClientUnload(int refnum, int int_ref, int* status, int* result);
// JackRunnableInterface interface
bool Init();


+ 41
- 41
windows/JackWinNamedPipeServerChannel.cpp View File

@@ -54,7 +54,7 @@ JackClientPipeThread::~JackClientPipeThread()
delete fThread;
}

int JackClientPipeThread::Open(JackServer* server) // Open the Server/Client connection
int JackClientPipeThread::Open(const char* server_name, JackServer* server) // Open the Server/Client connection
{
fServer = server;

@@ -257,46 +257,46 @@ int JackClientPipeThread::HandleRequest()
res.fResult = fServer->GetEngine()->SetTimebaseCallback(req.fRefNum, req.fConditionnal);
res.Write(fPipe);
break;
}
case JackRequest::kGetInternalClientName: {
JackLog("JackRequest::kGetInternalClientName\n");
JackGetInternalClientNameRequest req;
JackGetInternalClientNameResult res;
if (req.Read(fPipe) == 0)
res.fResult = fServer->GetEngine()->GetInternalClientName(req.fIntRefNum, res.fName);
res.Write(fPipe);
break;
}
case JackRequest::kInternalClientHandle: {
JackLog("JackRequest::kInternalClientHandle\n");
JackInternalClientHandleRequest req;
JackInternalClientHandleResult res;
if (req.Read(fPipe) == 0)
res.fResult = fServer->GetEngine()->InternalClientHandle(req.fName, &res.fStatus, &res.fIntRefNum);
res.Write(fPipe);
break;
}
case JackRequest::kInternalClientLoad: {
JackLog("JackRequest::kInternalClientLoad\n");
JackInternalClientLoadRequest req;
JackInternalClientLoadResult res;
if (req.Read(fPipe) == 0)
res.fResult = fServer->InternalClientLoad(req.fName, req.fDllName, req.fLoadInitName, req.fOptions, &res.fIntRefNum, &res.fStatus);
res.Write(fPipe);
break;
}
case JackRequest::kInternalClientUnload: {
JackLog("JackRequest::kInternalClientUnload\n");
JackInternalClientUnloadRequest req;
JackInternalClientUnloadResult res;
if (req.Read(fPipe) == 0)
res.fResult = fServer->GetEngine()->InternalClientUnload(req.fIntRefNum, &res.fStatus);
res.Write(fPipe);
break;
}
case JackRequest::kGetInternalClientName: {
JackLog("JackRequest::kGetInternalClientName\n");
JackGetInternalClientNameRequest req;
JackGetInternalClientNameResult res;
if (req.Read(fPipe) == 0)
res.fResult = fServer->GetEngine()->GetInternalClientName(req.fIntRefNum, res.fName);
res.Write(fPipe);
break;
}
case JackRequest::kInternalClientHandle: {
JackLog("JackRequest::kInternalClientHandle\n");
JackInternalClientHandleRequest req;
JackInternalClientHandleResult res;
if (req.Read(fPipe) == 0)
res.fResult = fServer->GetEngine()->InternalClientHandle(req.fName, &res.fStatus, &res.fIntRefNum);
res.Write(fPipe);
break;
}
case JackRequest::kInternalClientLoad: {
JackLog("JackRequest::kInternalClientLoad\n");
JackInternalClientLoadRequest req;
JackInternalClientLoadResult res;
if (req.Read(fPipe) == 0)
res.fResult = fServer->InternalClientLoad(req.fName, req.fDllName, req.fLoadInitName, req.fOptions, &res.fIntRefNum, &res.fStatus);
res.Write(fPipe);
break;
}
case JackRequest::kInternalClientUnload: {
JackLog("JackRequest::kInternalClientUnload\n");
JackInternalClientUnloadRequest req;
JackInternalClientUnloadResult res;
if (req.Read(fPipe) == 0)
res.fResult = fServer->GetEngine()->InternalClientUnload(req.fIntRefNum, &res.fStatus);
res.Write(fPipe);
break;
}
case JackRequest::kNotification: {


+ 1
- 1
windows/JackWinNamedPipeServerChannel.h View File

@@ -50,7 +50,7 @@ class JackClientPipeThread : public JackRunnableInterface
JackClientPipeThread(JackWinNamedPipeClient* pipe);
virtual ~JackClientPipeThread();

int Open(JackServer* server); // Open the Server/Client connection
int Open(const char* server_name, JackServer* server); // Open the Server/Client connection
void Close(); // Close the Server/Client connection

int HandleRequest();


+ 1
- 1
windows/JackWinNamedPipeServerNotifyChannel.cpp View File

@@ -25,7 +25,7 @@ This program is free software; you can redistribute it and/or modify
namespace Jack
{

int JackWinNamedPipeServerNotifyChannel::Open()
int JackWinNamedPipeServerNotifyChannel::Open(const char* server_name)
{
if (fRequestPipe.Connect(jack_server_dir, 0) < 0) {
jack_error("Cannot connect to server pipe");


+ 1
- 1
windows/JackWinNamedPipeServerNotifyChannel.h View File

@@ -43,7 +43,7 @@ class JackWinNamedPipeServerNotifyChannel : public JackServerNotifyChannelInterf
virtual ~JackWinNamedPipeServerNotifyChannel()
{}

int Open();
int Open(const char* server_name);
void Close();

void ClientNotify(int refnum, int notify, int value);


Loading…
Cancel
Save