Browse Source

Compiles on Windows again.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3465 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/v1.9.3
sletz 16 years ago
parent
commit
3c19d53f14
6 changed files with 157 additions and 143 deletions
  1. +21
    -21
      common/JackEngine.cpp
  2. +62
    -63
      common/shm.c
  3. +6
    -6
      posix/JackCompilerDeps_os.h
  4. +48
    -48
      tests/test.cpp
  5. +18
    -3
      windows/JackCompilerDeps_os.h
  6. +2
    -2
      windows/Setup/jack.ci

+ 21
- 21
common/JackEngine.cpp View File

@@ -69,7 +69,7 @@ int JackEngine::Close()
{
jack_log("JackEngine::Close");
fChannel.Close();
// Close remaining clients (RT is stopped)
for (int i = REAL_REFNUM; i < CLIENT_NUM; i++) {
if (JackLoadableInternalClient* loadable_client = dynamic_cast<JackLoadableInternalClient*>(fClientTable[i])) {
@@ -85,10 +85,10 @@ int JackEngine::Close()
fClientTable[i] = NULL;
}
}
return 0;
}
//-----------------------------
// Client ressource management
//-----------------------------
@@ -147,7 +147,7 @@ void JackEngine::ProcessCurrent(jack_time_t cur_cycle_begin)
bool JackEngine::Process(jack_time_t cur_cycle_begin, jack_time_t prev_cycle_end)
{
bool res = true;
// Cycle begin
fEngineControl->CycleBegin(fClientTable, fGraphManager, cur_cycle_begin, prev_cycle_end);

@@ -213,7 +213,7 @@ void JackEngine::NotifyClient(int refnum, int event, int sync, int value1, int v
jack_log("JackEngine::NotifyClient: client not available anymore");
} else if (client->GetClientControl()->fCallback[event]) {
if (client->ClientNotify(refnum, client->GetClientControl()->fName, event, sync, value1, value2) < 0)
jack_error("NotifyClient fails name = %s event = %ld = val1 = %ld val2 = %ld", client->GetClientControl()->fName, event, value1, value2);
jack_error("NotifyClient fails name = %s event = %ld val1 = %ld val2 = %ld", client->GetClientControl()->fName, event, value1, value2);
} else {
jack_log("JackEngine::NotifyClient: no callback for event = %ld", event);
}
@@ -226,7 +226,7 @@ void JackEngine::NotifyClients(int event, int sync, int value1, int value2)
if (client) {
if (client->GetClientControl()->fCallback[event]) {
if (client->ClientNotify(i, client->GetClientControl()->fName, event, sync, value1, value2) < 0)
jack_error("NotifyClient fails name = %s event = %ld = val1 = %ld val2 = %ld", client->GetClientControl()->fName, event, value1, value2);
jack_error("NotifyClient fails name = %s event = %ld val1 = %ld val2 = %ld", client->GetClientControl()->fName, event, value1, value2);
} else {
jack_log("JackEngine::NotifyClients: no callback for event = %ld", event);
}
@@ -461,7 +461,7 @@ int JackEngine::GetClientPID(const char* name)
if (client && (strcmp(client->GetClientControl()->fName, name) == 0))
return client->GetClientControl()->fPID;
}
return 0;
}

@@ -472,7 +472,7 @@ int JackEngine::GetClientRefNum(const char* name)
if (client && (strcmp(client->GetClientControl()->fName, name) == 0))
return client->GetClientControl()->fRefNum;
}
return -1;
}

