Browse Source

Compiles again on Windows.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4067 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.9.7
sletz 14 years ago
parent
commit
d4e51743a0
6 changed files with 69 additions and 65 deletions
  1. +10
    -9
      common/JackEngine.h
  2. +26
    -26
      tests/test.cpp
  3. +7
    -5
      windows/JackWinNamedPipeClientChannel.h
  4. +7
    -7
      windows/JackWinNamedPipeServerChannel.cpp
  5. +7
    -7
      windows/JackWinNamedPipeServerChannel.h
  6. +12
    -11
      windows/JackWinThread.h

+ 10
- 9
common/JackEngine.h View File

@@ -26,6 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackMutex.h"
#include "JackTransportEngine.h"
#include "JackPlatformPlug.h"
#include <map>

namespace Jack
{
@@ -41,7 +42,7 @@ class JackExternalClient;
class SERVER_EXPORT JackEngine : public JackLockAble
{
friend class JackLockedEngine;
private:

JackGraphManager* fGraphManager;
@@ -75,15 +76,15 @@ class SERVER_EXPORT JackEngine : public JackLockAble

void NotifyClient(int refnum, int event, int sync, const char* message, int value1, int value2);
void NotifyClients(int event, int sync, const char* message, int value1, int value2);
void NotifyPortRegistation(jack_port_id_t port_index, bool onoff);
void NotifyPortConnect(jack_port_id_t src, jack_port_id_t dst, bool onoff);
void NotifyPortRename(jack_port_id_t src, const char* old_name);
void NotifyActivate(int refnum);
int GetNewUUID();
void EnsureUUID(int uuid);
bool CheckClient(int refnum)
{
return (refnum >= 0 && refnum < CLIENT_NUM && fClientTable[refnum] != NULL);
@@ -96,7 +97,7 @@ class SERVER_EXPORT JackEngine : public JackLockAble

int Open();
int Close();
// Client management
int ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status);
int ClientExternalOpen(const char* name, int pid, int uuid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager);
@@ -107,10 +108,10 @@ class SERVER_EXPORT JackEngine : public JackLockAble

int ClientActivate(int refnum, bool is_real_time);
int ClientDeactivate(int refnum);
int GetClientPID(const char* name);
int GetClientRefNum(const char* name);
// Internal client management
int GetInternalClientName(int int_ref, char* name_res);
int InternalClientHandle(const char* client_name, int* status, int* int_ref);
@@ -125,7 +126,7 @@ class SERVER_EXPORT JackEngine : public JackLockAble

int PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst);
int PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst);
int PortRename(int refnum, jack_port_id_t port, const char* name);

// Graph
@@ -143,7 +144,7 @@ class SERVER_EXPORT JackEngine : public JackLockAble

void SessionNotify( int refnum, const char *target, jack_session_event_type_t type, const char *path, JackChannelTransaction *socket );
void SessionReply( int refnum );
void GetUUIDForClientName(const char *client_name, char *uuid_res, int *result);
void GetClientNameForUUID(const char *uuid, char *name_res, int *result);
void ReserveClientName(const char *name, const char *uuid, int *result);


+ 26
- 26
tests/test.cpp View File

@@ -169,7 +169,7 @@ void Jack_Thread_Init_Callback(void *arg)

void Jack_Freewheel_Callback(int starting, void *arg)
{
Log("Freewhell callback has been successfully called with value %i. (msg from callback)\n", starting);
Log("Freewheel callback has been successfully called with value %i. (msg from callback)\n", starting);
FW = starting;
}

