git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2880 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.90
@@ -22,8 +22,13 @@ Florian Faber | |||
Jackdmp changes log | |||
--------------------------- | |||
2008-09-04 Stephane Letz <letz@grame.fr> | |||
2008-08-05 Stephane Letz <letz@grame.fr> | |||
* Merge Michael Voigt "drops" branch after reorganization step. | |||
2008-08-04 Stephane Letz <letz@grame.fr> | |||
* Michael Voigt 4th source reorganization patch. | |||
* Correct JackNetDriver initialization. | |||
2008-09-03 Stephane Letz <letz@grame.fr> | |||
@@ -33,8 +38,17 @@ Florian Faber | |||
2008-09-01 Stephane Letz <letz@grame.fr> | |||
* Michael Voigt third source reorganization patch. | |||
* Add new jack_set_port_rename_callback API, jack_port_set_name is now a server request that call port rename callbacks. | |||
2008-08-31 Stephane Letz <letz@grame.fr> | |||
* Michael Voigt second source reorganization patch. | |||
2008-08-28 Stephane Letz <letz@grame.fr> | |||
* Michael Voigt first source reorganization patch. | |||
2008-08-26 Stephane Letz <letz@grame.fr> | |||
* Better parameter handling in JackCoreAudioAdapter. | |||
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#include "JackClientControl.h" | |||
#include "JackGlobals.h" | |||
#include "JackTime.h" | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include "JackPortType.h" | |||
#ifdef __APPLE__ | |||
@@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#ifndef __JackActivationCount__ | |||
#define __JackActivationCount__ | |||
#include "JackPlatformSynchro.h" | |||
#include "JackPlatformPlug.h" | |||
#include "JackTime.h" | |||
#include "JackTypes.h" | |||
@@ -22,171 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#include "JackTypes.h" | |||
#if defined(__APPLE__) | |||
#if defined(__ppc__) || defined(__ppc64__) | |||
static inline int CAS(register UInt32 value, register UInt32 newvalue, register volatile void* addr) | |||
{ | |||
register int result; | |||
asm volatile ( | |||
"# CAS \n" | |||
" lwarx r0, 0, %1 \n" // creates a reservation on addr | |||
" cmpw r0, %2 \n" // test value at addr | |||
" bne- 1f \n" | |||
" sync \n" // synchronize instructions | |||
" stwcx. %3, 0, %1 \n" // if the reservation is not altered | |||
// stores the new value at addr | |||
" bne- 1f \n" | |||
" li %0, 1 \n" | |||
" b 2f \n" | |||
"1: \n" | |||
" li %0, 0 \n" | |||
"2: \n" | |||
: "=r" (result) | |||
: "r" (addr), "r" (value), "r" (newvalue) | |||
: "r0" | |||
); | |||
return result; | |||
} | |||
#endif | |||
#if defined(__i386__) || defined(__x86_64__) | |||
#ifdef __SMP__ | |||
# define LOCK "lock ; " | |||
#else | |||
# define LOCK "" | |||
#endif | |||
static inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void* addr) | |||
{ | |||
register char ret; | |||
__asm__ __volatile__ ( | |||
"# CAS \n\t" | |||
LOCK "cmpxchg %2, (%1) \n\t" | |||
"sete %0 \n\t" | |||
: "=a" (ret) | |||
: "c" (addr), "d" (newvalue), "a" (value) | |||
); | |||
return ret; | |||
} | |||
#endif | |||
#endif | |||
#ifdef __linux__ | |||
#ifdef __PPC__ | |||
static inline int CAS(register UInt32 value, register UInt32 newvalue, register volatile void* addr) | |||
{ | |||
register int result; | |||
register UInt32 tmp; | |||
asm volatile ( | |||
"# CAS \n" | |||
" lwarx %4, 0, %1 \n" // creates a reservation on addr | |||
" cmpw %4, %2 \n" // test value at addr | |||
" bne- 1f \n" | |||
" sync \n" // synchronize instructions | |||
" stwcx. %3, 0, %1 \n" // if the reservation is not altered | |||
// stores the new value at addr | |||
" bne- 1f \n" | |||
" li %0, 1 \n" | |||
" b 2f \n" | |||
"1: \n" | |||
" li %0, 0 \n" | |||
"2: \n" | |||
: "=r" (result) | |||
: "r" (addr), "r" (value), "r" (newvalue), "r" (tmp) | |||
); | |||
return result; | |||
} | |||
#endif | |||
#if defined(__i386__) || defined(__x86_64__) | |||
#ifdef __SMP__ | |||
# define LOCK "lock ; " | |||
#else | |||
# define LOCK "" | |||
#endif | |||
static inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void* addr) | |||
{ | |||
register char ret; | |||
__asm__ __volatile__ ( | |||
"# CAS \n\t" | |||
LOCK "cmpxchg %2, (%1) \n\t" | |||
"sete %0 \n\t" | |||
: "=a" (ret) | |||
: "c" (addr), "d" (newvalue), "a" (value) | |||
); | |||
return ret; | |||
} | |||
#endif | |||
#endif | |||
#ifdef WIN32 | |||
#ifndef __MINGW32__ | |||
#ifdef __SMP__ | |||
# define LOCK lock | |||
#else | |||
# define LOCK | |||
#endif | |||
#define inline __inline | |||
//---------------------------------------------------------------- | |||
// CAS functions | |||
//---------------------------------------------------------------- | |||
inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void * addr) | |||
{ | |||
register char c; | |||
__asm { | |||
push ebx | |||
push esi | |||
mov esi, addr | |||
mov eax, value | |||
mov ebx, newvalue | |||
LOCK cmpxchg dword ptr [esi], ebx | |||
sete c | |||
pop esi | |||
pop ebx | |||
} | |||
return c; | |||
} | |||
#else | |||
#ifdef __SMP__ | |||
# define LOCK "lock ; " | |||
#else | |||
# define LOCK "" | |||
#endif | |||
static inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void* addr) | |||
{ | |||
register char ret; | |||
__asm__ __volatile__ ( | |||
"# CAS \n\t" | |||
LOCK "cmpxchg %2, (%1) \n\t" | |||
"sete %0 \n\t" | |||
: "=a" (ret) | |||
: "c" (addr), "d" (newvalue), "a" (value) | |||
); | |||
return ret; | |||
} | |||
#endif | |||
#endif | |||
#include "JackAtomic_os.h" | |||
static inline long INC_ATOMIC(volatile SInt32* val) | |||
{ | |||
@@ -20,7 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include "JackAudioAdapter.h" | |||
#include "JackLibSampleRateResampler.h" | |||
#include "JackError.h" | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include "JackTools.h" | |||
#include "jslist.h" | |||
#include <stdio.h> | |||
@@ -23,11 +23,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include <stdlib.h> | |||
#include <assert.h> | |||
#ifdef __cplusplus | |||
extern "C" | |||
{ | |||
#endif | |||
#include "driver_interface.h" | |||
#ifdef __linux__ | |||
@@ -40,6 +35,11 @@ extern "C" | |||
#ifdef WIN32 | |||
#include "JackPortAudioAdapter.h" | |||
#endif | |||
#ifdef __cplusplus | |||
extern "C" | |||
{ | |||
#endif | |||
using namespace Jack; | |||
@@ -41,8 +41,8 @@ namespace Jack | |||
char buffer[1024]; | |||
FILE* file = fopen("JackAudioAdapter.log", "w"); | |||
int MAX = (fCount) % TABLE_MAX - 1; | |||
for (int i = 1; i < MAX; i++) | |||
int max = (fCount) % TABLE_MAX - 1; | |||
for (int i = 1; i < max; i++) | |||
{ | |||
fprintf(file, "%d \t %d \t %d \t %f \t %f \t %d \t %d \n", | |||
fTable[i].delta, fTable[i+1].time1 - fTable[i].time1, | |||
@@ -22,9 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include "config.h" | |||
#endif | |||
#ifdef WIN32 | |||
#pragma warning (disable : 4786) | |||
#endif | |||
#include "JackSystemDeps.h" | |||
#include "JackAudioDriver.h" | |||
#include "JackTime.h" | |||
@@ -29,8 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#include "varargs.h" | |||
#include <list> | |||
#include "JackPlatformSynchro.h" | |||
#include "JackPlatformThread.h" | |||
#include "JackPlatformPlug.h" | |||
#include "JackChannel.h" | |||
namespace Jack | |||
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#ifndef __JackClientInterface__ | |||
#define __JackClientInterface__ | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
namespace Jack | |||
{ | |||
@@ -17,14 +17,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
*/ | |||
#ifndef __JackExports__ | |||
#define __JackExports__ | |||
#ifndef __JackCompilerDeps__ | |||
#define __JackCompilerDeps__ | |||
#ifdef WIN32 | |||
#define EXPORT __declspec(dllexport) | |||
#else | |||
#define EXPORT __attribute__ ((visibility("default"))) | |||
#endif | |||
#include "JackCompilerDeps_os.h" | |||
#endif | |||
@@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#include "JackConstants.h" | |||
#include "JackActivationCount.h" | |||
#include "JackError.h" | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include <assert.h> | |||
@@ -23,7 +23,7 @@ | |||
#define __JackControlAPI__ | |||
#include "jslist.h" | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#ifdef WIN32 | |||
#ifdef __MINGW32__ | |||
@@ -22,9 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include "config.h" | |||
#endif | |||
#ifdef WIN32 | |||
#pragma warning (disable : 4786) | |||
#endif | |||
#include "JackSystemDeps.h" | |||
#include "JackDriver.h" | |||
#include "JackTime.h" | |||
@@ -24,7 +24,7 @@ | |||
#include "types.h" | |||
#include "JackClientInterface.h" | |||
#include "JackConstants.h" | |||
#include "JackPlatformSynchro.h" | |||
#include "JackPlatformPlug.h" | |||
#include "JackClientControl.h" | |||
#include <list> | |||
@@ -22,9 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include "config.h" | |||
#endif | |||
#ifdef WIN32 | |||
#pragma warning (disable : 4786) | |||
#endif | |||
#include "JackSystemDeps.h" | |||
/* | |||
#ifndef WIN32 | |||
@@ -23,7 +23,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include "driver_interface.h" | |||
#include "JackControlAPI.h" | |||
#include "JackPlatformSynchro.h" | |||
#include "JackPlatformPlug.h" | |||
#ifdef WIN32 | |||
@@ -27,7 +27,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include "JackGraphManager.h" | |||
#include "JackDriverLoader.h" | |||
#include "JackThreadedDriver.h" | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include <iostream> | |||
#include <unistd.h> | |||
@@ -25,10 +25,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include <fstream> | |||
#include <assert.h> | |||
#ifndef WIN32 | |||
#include <sys/types.h> | |||
#include <signal.h> | |||
#endif | |||
#include "JackSystemDeps.h" | |||
#include "JackLockedEngine.h" | |||
#include "JackExternalClient.h" | |||
@@ -24,8 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include "JackGraphManager.h" | |||
#include "JackSynchro.h" | |||
#include "JackTransportEngine.h" | |||
#include "JackPlatformProcessSync.h" | |||
#include "JackPlatformServerNotifyChannel.h" | |||
#include "JackPlatformPlug.h" | |||
namespace Jack | |||
{ | |||
@@ -32,6 +32,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
namespace Jack | |||
{ | |||
static inline _jack_time_t JACK_MAX(_jack_time_t a, _jack_time_t b) | |||
{ | |||
return (a < b) ? b : a; | |||
} | |||
void JackEngineControl::CycleIncTime(jack_time_t callback_usecs) | |||
{ | |||
// Timer | |||
@@ -67,16 +72,6 @@ void JackEngineControl::ReadFrameTime(JackTimer* timer) | |||
fFrameTimer.ReadFrameTime(timer); | |||
} | |||
// Private | |||
#ifdef WIN32 | |||
inline jack_time_t MAX(jack_time_t a, jack_time_t b) | |||
{ | |||
return (a < b) ? b : a; | |||
} | |||
#else | |||
#define MAX(a,b) std::max((a),(b)) | |||
#endif | |||
void JackEngineControl::CalcCPULoad(JackClientInterface** table, | |||
JackGraphManager* manager, | |||
jack_time_t cur_cycle_begin, | |||
@@ -92,7 +87,7 @@ void JackEngineControl::CalcCPULoad(JackClientInterface** table, | |||
JackClientInterface* client = table[i]; | |||
JackClientTiming* timing = manager->GetClientTiming(i); | |||
if (client && client->GetClientControl()->fActive && timing->fStatus == Finished) | |||
last_cycle_end = MAX(last_cycle_end, timing->fFinishedAt); | |||
last_cycle_end = JACK_MAX(last_cycle_end, timing->fFinishedAt); | |||
} | |||
} | |||
@@ -108,9 +103,9 @@ void JackEngineControl::CalcCPULoad(JackClientInterface** table, | |||
jack_time_t max_usecs = 0; | |||
for (int i = 0; i < JACK_ENGINE_ROLLING_COUNT; i++) | |||
max_usecs = MAX(fRollingClientUsecs[i], max_usecs); | |||
max_usecs = JACK_MAX(fRollingClientUsecs[i], max_usecs); | |||
fMaxUsecs = MAX(fMaxUsecs, max_usecs); | |||
fMaxUsecs = JACK_MAX(fMaxUsecs, max_usecs); | |||
fSpareUsecs = jack_time_t((max_usecs < fPeriodUsecs) ? fPeriodUsecs - max_usecs : 0); | |||
fCPULoad = ((1.f - (float(fSpareUsecs) / float(fPeriodUsecs))) * 50.f + (fCPULoad * 0.5f)); | |||
} | |||
@@ -25,7 +25,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include <string.h> | |||
#include <errno.h> | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include "types.h" | |||
#ifdef __cplusplus | |||
@@ -23,7 +23,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include <stdexcept> | |||
#include <iostream> | |||
#include <string> | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include "JackError.h" | |||
namespace Jack | |||
@@ -22,7 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#define __JackExternalClient__ | |||
#include "JackClientInterface.h" | |||
#include "JackPlatformNotifyChannel.h" | |||
#include "JackPlatformPlug.h" | |||
namespace Jack | |||
{ | |||
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#define __JackFrameTimer__ | |||
#include "JackAtomicState.h" | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include "types.h" | |||
namespace Jack | |||
@@ -22,9 +22,7 @@ | |||
#include "config.h" | |||
#endif | |||
#ifdef WIN32 | |||
#pragma warning (disable : 4786) | |||
#endif | |||
#include "JackSystemDeps.h" | |||
#include "JackFreewheelDriver.h" | |||
#include "JackEngineControl.h" | |||
@@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#ifndef __JackGlobals__ | |||
#define __JackGlobals__ | |||
#include "JackPlatformThread.h" | |||
#include "JackPlatformPlug.h" | |||
extern jack_tls_key gRealTime; | |||
extern jack_tls_key g_key_log_function; | |||
@@ -33,11 +33,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
namespace Jack | |||
{ | |||
static inline jack_nframes_t MAX(jack_nframes_t a, jack_nframes_t b) | |||
{ | |||
return (a < b) ? b : a; | |||
} | |||
static void AssertPort(jack_port_id_t port_index) | |||
{ | |||
if (port_index >= PORT_NUM) { | |||
@@ -240,7 +235,7 @@ jack_nframes_t JackGraphManager::ComputeTotalLatencyAux(jack_port_id_t port_inde | |||
jack_nframes_t this_latency = (dst_port->fFlags & JackPortIsTerminal) | |||
? dst_port->GetLatency() | |||
: ComputeTotalLatencyAux(dst_index, port_index, manager, hop_count + 1); | |||
max_latency = MAX(max_latency, this_latency); | |||
max_latency = ((max_latency > this_latency) ? max_latency : this_latency); | |||
} | |||
} | |||
@@ -26,7 +26,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#include "JackConstants.h" | |||
#include "JackConnectionManager.h" | |||
#include "JackAtomicState.h" | |||
#include "JackPlatformSynchro.h" | |||
#include "JackPlatformPlug.h" | |||
#include "JackSystemDeps.h" | |||
namespace Jack | |||
{ | |||
@@ -22,9 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include "config.h" | |||
#endif | |||
#ifdef WIN32 | |||
#pragma warning (disable : 4786) | |||
#endif | |||
#include "JackSystemDeps.h" | |||
#ifndef WIN32 | |||
#ifndef ADDON_DIR | |||
@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#include "JackLibGlobals.h" | |||
#include "JackGlobals.h" | |||
#include "JackServerLaunch.h" | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include "JackTools.h" | |||
using namespace Jack; | |||
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#include "JackTime.h" | |||
#include "JackLibGlobals.h" | |||
#include "JackGlobals.h" | |||
#include "JackPlatformClientChannel.h" | |||
#include "JackPlatformPlug.h" | |||
#include "JackTools.h" | |||
namespace Jack | |||
@@ -22,12 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#include "JackShmMem.h" | |||
#include "JackEngineControl.h" | |||
#ifdef __APPLE__ | |||
#include "JackMachPort.h" | |||
#include <map> | |||
#endif | |||
#include "JackGlobals.h" | |||
#include "JackPlatformSynchro.h" | |||
#include "JackPlatformPlug.h" | |||
#include "JackGraphManager.h" | |||
#include "JackMessageBuffer.h" | |||
#include "JackTime.h" | |||
@@ -48,9 +44,6 @@ struct JackLibGlobals | |||
JackShmReadWritePtr<JackGraphManager> fGraphManager; /*! Shared memory Port manager */ | |||
JackShmReadWritePtr<JackEngineControl> fEngineControl; /*! Shared engine control */ // transport engine has to be writable | |||
JackSynchro fSynchroTable[CLIENT_NUM]; /*! Shared synchro table */ | |||
#ifdef __APPLE__ | |||
std::map<mach_port_t, JackClient*> fClientTable; /*! Client table */ | |||
#endif | |||
static int fClientCount; | |||
static JackLibGlobals* fGlobals; | |||
@@ -22,9 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include "config.h" | |||
#endif | |||
#ifdef WIN32 | |||
#pragma warning (disable : 4786) | |||
#endif | |||
#include "JackSystemDeps.h" | |||
#include "JackLoopbackDriver.h" | |||
#include "JackEngineControl.h" | |||
@@ -30,10 +30,9 @@ | |||
#ifndef __JackMessageBuffer__ | |||
#define __JackMessageBuffer__ | |||
#include "JackPlatformThread.h" | |||
#include "JackPlatformPlug.h" | |||
#include "JackMutex.h" | |||
#include "JackAtomic.h" | |||
#include "JackPlatformProcessSync.h" | |||
namespace Jack | |||
{ | |||
@@ -24,13 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#include "JackError.h" | |||
#include "JackMidiPort.h" | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include <errno.h> | |||
#include <string.h> | |||
#ifdef WIN32 | |||
#define ENOBUFS 55 | |||
#endif | |||
#include "JackSystemDeps.h" | |||
#ifdef __cplusplus | |||
extern "C" | |||
@@ -22,105 +22,13 @@ | |||
#ifndef __JackMutex__ | |||
#define __JackMutex__ | |||
#ifdef WIN32 | |||
#include <windows.h> | |||
#else | |||
#include <pthread.h> | |||
#endif | |||
#include "JackMutex_os.h" | |||
#include <assert.h> | |||
#include "JackError.h" | |||
namespace Jack | |||
{ | |||
/*! | |||
\brief Mutex abstraction. | |||
*/ | |||
class JackMutex | |||
{ | |||
private: | |||
#ifdef WIN32 | |||
HANDLE fMutex; | |||
#else | |||
pthread_mutex_t fMutex; | |||
#endif | |||
public: | |||
#ifdef WIN32 | |||
JackMutex() | |||
{ | |||
// In recursive mode by default | |||
fMutex = (HANDLE)CreateMutex(0, FALSE, 0); | |||
} | |||
~JackMutex() | |||
{ | |||
CloseHandle(fMutex); | |||
} | |||
void Lock() | |||
{ | |||
DWORD dwWaitResult = WaitForSingleObject(fMutex, INFINITE); | |||
} | |||
bool Trylock() | |||
{ | |||
return (WAIT_OBJECT_0 == WaitForSingleObject(fMutex, 0)); | |||
} | |||
void Unlock() | |||
{ | |||
ReleaseMutex(fMutex); | |||
} | |||
#else | |||
JackMutex() | |||
{ | |||
// Use recursive mutex | |||
pthread_mutexattr_t mutex_attr; | |||
int res; | |||
res = pthread_mutexattr_init(&mutex_attr); | |||
assert(res == 0); | |||
res = pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE); | |||
assert(res == 0); | |||
res = pthread_mutex_init(&fMutex, &mutex_attr); | |||
assert(res == 0); | |||
res = pthread_mutexattr_destroy(&mutex_attr); | |||
assert(res == 0); | |||
} | |||
~JackMutex() | |||
{ | |||
pthread_mutex_destroy(&fMutex); | |||
} | |||
void Lock() | |||
{ | |||
int res = pthread_mutex_lock(&fMutex); | |||
if (res != 0) | |||
jack_error("JackMutex::Lock res = %d", res); | |||
} | |||
bool Trylock() | |||
{ | |||
return (pthread_mutex_trylock(&fMutex) == 0); | |||
} | |||
void Unlock() | |||
{ | |||
int res = pthread_mutex_unlock(&fMutex); | |||
if (res != 0) | |||
jack_error("JackMutex::Unlock res = %d", res); | |||
} | |||
#endif | |||
}; | |||
/*! | |||
\brief Base class for "lockable" objects. | |||
*/ | |||
@@ -22,7 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include <assert.h> | |||
#include "JackAudioAdapterInterface.h" | |||
#include "JackPlatformThread.h" | |||
#include "JackPlatformPlug.h" | |||
#include "JackNetInterface.h" | |||
namespace Jack | |||
@@ -20,7 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#ifndef __JackNetSocket__ | |||
#define __JackNetSocket__ | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include "JackError.h" | |||
#include <cstdlib> | |||
#include <cstdio> | |||
@@ -20,7 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include "JackConstants.h" | |||
#include "JackMidiPort.h" | |||
#include "JackTools.h" | |||
#include "JackPlatformNetSocket.h" | |||
#include "JackPlatformPlug.h" | |||
#include "types.h" | |||
#include "transport.h" | |||
#include <cmath> | |||
@@ -1,59 +0,0 @@ | |||
/* | |||
Copyright (C) 2004-2008 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 | |||
(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 General Public License for more details. | |||
You should have received a copy of the GNU General Public License | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
*/ | |||
#ifndef __JackPlatformClientChannel__ | |||
#define __JackPlatformClientChannel___ | |||
#ifdef HAVE_CONFIG_H | |||
#include "config.h" | |||
#endif | |||
// OSX | |||
#if defined(__APPLE__) | |||
#include "JackMachClientChannel.h" | |||
#endif | |||
// WINDOWS | |||
#ifdef WIN32 | |||
#include "JackWinNamedPipeClientChannel.h" | |||
#endif | |||
// LINUX | |||
#ifdef __linux__ | |||
#include "JackSocketClientChannel.h" | |||
#endif | |||
namespace Jack | |||
{ | |||
#ifdef WIN32 | |||
typedef JackWinNamedPipeClientChannel JackClientChannel; | |||
#elif defined(SOCKET_RPC_POSIX_SEMA) || defined(SOCKET_RPC_FIFO_SEMA) || defined(SOCKET_RPC_FIFO_SEMA_DUMMY) \ | |||
|| defined(SOCKET_RPC_MACH_SEMA) | |||
typedef JackSocketClientChannel JackClientChannel; | |||
#elif defined(MACH_RPC_MACH_SEMA) || defined(MACH_RPC_FIFO_SEMA) || defined(MACH_RPC_POSIX_SEMA) | |||
typedef JackMachClientChannel JackClientChannel; | |||
#endif | |||
} // end of namespace | |||
#endif /* __JackPlatformClientChannel__ */ |
@@ -1,59 +0,0 @@ | |||
/* | |||
Copyright (C) 2004-2008 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 | |||
(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 General Public License for more details. | |||
You should have received a copy of the GNU General Public License | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
*/ | |||
#ifndef __JackPlatformNotifyChannel__ | |||
#define __JackPlatformNotifyChannel__ | |||
#ifdef HAVE_CONFIG_H | |||
#include "config.h" | |||
#endif | |||
// OSX | |||
#if defined(__APPLE__) | |||
#include "JackMachNotifyChannel.h" | |||
#endif | |||
// WINDOWS | |||
#ifdef WIN32 | |||
#include "JackWinNamedPipeNotifyChannel.h" | |||
#endif | |||
// LINUX | |||
#ifdef __linux__ | |||
#include "JackSocketNotifyChannel.h" | |||
#endif | |||
namespace Jack | |||
{ | |||
#ifdef WIN32 | |||
typedef JackWinNamedPipeNotifyChannel JackNotifyChannel; | |||
#elif defined(SOCKET_RPC_POSIX_SEMA) || defined(SOCKET_RPC_FIFO_SEMA) || defined(SOCKET_RPC_FIFO_SEMA_DUMMY) \ | |||
|| defined(SOCKET_RPC_MACH_SEMA) | |||
typedef JackSocketNotifyChannel JackNotifyChannel; | |||
#elif defined(MACH_RPC_MACH_SEMA) || defined(MACH_RPC_FIFO_SEMA) || defined(MACH_RPC_POSIX_SEMA) | |||
typedef JackMachNotifyChannel JackNotifyChannel; | |||
#endif | |||
} // end of namespace | |||
#endif /* __JackPlatformNotifyChannel__ */ |
@@ -0,0 +1,25 @@ | |||
/* | |||
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. | |||
*/ | |||
#ifndef __JackPlatformPlug__ | |||
#define __JackPlatformPlug__ | |||
#include "JackPlatformPlug_os.h" | |||
#endif |
@@ -1,59 +0,0 @@ | |||
/* | |||
Copyright (C) 2004-2008 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 | |||
(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 General Public License for more details. | |||
You should have received a copy of the GNU General Public License | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
*/ | |||
#ifndef __JackPlatformServerChannel__ | |||
#define __JackPlatformServerChannel___ | |||
#ifdef HAVE_CONFIG_H | |||
#include "config.h" | |||
#endif | |||
// OSX | |||
#if defined(__APPLE__) | |||
#include "JackMachServerChannel.h" | |||
#endif | |||
// WINDOWS | |||
#ifdef WIN32 | |||
#include "JackWinNamedPipeServerChannel.h" | |||
#endif | |||
// LINUX | |||
#ifdef __linux__ | |||
#include "JackSocketServerChannel.h" | |||
#endif | |||
namespace Jack | |||
{ | |||
#ifdef WIN32 | |||
typedef JackWinNamedPipeServerChannel JackServerChannel; | |||
#elif defined(SOCKET_RPC_POSIX_SEMA) || defined(SOCKET_RPC_FIFO_SEMA) || defined(SOCKET_RPC_FIFO_SEMA_DUMMY) \ | |||
|| defined(SOCKET_RPC_MACH_SEMA) | |||
typedef JackSocketServerChannel JackServerChannel; | |||
#elif defined(MACH_RPC_MACH_SEMA) || defined(MACH_RPC_FIFO_SEMA) || defined(MACH_RPC_POSIX_SEMA) | |||
typedef JackMachServerChannel JackServerChannel; | |||
#endif | |||
} // end of namespace | |||
#endif /* __JackPlatformServerChannel__ */ |
@@ -1,59 +0,0 @@ | |||
/* | |||
Copyright (C) 2004-2008 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 | |||
(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 General Public License for more details. | |||
You should have received a copy of the GNU General Public License | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
*/ | |||
#ifndef __JackPlatformServerNotifyChannel__ | |||
#define __JackPlatformServerNotifyChannel___ | |||
#ifdef HAVE_CONFIG_H | |||
#include "config.h" | |||
#endif | |||
// OSX | |||
#if defined(__APPLE__) | |||
#include "JackMachServerNotifyChannel.h" | |||
#endif | |||
// WINDOWS | |||
#ifdef WIN32 | |||
#include "JackWinNamedPipeServerNotifyChannel.h" | |||
#endif | |||
// LINUX | |||
#ifdef __linux__ | |||
#include "JackSocketServerNotifyChannel.h" | |||
#endif | |||
namespace Jack | |||
{ | |||
#ifdef WIN32 | |||
typedef JackWinNamedPipeServerNotifyChannel JackServerNotifyChannel; | |||
#elif defined(SOCKET_RPC_POSIX_SEMA) || defined(SOCKET_RPC_FIFO_SEMA) || defined(SOCKET_RPC_FIFO_SEMA_DUMMY) \ | |||
|| defined(SOCKET_RPC_MACH_SEMA) | |||
typedef JackSocketServerNotifyChannel JackServerNotifyChannel; | |||
#elif defined(MACH_RPC_MACH_SEMA) || defined(MACH_RPC_FIFO_SEMA) || defined(MACH_RPC_POSIX_SEMA) | |||
typedef JackMachServerNotifyChannel JackServerNotifyChannel; | |||
#endif | |||
} // end of namespace | |||
#endif /* __JackPlatformServerNotifyChannel__ */ |
@@ -1,64 +0,0 @@ | |||
/* | |||
Copyright (C) 2004-2008 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 | |||
(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 General Public License for more details. | |||
You should have received a copy of the GNU General Public License | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
*/ | |||
#ifndef __JackPlatformSynchro__ | |||
#define __JackPlatformSynchro__ | |||
#ifdef HAVE_CONFIG_H | |||
#include "config.h" | |||
#endif | |||
// OSX | |||
#if defined(__APPLE__) | |||
#include "JackMachSemaphore.h" | |||
#endif | |||
// WINDOWS | |||
#ifdef WIN32 | |||
#include "JackWinSemaphore.h" | |||
#endif | |||
// LINUX | |||
#ifdef __linux__ | |||
#include "JackPosixSemaphore.h" | |||
#include "JackFifo.h" | |||
#endif | |||
namespace Jack | |||
{ | |||
#ifdef WIN32 | |||
typedef JackWinSemaphore JackSynchro; | |||
#endif | |||
#if defined(MACH_RPC_MACH_SEMA) || defined(SOCKET_RPC_MACH_SEMA) | |||
typedef JackMachSemaphore JackSynchro; | |||
#endif | |||
#if defined(SOCKET_RPC_POSIX_SEMA) || defined(MACH_RPC_POSIX_SEMA) | |||
typedef JackPosixSemaphore JackSynchro; | |||
#endif | |||
#if defined(SOCKET_RPC_FIFO_SEMA) || defined(SOCKET_RPC_FIFO_SEMA_DUMMY) || defined(MACH_RPC_FIFO_SEMA) | |||
typedef JackFifo JackSynchro; | |||
#endif | |||
} // end of namespace | |||
#endif /* __JackPlatformSynchro__ */ |
@@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#include "types.h" | |||
#include "JackConstants.h" | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
namespace Jack | |||
{ | |||
@@ -56,15 +56,7 @@ class EXPORT JackPort | |||
bool fInUse; | |||
jack_port_id_t fTied; // Locally tied source port | |||
#ifdef WIN32 | |||
//__declspec(align(16)) float fBuffer[BUFFER_SIZE_MAX]; | |||
float fBuffer[BUFFER_SIZE_MAX]; | |||
#elif __GNUC__ | |||
float fBuffer[BUFFER_SIZE_MAX] __attribute__((aligned(64))); // 16 bytes alignment for vector code, 64 bytes better for cache loads/stores | |||
#else | |||
#warning Buffer will not be aligned on 16 bytes boundaries : vector based code (Altivec of SSE) will fail | |||
float fBuffer[BUFFER_SIZE_MAX]; | |||
#endif | |||
MEM_ALIGN(float fBuffer[BUFFER_SIZE_MAX], 64); // 16 bytes alignment for vector code, 64 bytes better for cache loads/stores | |||
bool IsUsed() const; | |||
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#define __JackRequest__ | |||
#include "JackConstants.h" | |||
#include "JackPlatformChannelTransaction.h" | |||
#include "JackPlatformPlug.h" | |||
#include "types.h" | |||
#include <string.h> | |||
#include <stdio.h> | |||
@@ -22,9 +22,7 @@ | |||
#include "config.h" | |||
#endif | |||
#ifdef WIN32 | |||
#pragma warning (disable : 4786) | |||
#endif | |||
#include "JackSystemDeps.h" | |||
#include "JackRestartThreadedDriver.h" | |||
#include "JackException.h" | |||
@@ -22,9 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include "config.h" | |||
#endif | |||
#ifdef WIN32 | |||
#pragma warning (disable : 4786) | |||
#endif | |||
#include "JackSystemDeps.h" | |||
#include "JackServer.h" | |||
#include "JackTime.h" | |||
@@ -21,15 +21,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#ifndef __JackServer__ | |||
#define __JackServer__ | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include "driver_interface.h" | |||
#include "JackDriverLoader.h" | |||
#include "JackConnectionManager.h" | |||
#include "jslist.h" | |||
#include "JackGlobals.h" | |||
#include "JackPlatformSynchro.h" | |||
#include "JackPlatformServerChannel.h" | |||
#include "JackPlatformPlug.h" | |||
namespace Jack | |||
@@ -22,9 +22,7 @@ This program is free software; you can redistribute it and/or modify | |||
#include "config.h" | |||
#endif | |||
#ifdef WIN32 | |||
#pragma warning (disable : 4786) | |||
#endif | |||
#include "JackSystemDeps.h" | |||
#include "JackGraphManager.h" | |||
#include "JackInternalClient.h" | |||
@@ -33,7 +31,7 @@ This program is free software; you can redistribute it and/or modify | |||
#include "JackServerGlobals.h" | |||
#include "JackServerLaunch.h" | |||
#include "JackTools.h" | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include "JackLockedEngine.h" | |||
#ifdef __cplusplus | |||
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#include "JackChannel.h" | |||
#include "JackLibGlobals.h" | |||
#include "JackServerLaunch.h" | |||
#include "JackPlatformClientChannel.h" | |||
#include "JackPlatformPlug.h" | |||
using namespace Jack; | |||
@@ -23,26 +23,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include "shm.h" | |||
#include "JackError.h" | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include <new> // GCC 4.0 | |||
#include <errno.h> | |||
#include <stdlib.h> | |||
#ifdef WIN32 | |||
#include <windows.h> | |||
#define CHECK_MLOCK(ptr, size) (VirtualLock((ptr), (size)) != 0) | |||
#define CHECK_MUNLOCK(ptr, size) (VirtualUnlock((ptr), (size)) != 0) | |||
#define CHECK_MLOCKALL()(false) | |||
#define CHECK_MUNLOCKALL()(false) | |||
#else | |||
#include <sys/types.h> | |||
#include <sys/mman.h> | |||
#define CHECK_MLOCK(ptr, size) (mlock((ptr), (size)) == 0) | |||
#define CHECK_MUNLOCK(ptr, size) (munlock((ptr), (size)) == 0) | |||
#define CHECK_MLOCKALL() (mlockall(MCL_CURRENT | MCL_FUTURE) == 0) | |||
#define CHECK_MUNLOCKALL() (munlockall() == 0) | |||
#endif | |||
#include "JackShmMem_os.h" | |||
namespace Jack | |||
{ | |||
@@ -94,6 +94,7 @@ class JackSynchro | |||
} | |||
}; | |||
} | |||
} // end of namespace | |||
@@ -0,0 +1,26 @@ | |||
/* | |||
Copyright (C) 2004-2006 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 | |||
(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 General Public License for more details. | |||
You should have received a copy of the GNU General Public License | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
*/ | |||
#ifndef __JackSystemDeps__ | |||
#define __JackSystemDeps__ | |||
#include "systemdeps.h" | |||
#include "JackSystemDeps_os.h" | |||
#endif |
@@ -21,16 +21,8 @@ | |||
#ifndef __JackThread__ | |||
#define __JackThread__ | |||
#include "JackExports.h" | |||
#ifdef WIN32 | |||
#include <windows.h> | |||
typedef HANDLE pthread_t; | |||
typedef ULONGLONG UInt64; | |||
#else | |||
#include <pthread.h> | |||
typedef unsigned long long UInt64; | |||
#endif | |||
#include "JackCompilerDeps.h" | |||
#include "JackTypes.h" | |||
namespace Jack | |||
{ | |||
@@ -65,7 +57,7 @@ class JackRunnableInterface | |||
namespace detail | |||
{ | |||
class EXPORT JackThread | |||
class EXPORT JackThreadInterface | |||
{ | |||
public: | |||
@@ -82,7 +74,7 @@ class EXPORT JackThread | |||
public: | |||
JackThread(JackRunnableInterface* runnable, int priority, bool real_time, int cancellation): | |||
JackThreadInterface(JackRunnableInterface* runnable, int priority, bool real_time, int cancellation): | |||
fRunnable(runnable), fPriority(priority), fRealTime(real_time), fStatus(kIdle), fCancellation(cancellation) | |||
{} | |||
@@ -98,18 +90,29 @@ class EXPORT JackThread | |||
void SetParams(UInt64 period, UInt64 computation, UInt64 constraint) // Empty implementation, will only make sense on OSX... | |||
{} | |||
int Start(); | |||
int StartSync(); | |||
int Kill(); | |||
int Stop(); | |||
void Terminate(); | |||
int AcquireRealTime(); | |||
int AcquireRealTime(int priority); | |||
int DropRealTime(); | |||
pthread_t GetThreadID(); | |||
static int AcquireRealTimeImp(pthread_t thread, int priority); | |||
static int DropRealTimeImp(pthread_t thread); | |||
static int StartImp(pthread_t* thread, int priority, int realtime, void*(*start_routine)(void*), void* arg); | |||
static int StopImp(pthread_t thread); | |||
static int KillImp(pthread_t thread); | |||
}; | |||
} | |||
} // end of namespace | |||
#if defined(WIN32) | |||
typedef DWORD jack_tls_key; | |||
#else | |||
typedef pthread_key_t jack_tls_key; | |||
#endif | |||
EXPORT bool jack_tls_allocate_key(jack_tls_key *key_ptr); | |||
EXPORT bool jack_tls_free_key(jack_tls_key key); | |||
@@ -22,9 +22,7 @@ | |||
#include "config.h" | |||
#endif | |||
#ifdef WIN32 | |||
#pragma warning (disable : 4786) | |||
#endif | |||
#include "JackSystemDeps.h" | |||
#include "JackThreadedDriver.h" | |||
#include "JackError.h" | |||
@@ -22,7 +22,7 @@ | |||
#define __JackThreadedDriver__ | |||
#include "JackDriver.h" | |||
#include "JackPlatformThread.h" | |||
#include "JackPlatformPlug.h" | |||
namespace Jack | |||
{ | |||
@@ -22,86 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#define __JackTime__ | |||
#include "types.h" | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include <stdio.h> | |||
#ifdef __cplusplus | |||
extern "C" | |||
{ | |||
#endif | |||
#if defined(__APPLE__) | |||
#include <mach/mach_time.h> | |||
#include <unistd.h> | |||
extern EXPORT double __jack_time_ratio; | |||
static inline jack_time_t GetMicroSeconds(void) | |||
{ | |||
return (jack_time_t) (mach_absolute_time () * __jack_time_ratio); | |||
} | |||
/* This should only be called ONCE per process. */ | |||
void InitTime(); | |||
static inline void JackSleep(int usec) | |||
{ | |||
usleep(usec); | |||
} | |||
#endif | |||
#ifdef WIN32 | |||
extern EXPORT LARGE_INTEGER _jack_freq; | |||
EXPORT jack_time_t GetMicroSeconds(void) ; | |||
void InitTime(); | |||
static void JackSleep(int usec) | |||
{ | |||
Sleep(usec / 1000); | |||
} | |||
#endif | |||
#ifdef linux | |||
#include <unistd.h> | |||
static inline void JackSleep(long usec) | |||
{ | |||
usleep(usec); | |||
} | |||
#ifdef GETCYCLE_TIME | |||
#include "cycles.h" | |||
extern jack_time_t __jack_cpu_mhz; | |||
jack_time_t GetMhz(); | |||
void InitTime(); | |||
static inline jack_time_t GetMicroSeconds(void) | |||
{ | |||
return get_cycles() / __jack_cpu_mhz; | |||
} | |||
#else | |||
#include <time.h> | |||
void InitTime(); | |||
static inline jack_time_t GetMicroSeconds(void) | |||
{ | |||
struct timespec ts; | |||
clock_gettime(CLOCK_MONOTONIC, &ts); | |||
return (jack_time_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000; | |||
} | |||
#endif | |||
#endif | |||
#ifdef __cplusplus | |||
} | |||
#endif | |||
#include "JackTime_os.h" | |||
#endif | |||
@@ -40,7 +40,7 @@ | |||
#include "jslist.h" | |||
#include "driver_interface.h" | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include "JackError.h" | |||
namespace Jack | |||
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#define __JackTransportEngine__ | |||
#include "JackAtomicArrayState.h" | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#include "types.h" | |||
namespace Jack | |||
@@ -30,14 +30,7 @@ typedef unsigned long UInt32; | |||
typedef signed long SInt32; | |||
#endif | |||
#ifdef WIN32 | |||
#include <windows.h> | |||
typedef ULONGLONG UInt64; | |||
typedef unsigned short uint16_t; | |||
#else | |||
#include <stdint.h> | |||
typedef unsigned long long UInt64; | |||
#endif | |||
#include "JackTypes_os.h" | |||
typedef uint16_t jack_int_t; // Internal type for ports and refnum | |||
@@ -22,9 +22,7 @@ | |||
#include "config.h" | |||
#endif | |||
#ifdef WIN32 | |||
#pragma warning (disable : 4786) | |||
#endif | |||
#include "JackSystemDeps.h" | |||
#include "JackWaitThreadedDriver.h" | |||
#include "JackGlobals.h" | |||
@@ -27,14 +27,9 @@ extern "C" | |||
#include <limits.h> | |||
#include "jslist.h" | |||
#include "JackExports.h" | |||
#include "JackCompilerDeps.h" | |||
#ifdef WIN32 | |||
#include "types.h" | |||
#define PATH_MAX 1024 | |||
#else | |||
#include <inttypes.h> | |||
#endif | |||
#include "JackSystemDeps.h" | |||
#define JACK_DRIVER_NAME_MAX 15 | |||
#define JACK_DRIVER_PARAM_NAME_MAX 15 | |||
@@ -30,10 +30,7 @@ | |||
#define JACKCTL_H__2EEDAD78_DF4C_4B26_83B7_4FF1A446A47E__INCLUDED | |||
#include <jack/jslist.h> | |||
#ifdef WIN32 | |||
typedef unsigned long sigset_t; | |||
#endif | |||
#include <jack/systemdeps.h> | |||
/** Parameter types, intentionally similar to jack_driver_param_type_t */ | |||
typedef enum | |||
@@ -26,13 +26,7 @@ extern "C" | |||
{ | |||
#endif | |||
#ifdef WIN32 | |||
#include <windows.h> | |||
typedef HANDLE pthread_t; | |||
#else | |||
#include <pthread.h> | |||
#endif | |||
#include <jack/systemdeps.h> | |||
#include <jack/types.h> | |||
#include <jack/transport.h> | |||
@@ -27,9 +27,7 @@ | |||
#include <stdlib.h> | |||
#ifdef WIN32 | |||
#define __inline__ inline | |||
#endif | |||
#include <jack/systemdeps.h> | |||
typedef struct _JSList JSList; | |||
@@ -285,290 +283,4 @@ jack_slist_sort (JSList *list, | |||
} | |||
#endif /* __jack_jslist_h__ */ | |||
/* | |||
Based on gslist.c from glib-1.2.9 (LGPL). | |||
Adaption to JACK, Copyright (C) 2002 Kai Vehmanen. | |||
- replaced use of gtypes with normal ANSI C types | |||
- glib's memory allocation routines replaced with | |||
malloc/free calls | |||
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. | |||
*/ | |||
#ifndef __jack_jslist_h__ | |||
#define __jack_jslist_h__ | |||
#include <stdlib.h> | |||
#ifdef WIN32 | |||
#define __inline__ inline | |||
#endif | |||
typedef struct _JSList JSList; | |||
typedef int (*JCompareFunc) (void* a, void* b); | |||
struct _JSList | |||
{ | |||
void *data; | |||
JSList *next; | |||
}; | |||
static __inline__ | |||
JSList* | |||
jack_slist_alloc (void) | |||
{ | |||
JSList *new_list; | |||
new_list = (JSList*)malloc(sizeof(JSList)); | |||
new_list->data = NULL; | |||
new_list->next = NULL; | |||
return new_list; | |||
} | |||
static __inline__ | |||
JSList* | |||
jack_slist_prepend (JSList* list, void* data) | |||
{ | |||
JSList *new_list; | |||
new_list = (JSList*)malloc(sizeof(JSList)); | |||
new_list->data = data; | |||
new_list->next = list; | |||
return new_list; | |||
} | |||
#define jack_slist_next(slist) ((slist) ? (((JSList *)(slist))->next) : NULL) | |||
static __inline__ | |||
JSList* | |||
jack_slist_last (JSList *list) | |||
{ | |||
if (list) { | |||
while (list->next) | |||
list = list->next; | |||
} | |||
return list; | |||
} | |||
static __inline__ | |||
JSList* | |||
jack_slist_remove_link (JSList *list, | |||
JSList *link) | |||
{ | |||
JSList *tmp; | |||
JSList *prev; | |||
prev = NULL; | |||
tmp = list; | |||
while (tmp) { | |||
if (tmp == link) { | |||
if (prev) | |||
prev->next = tmp->next; | |||
if (list == tmp) | |||
list = list->next; | |||
tmp->next = NULL; | |||
break; | |||
} | |||
prev = tmp; | |||
tmp = tmp->next; | |||
} | |||
return list; | |||
} | |||
static __inline__ | |||
void | |||
jack_slist_free (JSList *list) | |||
{ | |||
while (list) { | |||
JSList *next = list->next; | |||
free(list); | |||
list = next; | |||
} | |||
} | |||
static __inline__ | |||
void | |||
jack_slist_free_1 (JSList *list) | |||
{ | |||
if (list) { | |||
free(list); | |||
} | |||
} | |||
static __inline__ | |||
JSList* | |||
jack_slist_remove (JSList *list, | |||
void *data) | |||
{ | |||
JSList *tmp; | |||
JSList *prev; | |||
prev = NULL; | |||
tmp = list; | |||
while (tmp) { | |||
if (tmp->data == data) { | |||
if (prev) | |||
prev->next = tmp->next; | |||
if (list == tmp) | |||
list = list->next; | |||
tmp->next = NULL; | |||
jack_slist_free (tmp); | |||
break; | |||
} | |||
prev = tmp; | |||
tmp = tmp->next; | |||
} | |||
return list; | |||
} | |||
static __inline__ | |||
unsigned int | |||
jack_slist_length (JSList *list) | |||
{ | |||
unsigned int length; | |||
length = 0; | |||
while (list) { | |||
length++; | |||
list = list->next; | |||
} | |||
return length; | |||
} | |||
static __inline__ | |||
JSList* | |||
jack_slist_find (JSList *list, | |||
void *data) | |||
{ | |||
while (list) { | |||
if (list->data == data) | |||
break; | |||
list = list->next; | |||
} | |||
return list; | |||
} | |||
static __inline__ | |||
JSList* | |||
jack_slist_copy (JSList *list) | |||
{ | |||
JSList *new_list = NULL; | |||
if (list) { | |||
JSList *last; | |||
new_list = jack_slist_alloc (); | |||
new_list->data = list->data; | |||