@@ -511,7 +511,7 @@ int JackEngine::ClientExternalOpen(const char* name, int pid, int* ref, int* sha
jack_error("Cannot notify add client");
goto error;
}
fGraphManager->InitRefNum(refnum);
fEngineControl->ResetRollingUsecs();
*shared_engine = fEngineControl->GetShmIndex();
@@ -576,7 +576,7 @@ int JackEngine::ClientExternalClose(int refnum)
{
AssertRefnum(refnum);
JackClientInterface* client = fClientTable[refnum];
if (client) {
fEngineControl->fTransport.ResetTimebase(refnum);
int res = ClientCloseAux(refnum, client, true);
@@ -613,7 +613,7 @@ int JackEngine::ClientCloseAux(int refnum, JackClientInterface* client, bool wai
for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) {
PortUnRegister(refnum, ports[i]);
}
// Remove the client from the table
ReleaseRefnum(refnum);

@@ -641,11 +641,11 @@ int JackEngine::ClientActivate(int refnum, bool state)
AssertRefnum(refnum);
JackClientInterface* client = fClientTable[refnum];
assert(fClientTable[refnum]);
jack_log("JackEngine::ClientActivate ref = %ld name = %s", refnum, client->GetClientControl()->fName);
if (state)
if (state)
fGraphManager->Activate(refnum);
// Wait for graph state change to be effective
if (!fSignal.LockedTimedWait(fEngineControl->fTimeOutUsecs * 10)) {
jack_error("JackEngine::ClientActivate wait error ref = %ld name = %s", refnum, client->GetClientControl()->fName);
@@ -665,11 +665,11 @@ int JackEngine::ClientDeactivate(int refnum)
return -1;

jack_log("JackEngine::ClientDeactivate ref = %ld name = %s", refnum, client->GetClientControl()->fName);
// Disconnect all ports ==> notifications are sent
jack_int_t ports[PORT_NUM_FOR_CLIENT];
int i;
fGraphManager->GetInputPorts(refnum, ports);
for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) {
PortDisconnect(refnum, ports[i], ALL_PORTS);
@@ -679,7 +679,7 @@ int JackEngine::ClientDeactivate(int refnum)
for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) {
PortDisconnect(refnum, ports[i], ALL_PORTS);
}
fGraphManager->Deactivate(refnum);
fLastSwitchUsecs = 0; // Force switch to occur next cycle, even when called with "dead" clients

@@ -701,11 +701,11 @@ int JackEngine::PortRegister(int refnum, const char* name, const char *type, uns
jack_log("JackEngine::PortRegister ref = %ld name = %s type = %s flags = %d buffer_size = %d", refnum, name, type, flags, buffer_size);
AssertRefnum(refnum);
assert(fClientTable[refnum]);
// Check if port name already exists
if (fGraphManager->GetPort(name) != NO_PORT) {
jack_error("port_name \"%s\" already exists", name);
return -1;
return -1;
}

*port_index = fGraphManager->AllocatePort(refnum, name, type, (JackPortFlags)flags, fEngineControl->fBufferSize);
@@ -722,7 +722,7 @@ int JackEngine::PortUnRegister(int refnum, jack_port_id_t port_index)
jack_log("JackEngine::PortUnRegister ref = %ld port_index = %ld", refnum, port_index);
AssertRefnum(refnum);
assert(fClientTable[refnum]);
// Disconnect port ==> notification is sent
PortDisconnect(refnum, port_index, ALL_PORTS);

@@ -775,7 +775,7 @@ int JackEngine::PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
}

int res = fGraphManager->Connect(src, dst);
if (res == 0)
if (res == 0)
NotifyPortConnect(src, dst, true);
return res;
}


+ 62
- 63
common/shm.c View File

@@ -1,20 +1,8 @@
/* This module provides a set of abstract shared memory interfaces
* with support using both System V and POSIX shared memory
* implementations. The code is divided into three sections:
*
* - common (interface-independent) code
* - POSIX implementation
* - System V implementation
*
* The implementation used is determined by whether USE_POSIX_SHM was
* set in the ./configure step.
*/

/*
* Copyright (C) 2003 Paul Davis
* Copyright (C) 2004 Jack O'Quin
* Copyright (C) 2006-2007 Grame
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -30,11 +18,24 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/* This module provides a set of abstract shared memory interfaces
* with support using both System V and POSIX shared memory
* implementations. The code is divided into three sections:
*
* - common (interface-independent) code
* - POSIX implementation
* - System V implementation
*
* The implementation used is determined by whether USE_POSIX_SHM was
* set in the ./configure step.
*/

#include "JackConstants.h"

#ifdef WIN32
#include <process.h>
#include <process.h>
#include <stdio.h>
#else

#include <unistd.h>
@@ -57,7 +58,7 @@
#include "shm.h"
#include "JackError.h"

static int GetUID()
static int GetUID()
{
#ifdef WIN32
return _getpid();
@@ -67,7 +68,7 @@ static int GetUID()
#endif
}

static int GetPID()
static int GetPID()
{
#ifdef WIN32
return _getpid();
@@ -105,9 +106,9 @@ static jack_shm_id_t registry_id; /* SHM id for the registry */

#ifdef WIN32
static jack_shm_info_t registry_info = {/* SHM info for the registry */
JACK_SHM_NULL_INDEX,
JACK_SHM_NULL_INDEX,
NULL
};
};
#else
static jack_shm_info_t registry_info = { /* SHM info for the registry */
.index = JACK_SHM_NULL_INDEX,
@@ -142,7 +143,7 @@ static char jack_shm_server_prefix[JACK_SERVER_NAME_SIZE] = "";

static int semid = -1;

#ifdef WIN32
#ifdef WIN32

static void
semaphore_init () {}
@@ -167,7 +168,7 @@ semaphore_init ()
struct sembuf sbuf;
int create_flags = IPC_CREAT | IPC_EXCL
| S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
/* Get semaphore ID associated with this key. */
if ((semid = semget(semkey, 0, 0)) == -1) {

@@ -188,7 +189,7 @@ semaphore_init ()
}

} else {
semaphore_error ("semget creation");
semaphore_error ("semget creation");
}
}
}
@@ -208,7 +209,7 @@ semaphore_add (int value)