@@ -633,39 +633,39 @@ int main (int argc, char *argv[])
if (status & JackServerStarted) {
fprintf(stderr, "JACK server started\n");
}
/**
* Internal client tests...
*
*/
jack_intclient_t intclient;
Log("trying to load the \"inprocess\" server internal client \n");
intclient = jack_internal_client_load (client1, "inprocess",
(jack_options_t)(JackLoadName|JackLoadInit),
&status, "inprocess", "");
if (intclient == 0 || status & JackFailure) {
printf("!!! ERROR !!! cannot load internal client \"inprocess\" intclient %d status 0x%2.0x !\n", intclient, status);
} else {
Log("\"inprocess\" server internal client loaded\n");
char* internal_name = jack_get_internal_client_name(client1, intclient);
if (strcmp(internal_name, "inprocess") == 0) {
Log("jack_get_internal_client_name returns %s\n", internal_name);
} else {
printf("!!! ERROR !!! jack_get_internal_client_name returns incorrect name %s\n", internal_name);
}
jack_intclient_t intclient1 = jack_internal_client_handle(client1, "inprocess", &status);
if (intclient1 == intclient) {
Log("jack_internal_client_handle returns correct handle\n");
} else {
printf("!!! ERROR !!! jack_internal_client_handle returns incorrect handle %d\n", intclient1);
}
// Unload internal client
status = jack_internal_client_unload (client1, intclient);
if (status == 0) {
@@ -673,7 +673,7 @@ int main (int argc, char *argv[])
} else {
printf("!!! ERROR !!! jack_internal_client_unload returns incorrect value 0x%2.0x\n", status);
}
// Unload internal client second time
status = jack_internal_client_unload (client1, intclient);
if (status & JackFailure && status & JackNoSuchClient) {
@@ -682,8 +682,8 @@ int main (int argc, char *argv[])
printf("!!! ERROR !!! jack_internal_client_unload returns incorrect value 0x%2.0x\n", status);
}
}
/**
* try to register another one with the same name...
*
@@ -738,7 +738,7 @@ int main (int argc, char *argv[])
printf("!!! ERROR !!! while calling jack_set_thread_init_callback()...\n");
if (jack_set_freewheel_callback(client1, Jack_Freewheel_Callback, 0) != 0 )
printf("\n!!! ERROR !!! while calling jack_set_freewheel_callback()...\n");

if (jack_set_process_callback(client1, process1, 0) != 0) {
printf("Error when calling jack_set_process_callback() !\n");
@@ -754,7 +754,7 @@ int main (int argc, char *argv[])
if (jack_set_graph_order_callback(client1, Jack_Graph_Order_Callback, 0) != 0) {
printf("Error when calling Jack_Graph_Order_Callback() !\n");
}
if (jack_set_port_rename_callback(client1, Jack_Port_Rename_Callback, 0) != 0 )
printf("\n!!! ERROR !!! while calling jack_set_rename_callback()...\n");

@@ -874,7 +874,7 @@ int main (int argc, char *argv[])
}

port_callback_reg = 0; // number of port registration received by the callback
/**
* Activate the client
*
@@ -883,31 +883,31 @@ int main (int argc, char *argv[])
printf ("Fatal error : cannot activate client1\n");
exit(1);
}
/**
* Test if portrename callback have been called.
*
*/
jack_port_set_name (output_port1, "renamed-port#");
jack_sleep(1 * 1000);
jack_sleep(1 * 1000);

if (port_rename_clbk == 0)
printf("!!! ERROR !!! Jack_Port_Rename_Callback was not called !!.\n");
/**
* Test if portregistration callback have been called.
*
*/
jack_sleep(1 * 1000);
jack_sleep(1 * 1000);