#endif

static void
static void
jack_shm_lock_registry (void)
{
if (semid == -1)
@@ -217,7 +218,7 @@ jack_shm_lock_registry (void)
semaphore_add (-1);
}

static void
static void
jack_shm_unlock_registry (void)
{
semaphore_add (1);
@@ -232,7 +233,7 @@ jack_shm_init_registry ()
memset (jack_shm_header, 0, JACK_SHM_REGISTRY_SIZE);

jack_shm_header->magic = JACK_SHM_MAGIC;
//jack_shm_header->protocol = JACK_PROTOCOL_VERSION;
//jack_shm_header->protocol = JACK_PROTOCOL_VERSION;
jack_shm_header->type = jack_shmtype;
jack_shm_header->size = JACK_SHM_REGISTRY_SIZE;
jack_shm_header->hdr_len = sizeof (jack_shm_header_t);
@@ -249,7 +250,7 @@ jack_shm_validate_registry ()
/* registry must be locked */

if ((jack_shm_header->magic == JACK_SHM_MAGIC)
//&& (jack_shm_header->protocol == JACK_PROTOCOL_VERSION)
//&& (jack_shm_header->protocol == JACK_PROTOCOL_VERSION)
&& (jack_shm_header->type == jack_shmtype)
&& (jack_shm_header->size == JACK_SHM_REGISTRY_SIZE)
&& (jack_shm_header->hdr_len == sizeof (jack_shm_header_t))
@@ -281,7 +282,7 @@ static void
jack_set_server_prefix (const char *server_name)
{
snprintf (jack_shm_server_prefix, sizeof (jack_shm_server_prefix),
"jack-%d:%s:", GetUID(), server_name);
"jack-%d:%s:", GetUID(), server_name);
}

/* gain server addressability to shared memory registration segment
@@ -299,7 +300,7 @@ jack_server_initialize_shm (int new_registry)
jack_shm_lock_registry ();

rc = jack_access_registry (&registry_info);
if (new_registry) {
jack_remove_shm (&registry_id);
rc = ENOENT;
@@ -365,9 +366,9 @@ jack_initialize_shm (const char *server_name)
}


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

void
@@ -393,7 +394,7 @@ jack_get_free_shm_info ()
break;
}
}
if (i < MAX_SHM_ID) {
si = &jack_shm_registry[i];
}
@@ -422,7 +423,7 @@ jack_release_shm_info (jack_shm_registry_index_t index)
}
}

/* Claim server_name for this process.
/* Claim server_name for this process.
*
* returns 0 if successful
* EEXIST if server_name was already active for this user
@@ -485,7 +486,7 @@ jack_register_server (const char *server_name, int new_registry)
strncpy (jack_shm_header->server[i].name,
jack_shm_server_prefix,
JACK_SERVER_NAME_SIZE);
unlock:
jack_shm_unlock_registry ();
return 0;
@@ -517,10 +518,10 @@ jack_cleanup_shm ()
jack_shm_info_t copy;

jack_shm_lock_registry ();
for (i = 0; i < MAX_SHM_ID; i++) {
jack_shm_registry_t* r;
r = &jack_shm_registry[i];
memcpy (&copy, r, sizeof (jack_shm_info_t));
destroy = FALSE;
@@ -532,7 +533,7 @@ jack_cleanup_shm ()
/* is this my shm segment? */
if (r->allocator == GetPID()) {

/* allocated by this process, so unattach
/* allocated by this process, so unattach
and destroy. */
jack_release_shm (&copy);
destroy = TRUE;
@@ -651,7 +652,7 @@ jack_access_registry (jack_shm_info_t *ri)
ri->index = JACK_SHM_REGISTRY_INDEX;
jack_shm_header = ri->ptr.attached_at;
jack_shm_registry = (jack_shm_registry_t *) (jack_shm_header + 1);
close (shm_fd); // steph
return 0;
}
@@ -668,7 +669,7 @@ jack_create_registry (jack_shm_info_t *ri)
{
/* registry must be locked */
int shm_fd;
strncpy (registry_id, "/jack-shm-registry", sizeof (registry_id));

if ((shm_fd = shm_open (registry_id, O_RDWR|O_CREAT, 0666)) < 0) {
@@ -677,10 +678,10 @@ jack_create_registry (jack_shm_info_t *ri)
strerror (errno));
return rc;
}
/* Previous shm_open result depends of the actual value of umask, force correct file permisssion here */
if (fchmod(shm_fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) < 0) {
jack_log("Cannot chmod jack-shm-registry (%s) %d %d", strerror (errno));
jack_log("Cannot chmod jack-shm-registry (%s) %d %d", strerror (errno));
}

/* Set the desired segment size. NOTE: the non-conformant Mac
@@ -804,7 +805,7 @@ jack_attach_shm (jack_shm_info_t* si)

if ((si->ptr.attached_at = mmap (0, registry->size, PROT_READ|PROT_WRITE,
MAP_SHARED, shm_fd, 0)) == MAP_FAILED) {
jack_error ("Cannot mmap shm segment %s (%s)",
jack_error ("Cannot mmap shm segment %s (%s)",
registry->id,
strerror (errno));
close (shm_fd);
@@ -830,7 +831,7 @@ jack_attach_shm_read (jack_shm_info_t* si)

if ((si->ptr.attached_at = mmap (0, registry->size, PROT_READ,
MAP_SHARED, shm_fd, 0)) == MAP_FAILED) {
jack_error ("Cannot mmap shm segment %s (%s)",
jack_error ("Cannot mmap shm segment %s (%s)",
registry->id,
strerror (errno));
close (shm_fd);
@@ -848,12 +849,10 @@ jack_access_registry (jack_shm_info_t *ri)
{
/* registry must be locked */
HANDLE shm_fd;
LPSECURITY_ATTRIBUTES sec = 0;

strncpy (registry_id, "jack-shm-registry", sizeof (registry_id));

/* try to open an existing segment */
if ((shm_fd = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, registry_id)) == NULL) {
int rc = GetLastError();
if (rc != ERROR_FILE_NOT_FOUND) {
@@ -862,7 +861,7 @@ jack_access_registry (jack_shm_info_t *ri)
return rc;
}

if ((ri->attached_at = MapViewOfFile (shm_fd, FILE_MAP_ALL_ACCESS, 0, 0, JACK_SHM_REGISTRY_SIZE)) == NULL) {
if ((ri->ptr.attached_at = MapViewOfFile (shm_fd, FILE_MAP_ALL_ACCESS, 0, 0, JACK_SHM_REGISTRY_SIZE)) == NULL) {
jack_error ("Cannot mmap shm registry segment (%ld)", GetLastError());
jack_remove_shm (&registry_id);
CloseHandle (shm_fd);
@@ -871,7 +870,7 @@ jack_access_registry (jack_shm_info_t *ri)

/* set up global pointers */
ri->index = JACK_SHM_REGISTRY_INDEX;
jack_shm_header = ri->attached_at;
jack_shm_header = ri->ptr.attached_at;
jack_shm_registry = (jack_shm_registry_t *) (jack_shm_header + 1);

//CloseHandle(shm_fd); // TO CHECK
@@ -886,16 +885,16 @@ jack_create_registry (jack_shm_info_t *ri)

strncpy (registry_id, "jack-shm-registry", sizeof (registry_id));

if ((shm_fd = CreateFileMapping(INVALID_HANDLE_VALUE,
0, PAGE_READWRITE,
0, JACK_SHM_REGISTRY_SIZE,
if ((shm_fd = CreateFileMapping(INVALID_HANDLE_VALUE,
0, PAGE_READWRITE,
0, JACK_SHM_REGISTRY_SIZE,
registry_id)) == NULL || (shm_fd == INVALID_HANDLE_VALUE)) {
int rc = GetLastError();
jack_error ("Cannot create shm registry segment (%ld)", rc);
return rc;
}

if ((ri->attached_at = MapViewOfFile (shm_fd, FILE_MAP_ALL_ACCESS, 0, 0, JACK_SHM_REGISTRY_SIZE)) == NULL) {
if ((ri->ptr.attached_at = MapViewOfFile (shm_fd, FILE_MAP_ALL_ACCESS, 0, 0, JACK_SHM_REGISTRY_SIZE)) == NULL) {
jack_error ("Cannot mmap shm registry segment (%ld)", GetLastError());
jack_remove_shm (&registry_id);
CloseHandle (shm_fd);
@@ -904,7 +903,7 @@ jack_create_registry (jack_shm_info_t *ri)

/* set up global pointers */
ri->index = JACK_SHM_REGISTRY_INDEX;
jack_shm_header = ri->attached_at;
jack_shm_header = ri->ptr.attached_at;
jack_shm_registry = (jack_shm_registry_t *) (jack_shm_header + 1);

/* initialize registry contents */
@@ -924,8 +923,8 @@ void
jack_release_shm (jack_shm_info_t* si)
{
/* registry may or may not be locked */
if (si->attached_at != NULL) {
UnmapViewOfFile (si->attached_at);
if (si->ptr.attached_at != NULL) {
UnmapViewOfFile (si->ptr.attached_at);
}
}

@@ -951,9 +950,9 @@ jack_shmalloc (const char *shm_name, jack_shmsize_t size, jack_shm_info_t* si)
goto unlock;
}

if ((shm_fd = CreateFileMapping(INVALID_HANDLE_VALUE,
0, PAGE_READWRITE,
0, size,
if ((shm_fd = CreateFileMapping(INVALID_HANDLE_VALUE,
0, PAGE_READWRITE,
0, size,
name)) == NULL || (shm_fd == INVALID_HANDLE_VALUE)) {
int rc = GetLastError();
jack_error ("Cannot create shm segment (%ld)",rc);
@@ -966,7 +965,7 @@ jack_shmalloc (const char *shm_name, jack_shmsize_t size, jack_shm_info_t* si)
strncpy (registry->id, name, sizeof (registry->id));
registry->allocator = _getpid();
si->index = registry->index;
si->attached_at = NULL; /* not attached */
si->ptr.attached_at = NULL; /* not attached */
rc = 0; /* success */

unlock:
@@ -986,7 +985,7 @@ jack_attach_shm (jack_shm_info_t* si)
return -1;
}

if ((si->attached_at = MapViewOfFile (shm_fd, FILE_MAP_ALL_ACCESS, 0, 0, registry->size)) == NULL) {
if ((si->ptr.attached_at = MapViewOfFile (shm_fd, FILE_MAP_ALL_ACCESS, 0, 0, registry->size)) == NULL) {
jack_error ("Cannot mmap shm segment (%ld)", GetLastError());
jack_remove_shm (&registry_id);
CloseHandle (shm_fd);
@@ -1009,10 +1008,10 @@ jack_attach_shm_read (jack_shm_info_t* si)
return -1;
}

if ((si->attached_at = MapViewOfFile (shm_fd, FILE_MAP_READ, 0, 0, registry->size)) == NULL) {
jack_error ("Cannot mmap shm segment (%ld)", GetLastError());
jack_remove_shm (&registry_id);
CloseHandle (shm_fd);
if ((si->ptr.attached_at = MapViewOfFile (shm_fd, FILE_MAP_READ, 0, 0, registry->size)) == NULL) {
jack_error("Cannot mmap shm segment (%ld)", GetLastError());
jack_remove_shm(&registry_id);
CloseHandle(shm_fd);
return -1;
}

@@ -1127,7 +1126,7 @@ jack_release_shm (jack_shm_info_t* si)

int
jack_shmalloc (const char* name_not_used, jack_shmsize_t size,
jack_shm_info_t* si)
jack_shm_info_t* si)
{
int shmflags;
int shmid;


+ 6
- 6
posix/JackCompilerDeps_os.h View File

@@ -27,11 +27,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
/* POST_PACKED_STRUCTURE needs to be a macro which
expands into a compiler directive. The directive must
tell the compiler to arrange the preceding structure
declaration so that it is packed on byte-boundaries rather
declaration so that it is packed on byte-boundaries rather
than use the natural alignment of the processor and/or
compiler.
*/
#if (__GNUC__< 4) /* On Solaris, does not seem to work with GCC 3.XX serie */
#if (__GNUC__< 4) /* Does not seem to work with GCC 3.XX serie */
#define POST_PACKED_STRUCTURE
#elif defined(JACK_32_64)
#define POST_PACKED_STRUCTURE __attribute__((__packed__))
@@ -43,19 +43,19 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define EXPORT __attribute__((visibility("default")))
#ifdef SERVER_SIDE
#if (__GNUC__< 4)
#define SERVER_EXPORT
#define SERVER_EXPORT
#else
#define SERVER_EXPORT __attribute__((visibility("default")))
#endif
#endif
#else
#define SERVER_EXPORT
#endif
#else
#else
#define MEM_ALIGN(x,y) x
#define EXPORT
#define SERVER_EXPORT
/* Add other things here for non-gcc platforms for POST_PACKED_STRUCTURE */
#endif
#endif


+ 48
- 48
tests/test.cpp View File

@@ -1,6 +1,6 @@
/*
Copyright (C) 2005 Samuel TRACOL for GRAME
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -20,7 +20,7 @@
/** @file jack_test.c
*
* @brief This client test the jack API.
*
*
*/

#include <stdio.h>
@@ -38,7 +38,7 @@
#include <jack/transport.h>


#ifdef WIN32
#if defined(WIN32) && !defined(M_PI)
#define M_PI 3.151592653
#endif

@@ -122,9 +122,9 @@ int client_register = 0;
/**
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Callbacks & basics functions
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*/
@@ -266,9 +266,9 @@ int Jack_Sync_Callback(jack_transport_state_t state, jack_position_t *pos, void
/**
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
processing functions
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
* Proccess1 is for client1
@@ -370,7 +370,7 @@ int process2(jack_nframes_t nframes, void *arg)
}
}
}
if (process2_activated == 2) { // envoie de signal1 pour test tie mode et le r�cup�re direct + latence de la boucle jack...
out2 = (jack_default_audio_sample_t *) jack_port_get_buffer (output_port2, nframes);
in2 = (jack_default_audio_sample_t *) jack_port_get_buffer (input_port2, nframes);
@@ -389,7 +389,7 @@ int process2(jack_nframes_t nframes, void *arg)
}
}
}
if (process2_activated == 3) { // envoie de -signal1 pour sommation en oppo de phase par jack
in2 = (jack_default_audio_sample_t *) jack_port_get_buffer (input_port2, nframes);

@@ -416,14 +416,14 @@ static int _process (jack_nframes_t nframes)
out = (jack_default_audio_sample_t *)jack_port_get_buffer (output_port1, nframes);
memcpy (out, in,
sizeof (jack_default_audio_sample_t) * nframes);
return 0;
return 0;
}

static void* jack_thread(void *arg)
static void* jack_thread(void *arg)
{
jack_client_t* client = (jack_client_t*) arg;
jack_nframes_t last_thread_time = jack_frame_time(client);
while (1) {
jack_nframes_t frames = jack_cycle_wait (client);
jack_nframes_t current_thread_time = jack_frame_time(client);
@@ -433,7 +433,7 @@ static void* jack_thread(void *arg)
last_thread_time = current_thread_time;
jack_cycle_signal (client, status);
}
return 0;
}

@@ -441,7 +441,7 @@ static void* jack_thread(void *arg)
int process3(jack_nframes_t nframes, void *arg)
{
static int process3_call = 0;
if (process3_call++ > 10) {
Log("process3 callback : exiting...\n");
return -1;
@@ -457,15 +457,15 @@ int process4(jack_nframes_t nframes, void *arg)

static jack_nframes_t last_time = jack_frame_time(client);
static jack_nframes_t tolerance = (jack_nframes_t)(cur_buffer_size * 0.1f);
jack_nframes_t cur_time = jack_frame_time(client);
jack_nframes_t delta_time = cur_time - last_time;
Log("calling process4 callback : jack_frame_time = %ld delta_time = %ld\n", cur_time, delta_time);
if (delta_time > 0 && (unsigned int)abs(delta_time - cur_buffer_size) > tolerance) {
printf("!!! ERROR !!! jack_frame_time seems to return incorrect values cur_buffer_size = %d, delta_time = %d\n", cur_buffer_size, delta_time);
}
last_time = cur_time;
return 0;
}
@@ -525,7 +525,7 @@ int main (int argc, char *argv[])
int is_mine = 0; // to test jack_port_is_mine function...
const char *options = "kRnqvt:";
float ratio; // for speed calculation in freewheel mode
jack_options_t jack_options = JackNullOption;
jack_options_t jack_options = JackNullOption;
struct option long_options[] = {
{"realtime", 0, 0, 'R'},
{"non-realtime", 0, 0, 'n'},
@@ -602,8 +602,8 @@ int main (int argc, char *argv[])
printf("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\n");

/**
* Register a client...
*
* Register a client...
*
*/
Log("Register a client using jack_client_open()...\n");
client1 = jack_client_open(client_name1, jack_options, &status, server_name);
@@ -618,7 +618,7 @@ int main (int argc, char *argv[])
if (status & JackServerStarted) {
fprintf(stderr, "JACK server started\n");
}
/**
* try to register another one with the same name...
*
@@ -631,7 +631,7 @@ int main (int argc, char *argv[])
printf("!!! ERROR !!! Jackd server has accepted multiples client with the same name !\n");
jack_client_close(client2);
}
/**
* try to register another one with the same name using jack_client_open ==> since JackUseExactName is not used, an new client should be opened...
*
@@ -644,7 +644,7 @@ int main (int argc, char *argv[])
} else {
printf("!!! ERROR !!! Jackd server automatic renaming feature does not work!\n");
}
/**
* testing client name...
* Verify that the name sended at registration and the one returned by jack server is the same...
@@ -683,31 +683,31 @@ int main (int argc, char *argv[])
if (jack_set_buffer_size_callback(client1, Jack_Update_Buffer_Size, 0) != 0) {
printf("Error when calling buffer_size_callback !\n");
}
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_xrun_callback(client1, Jack_XRun_Callback, 0 ) != 0) {
printf("Error when calling jack_set_xrun_callback() !\n");
}
if (jack_set_sample_rate_callback(client1, Jack_Sample_Rate_Callback, 0 ) != 0) {
printf("Error when calling Jack_Sample_Rate_Callback() !\n");
}
if (jack_set_port_registration_callback(client1, Jack_Port_Register, 0) != 0) {
printf("Error when calling jack_set_port_registration_callback() !\n");
}
if (jack_set_port_connect_callback(client1, Jack_Port_Connect, 0) != 0) {
printf("Error when calling jack_set_port_connect_callback() !\n");
}
if (jack_set_client_registration_callback(client1, Jack_Client_Registration_Callback, 0) != 0) {
printf("Error when calling jack_set_client_registration_callback() !\n");
}
jack_set_error_function(Jack_Error_Callback);

/**
@@ -747,7 +747,7 @@ int main (int argc, char *argv[])
printf("!!! ERROR !!! Can't register any port for the client !\n");
exit(1);
}
/**
* Test port type of the just registered port.
*
@@ -811,7 +811,7 @@ int main (int argc, char *argv[])
printf ("Fatal error : cannot activate client1\n");
exit(1);
}
/**
* Test if init callback initThread have been called.
*
@@ -925,7 +925,7 @@ int main (int argc, char *argv[])
/**
* remove the output port previously created
* no more ports should subsist here for our client.
*
*
*/
if (jack_port_unregister(client1, output_port1) != 0) {
printf("!!! ERROR !!! while unregistering port %s.\n", jack_port_name(output_port1));
@@ -933,7 +933,7 @@ int main (int argc, char *argv[])

/**
* list all in ports
*
*
*/
inports = jack_get_ports(client1, NULL, NULL, 0);

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

free(inports); // free array of ports (as mentionned in the doc of jack_get_ports)
/**
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
@@ -1157,7 +1157,7 @@ int main (int argc, char *argv[])
}
exit(1);
}
// Check client registration callback
jack_sleep(1000);
if (client_register == 0)
@@ -1368,7 +1368,7 @@ int main (int argc, char *argv[])
}

/**
* Test TIE MODE
* Test TIE MODE
* (This mode seems to be problematic in standard jack version 0.100. It seems that nobody
* is used to apply this mode because the tie mode doesn't work at all. A patch seems difficult to produce
* in this version of jack. Tie mode work well in MP version.)
@@ -1468,7 +1468,7 @@ int main (int argc, char *argv[])
* So, the result must be zero...
* See process1 for details about steps of this test
*
*/
*/
// fprintf(file, "Sum test\n");
Log("Checking summation capabilities of patching...\n");
output_port1b = jack_port_register(client1, "out1b",
@@ -1565,7 +1565,7 @@ int main (int argc, char *argv[])
outports = jack_get_ports(client1, NULL, NULL, JackPortIsPhysical | JackPortIsOutput);
if (inports[0] != NULL) {
output_ext_latency = jack_port_get_latency (jack_port_by_name(client1, inports[0])); // from client to out driver (which has "inputs" ports..)
input_ext_latency = jack_port_get_latency (jack_port_by_name(client1, outports[0])); // from in driver (which has "output" ports..) to client
input_ext_latency = jack_port_get_latency (jack_port_by_name(client1, outports[0])); // from in driver (which has "output" ports..) to client
if (output_ext_latency != jack_port_get_total_latency(client1, jack_port_by_name(client1, inports[0]))) {
t_error = 1;
printf("!!! ERROR !!! get_latency & get_all_latency for a PHY device (unconnected) didn't return the same value !\n");
@@ -1641,7 +1641,7 @@ int main (int argc, char *argv[])
jack_port_disconnect(client1, input_port2);
jack_port_disconnect(client1, output_port1);
jack_port_disconnect(client1, output_port2);
jack_sleep(1000);

free(inports);
@@ -1836,23 +1836,23 @@ int main (int argc, char *argv[])
jack_sleep (1 * 1000);
time_before_exit--;
}
if (jack_deactivate(client2) != 0) {
printf("!!! ERROR !!! jack_deactivate does not return 0 for client2 !\n");
}
if (jack_deactivate(client1) != 0) {
printf("!!! ERROR !!! jack_deactivate does not return 0 for client1 !\n");
}
/**
* Checking jack_frame_time.
*/
Log("Testing jack_frame_time...\n");
jack_set_process_callback(client1, process4, client1);
jack_activate(client1);
jack_sleep(2 * 1000);
jack_sleep(2 * 1000);
/**
* Checking alternate thread model
*/
@@ -1862,7 +1862,7 @@ int main (int argc, char *argv[])
jack_set_process_thread(client1, jack_thread, client1);
jack_activate(client1);
jack_sleep(2 * 1000);
/**
* Checking callback exiting : when the return code is != 0, the client is desactivated.
*/
@@ -1871,8 +1871,8 @@ int main (int argc, char *argv[])
jack_set_process_thread(client1, NULL, NULL); // remove thread callback
jack_set_process_callback(client1, process3, 0);
jack_activate(client1);
jack_sleep(3 * 1000);
jack_sleep(3 * 1000);
/**
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


+ 18
- 3
windows/JackCompilerDeps_os.h View File

@@ -18,9 +18,25 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef __JackCompilerDeps_WIN32__
#define __JackCompilerDeps_WIN32__
#define __JackCompilerDeps_WIN32__

#if __GNUC__
#if __GNUC__
#ifndef POST_PACKED_STRUCTURE
/* POST_PACKED_STRUCTURE needs to be a macro which
expands into a compiler directive. The directive must
tell the compiler to arrange the preceding structure
declaration so that it is packed on byte-boundaries rather
than use the natural alignment of the processor and/or
compiler.
*/
#if (__GNUC__< 4) /* Does not seem to work with GCC 3.XX serie */
#define POST_PACKED_STRUCTURE
#elif defined(JACK_32_64)
#define POST_PACKED_STRUCTURE __attribute__((__packed__))
#else
#define POST_PACKED_STRUCTURE
#endif
#endif
#define MEM_ALIGN(x,y) x __attribute__((aligned(y)))
#define EXPORT __declspec(dllexport)
#ifdef SERVER_SIDE
@@ -29,7 +45,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define SERVER_EXPORT
#endif
#else
//#define MEM_ALIGN(x,y) __declspec(align(y)) x
#define MEM_ALIGN(x,y) x
#define EXPORT __declspec(dllexport)
#ifdef SERVER_SIDE


+ 2
- 2
windows/Setup/jack.ci View File

@@ -1,9 +1,9 @@
<*project
version = 4 civer = "Free v4.14.3" winver = "2.6/5.1.2600" >
<output> .</>
<exename> Jack_v1.9.2_setup.exe</>
<exename> Jack_v1.9.3_setup.exe</>
<digitsign> </>
<appname> Jack v1.9.2</>
<appname> Jack v1.9.3</>
<password> </>
<addlang> </>
<icon> Default - 2</>


Loading…
Cancel
Save