if (1 == port_callback_reg) {
Log("%i ports have been successfully created, and %i callback reg ports have been received... ok\n", 1, port_callback_reg);
} else {
printf("!!! ERROR !!! %i ports have been created, and %i callback reg ports have been received !\n", 1, port_callback_reg);
}
/**
* Test if init callback initThread have been called.
*
@@ -1162,14 +1162,14 @@ int main (int argc, char *argv[])
}

jack_sleep(1 * 1000); // To hope all port registration and reorder callback have been received...
// Check port registration callback
if (j == port_callback_reg) {
Log("%i ports have been successfully created, and %i callback reg ports have been received... ok\n", j, port_callback_reg);
} else {
printf("!!! ERROR !!! %i ports have been created, and %i callback reg ports have been received !\n", j, port_callback_reg);
}
if (reorder == (2 * j)) {
Log("%i graph reorder callback have been received... ok\n", reorder);
} else {
@@ -1231,9 +1231,9 @@ int main (int argc, char *argv[])
}
a++;
}
// Check port registration callback again
if (j == port_callback_reg) {
if (j == port_callback_reg) {
Log("%i ports have been successfully created, and %i callback reg ports have been received... ok\n", j, port_callback_reg);
} else {
printf("!!! ERROR !!! %i ports have been created, and %i callback reg ports have been received !\n", j, port_callback_reg);


+ 7
- 5
windows/JackWinNamedPipeClientChannel.h View File

@@ -1,20 +1,20 @@
/*
Copyright (C) 2004-2008 Grame
This program is free software; you can redistribute it and/or modify
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
(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
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/


@@ -76,7 +76,7 @@ class JackWinNamedPipeClientChannel : public detail::JackClientChannelInterface,

void PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result);
void PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result);
void PortRename(int refnum, jack_port_id_t port, const char* name, int* result);

void SetBufferSize(jack_nframes_t buffer_size, int* result);
@@ -90,6 +90,8 @@ class JackWinNamedPipeClientChannel : public detail::JackClientChannelInterface,
void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int uuid, int* result);
void InternalClientUnload(int refnum, int int_ref, int* status, int* result);

void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char* path, jack_session_command_t** result);

// JackRunnableInterface interface
bool Init();
bool Execute();


+ 7
- 7
windows/JackWinNamedPipeServerChannel.cpp View File

@@ -331,12 +331,12 @@ bool JackClientPipeThread::HandleRequest()
JackSessionNotifyRequest req;
JackSessionNotifyResult res;
if (req.Read(fPipe) == 0) {
fServer->GetEngine()->SessionNotify(req.fRefNum, req.fDst, req.fEventType, req.fPath);
fServer->GetEngine()->SessionNotify(req.fRefNum, req.fDst, req.fEventType, req.fPath, fPipe);
}
res.Write(fPipe);
break;
}
case JackRequest::kSessionReply: {
jack_log("JackRequest::SessionReply");
JackSessionReplyRequest req;
@@ -347,7 +347,7 @@ bool JackClientPipeThread::HandleRequest()
}
break;
}
case JackRequest::kGetClientByUUID: {
jack_log("JackRequest::GetClientNameForUUID");
JackGetClientNameRequest req;
@@ -358,7 +358,7 @@ bool JackClientPipeThread::HandleRequest()
res.Write(fPipe);
break;
}
case JackRequest::kGetUUIDByClient: {
jack_log("JackRequest::GetUUIDForClientName");
JackGetUUIDRequest req;
@@ -370,7 +370,7 @@ bool JackClientPipeThread::HandleRequest()
res.Write(fPipe);
break;
}
case JackRequest::kReserveClientName: {
jack_log("JackRequest::ReserveClientName");
JackReserveNameRequest req;
@@ -394,11 +394,11 @@ bool JackClientPipeThread::HandleRequest()
return ret;
}

void JackClientPipeThread::ClientAdd(char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
void JackClientPipeThread::ClientAdd(char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
{
jack_log("JackClientPipeThread::ClientAdd %s", name);
fRefNum = -1;
*result = fServer->GetEngine()->ClientExternalOpen(name, pid, &fRefNum, shared_engine, shared_client, shared_graph);
*result = fServer->GetEngine()->ClientExternalOpen(name, pid, uuid, &fRefNum, shared_engine, shared_client, shared_graph);
}

void JackClientPipeThread::ClientRemove()


+ 7
- 7
windows/JackWinNamedPipeServerChannel.h View File

@@ -1,20 +1,20 @@
/*
Copyright (C) 2004-2008 Grame
This program is free software; you can redistribute it and/or modify
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
(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
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/


@@ -40,7 +40,7 @@ class JackClientPipeThread : public JackRunnableInterface
JackThread fThread;
int fRefNum;

void ClientAdd(char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
void ClientAdd(char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
void ClientRemove();
void ClientKill();

@@ -53,7 +53,7 @@ class JackClientPipeThread : public JackRunnableInterface

int Open(JackServer* server); // Open the Server/Client connection
void Close(); // Close the Server/Client connection
bool HandleRequest();

// JackRunnableInterface interface
@@ -91,7 +91,7 @@ class JackWinNamedPipeServerChannel : public JackRunnableInterface

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

// JackRunnableInterface interface


+ 12
- 11
windows/JackWinThread.h View File

@@ -1,20 +1,20 @@
/*
Copyright (C) 2004-2008 Grame
This program is free software; you can redistribute it and/or modify
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
(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
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/


@@ -59,24 +59,25 @@ class SERVER_EXPORT JackWinThread : public detail::JackThreadInterface

int AcquireRealTime(); // Used when called from another thread
int AcquireSelfRealTime(); // Used when called from thread itself
int AcquireRealTime(int priority); // Used when called from another thread
int AcquireSelfRealTime(int priority); // Used when called from thread itself
int DropRealTime(); // Used when called from another thread
int DropSelfRealTime(); // Used when called from thread itself
pthread_t GetThreadID();
bool IsThread();

static int AcquireRealTimeImp(pthread_t thread, int priority);
static int AcquireRealTimeImp(pthread_t thread, int priority, UInt64 period, UInt64 computation, UInt64 constraint)
{
return JackWinThread::AcquireRealTimeImp(thread, priority);
{
return JackWinThread::AcquireRealTimeImp(thread, priority);
}
static int DropRealTimeImp(pthread_t thread);
static int StartImp(pthread_t* thread, int priority, int realtime, void*(*start_routine)(void*), void* arg)
{
return JackWinThread::StartImp(thread, priority, realtime, (ThreadCallback) start_routine, arg);
{
return JackWinThread::StartImp(thread, priority, realtime, (ThreadCallback) start_routine, arg);
}
static int StartImp(pthread_t* thread, int priority, int realtime, ThreadCallback start_routine, void* arg);
static int StopImp(pthread_t thread);


Loading…
Cancel
Save