Browse Source

rebase from trunk 3899:3916

git-svn-id: http://subversion.jackaudio.org/jack/jack2/branches/libjacknet@3917 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.9.8
sletz 14 years ago
parent
commit
ec2e42c933
48 changed files with 351 additions and 260 deletions
  1. +4
    -0
      ChangeLog
  2. +1
    -0
      README
  3. +2
    -5
      common/JackAudioDriver.cpp
  4. +1
    -1
      common/JackClient.cpp
  5. +1
    -1
      common/JackConstants.h
  6. +4
    -0
      common/JackDriver.h
  7. +76
    -71
      common/JackEngine.cpp
  8. +9
    -1
      common/JackEngine.h
  9. +2
    -1
      common/JackEngineControl.cpp
  10. +1
    -1
      common/JackEngineControl.h
  11. +12
    -0
      common/JackGraphManager.cpp
  12. +3
    -1
      common/JackGraphManager.h
  13. +41
    -41
      common/JackLockedEngine.h
  14. +2
    -5
      common/JackMidiDriver.cpp
  15. +2
    -4
      common/JackMutex.h
  16. +4
    -10
      common/JackNetOneDriver.cpp
  17. +9
    -1
      common/jack/types.h
  18. +5
    -3
      common/jack/weakmacros.h
  19. +1
    -1
      doxyfile
  20. +6
    -0
      example-clients/lsp.c
  21. +3
    -3
      linux/alsa/JackAlsaDriver.cpp
  22. +1
    -1
      linux/alsa/alsa_rawmidi.c
  23. +1
    -1
      linux/alsa/alsa_seqmidi.c
  24. +14
    -14
      linux/firewire/JackFFADODriver.cpp
  25. +3
    -8
      linux/freebob/JackFreebobDriver.cpp
  26. +2
    -2
      macosx/Jack-Info.plist
  27. +28
    -0
      macosx/Jackdmp.xcodeproj/project.pbxproj
  28. +4
    -7
      macosx/coreaudio/JackCoreAudioDriver.cpp
  29. +2
    -5
      macosx/coremidi/JackCoreMidiDriver.cpp
  30. +7
    -0
      posix/JackNetUnixSocket.cpp
  31. +4
    -2
      posix/JackPosixMutex.h
  32. +29
    -2
      tests/test.cpp
  33. +5
    -5
      windows/JackRouter/resource.rc
  34. +5
    -5
      windows/JackWinMutex.h
  35. BIN
      windows/Setup/JackRouter.dll
  36. +4
    -2
      windows/Setup/jack.ci
  37. +5
    -5
      windows/jackaudioadapter.rc
  38. +5
    -5
      windows/jackd.rc
  39. +5
    -5
      windows/jacknetadapter.rc
  40. +5
    -5
      windows/jacknetdriver.rc
  41. +5
    -5
      windows/jacknetmanager.rc
  42. +5
    -5
      windows/jackportaudio.rc
  43. +5
    -5
      windows/jackwinmme.rc
  44. +5
    -5
      windows/libjack.rc
  45. +5
    -5
      windows/libjackserver.rc
  46. +5
    -5
      windows/resource.rc
  47. +2
    -5
      windows/winmme/JackWinMMEDriver.cpp
  48. +1
    -1
      wscript

+ 4
- 0
ChangeLog View File

@@ -29,6 +29,10 @@ Mario Lang
Jackdmp changes log
---------------------------

2010-02-15 Gabriel M. Beddingfield <gabriel@teuton.org>
* Version 1.9.6 started.

2010-01-29 Gabriel M. Beddingfield <gabriel@teuton.org>
* Change JackEngineProfiling and JackAudioAdapterInterface gnuplot scripts to output SVG instead of PDF.


+ 1
- 0
README View File

@@ -214,6 +214,7 @@ Note : To experiment with the -S option, jackdmp must be launched in a console.
1.9.2 : Solaris version. New "profiling" tools. Rework the mutex/signal classes. Support for BIG_ENDIAN machines in NetJack2. D-BUS based device reservation to better coexist with PulseAudio on Linux. Add auto_connect parameter in netmanager and netadapter. Use Torben Hohn PI controler code for adapters. Client incorrect re-naming fixed : now done at socket and fifo level. Virtualize and allow overriding of thread creation function, to allow Wine support (from JACK1).
1.9.3 : New JackBoomerDriver class for Boomer driver on Solaris. Add mixed 32/64 bits mode (off by default). Native MIDI backend (JackCoreMidiDriver, JackWinMMEDriver). In ALSA audio card reservation code, tries to open the card even if reservation fails. Clock source setting on Linux. Add jackctl_server_switch_master API. Fix transport callback (timebase master, sync) issue when used after jack_activate (RT thread was not running). D-Bus access for jackctl_server_add_slave/jackctl_server_remove_slave API. Cleanup "loopback" stuff in server. Torben Hohn fix for InitTime and GetMicroSeconds in JackWinTime.c. New jack_free function added in jack.h. Reworked Torben Hohn fix for server restart issue on Windows. Correct jack_set_error_function, jack_set_info_function and jack_set_thread_creator functions. Correct JackFifo::TimedWait for EINTR handling. Move DBus based audio device reservation code in ALSA backend compilation. Correct JackTransportEngine::MakeAllLocating, sync callback has to be called in this case also. NetJack2 code : better error checkout, method renaming. Tim Bechmann patch : hammerfall, only release monitor thread, if it has been created. Tim Bechmann memops.c optimization patches. In combined --dbus and --classic compilation code, use PulseAudio acquire/release code. Big rewrite of Solaris boomer driver, seems to work in duplex mode at least. Loopback backend reborn as a dynamically loadable separated backend.
1.9.4 : Solaris boomer backend now working in capture or playback only mode. Add a -G parameter in CoreAudio backend (the computation value in RT thread expressed as percent of period). Use SNDCTL_DSP_SYNCGROUP/SNDCTL_DSP_SYNCSTART API to synchronize input and output in Solaris boomer backend. Big endian bug fix in memops.c. Fix issues in JackNetDriver::DecodeTransportData and JackNetDriver::Initialize. Correct CPU timing in JackNetDriver, now take cycle begin time after Read. Simplify transport in NetJack2: master only can control transport. Change CoreAudio notification thread setup for OSX Snow Leopard. Correct server temporary mode : now set a global and quit after server/client message handling is finished. Add a string parameter to server ==> client notification, add a new JackInfoShutdownCallback type. CoreAudio backend now issue a JackInfoShutdownCallback when an unrecoverable error is detected (sampling rate change, stream configuration changeÉ). Correct jackdmp.cpp (failures case were not correct..). Improve JackCoreAudioDriver code. Raise default port number to 2048. Correct JackProcessSync::LockedTimedWait. Correct JACK_MESSAGE_SIZE value, particularly in OSX RPC code. Now start server channel thread only when backend has been started (so in JackServer::Start). Should solve race conditions at start time. jack_verbose moved to JackGlobals class. Improve aggregate device management in JackCoreAudioDriver : now a "private" device only and cleanup properly. Aggregate device code added to JackCoreAudioAdapter. Implement "hog mode" (exclusive access of the audio device) in JackCoreAudioDriver. Fix jack_set_sample_rate_callback to have he same behavior as in JACK1. Dynamic system version detection in JackCoreAudioDriver to either create public or private aggregate device. In JackCoreAudioDriver, force the SR value to the wanted one *before* creating aggregate device (otherwise creation will fail). In JackCoreAudioDriver, better cleanup of AD when intermediate open failure. In JackCoreAudioDriver::Start, wait for the audio driver to effectively start (use the MeasureCallback). In JackCoreAudioDriver, improve management of input/output channels: -1 is now used internally to indicate a wanted max value. In JackCoreAudioDriver::OpenAUHAL, correct stream format setup and cleanup. Correct crash bug in JackAudioAdapterInterface when not input is used in adapter (temporary fixÉ). Sync JackCoreAudioAdapter code on JackCoreAudioDriver one. JACK_SCHED_POLICY switched to SCHED_FIFO. Now can aggregate device that are themselves AD. No reason to make jack_on_shutdown deprecated, so revert the incorrect change. Thread AcquireRealTime and DropRealTime were (incorrectly) using fThread field. Use pthread_self()) (or GetCurrentThread() on Windows) to get the calling thread. Correctly save and restore RT mode state in freewheel mode. Correct freewheel code on client side. Fix AcquireRealTime and DropRealTime: now distinguish when called from another thread (AcquireRealTime/DropRealTime) and from the thread itself (AcquireSelfRealTime/DropSelfRealTime). Correct JackPosixThread::StartImp : thread priority setting now done in the RT case only. Correct JackGraphManager::GetBuffer for the "client loop with one connection" case : buffer must be copied. Correct JackInfoShutdownCallback prototype, two new JackClientProcessFailure and JackClientZombie JackStatus code. Correct JackCoreAudio driver when empty strings are given as -C, -P or -d parameter. Better memory allocation error checking on client (library) side. Better memory allocation error checking in ringbuffer.c, weak import improvements. Memory allocation error checking for jack_client_new and jack_client_open (server and client side). Memory allocation error checking in server for RPC. Simplify server temporary mode : now use a JackTemporaryException. Lock/Unlock shared memory segments (to test...). Sync with JACK1 : -r parameter now used for no-realtime, realtime (-R) is now default, usable backend given vie platform. In JackCoreAudio driver, (possibly) clock drift compensation when needed in aggregated devices. In JackCoreAudio driver, clock drift compensation in aggregated devices working. In JackCoreAudio driver, clock drift compensation semantic changed a bit : when on, does not activate if not needed (same clock domain). Sync JackCoreAudioAdapter code with JackCoreAudioDriver.
1.9.5 : Dynamic choice of maximum port number. More robust sample rate change handling code in JackCoreAudioDriver. Devin Anderson patch for Jack FFADO driver issues with lost MIDI bytes between periods (and more). Fix port_rename callback : now both old name and new name are given as parameters. Special code in JackCoreAudio driver to handle completely buggy Digidesign CoreAudio user-land driver. Ensure that client-side message buffer thread calls thread_init callback if/when it is set by the client (backport of JACK1 rev 3838). Check dynamic port-max value. Fix JackCoreMidiDriver::ReadProcAux when ring buffer is full (thanks Devin Anderson). Josh Green ALSA driver capture only patch. When threads are cancelled, the exception has to be rethrown. Use a QUIT notification to properly quit the server channel, the server channel thread can then be 'stopped' instead of 'canceled'. Mario Lang alsa_io time calculation overflow patch. Shared memory manager was calling abort in case of fatal error, now return an error in caller. Change JackEngineProfiling and JackAudioAdapterInterface gnuplot scripts to output SVG instead of PDF.
This is a work in progress but the implementation is now stable enough to be tested. jackdmp has been used successfully with the following applications : Ardour, Hydrogen, Jamin, Qjackctl, Jack-Rack, SooperLooper, AlsaPlayer...


+ 2
- 5
common/JackAudioDriver.cpp View File

@@ -101,7 +101,6 @@ int JackAudioDriver::Attach()
jack_port_id_t port_index;
char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
unsigned long port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;
int i;

jack_log("JackAudioDriver::Attach fBufferSize = %ld fSampleRate = %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate);
@@ -109,7 +108,7 @@ int JackAudioDriver::Attach()
for (i = 0; i < fCaptureChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", name);
return -1;
}
@@ -120,12 +119,10 @@ int JackAudioDriver::Attach()
jack_log("JackAudioDriver::Attach fCapturePortList[i] port_index = %ld", port_index);
}

port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;

for (i = 0; i < fPlaybackChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", name);
return -1;
}


+ 1
- 1
common/JackClient.cpp View File

@@ -252,7 +252,7 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync,
break;
case kPortRenameCallback:
jack_log("JackClient::kPortRenameCallback port = %ld");
jack_log("JackClient::kPortRenameCallback port = %ld", value1);
if (fPortRename) {
fPortRename(value1, message, GetGraphManager()->GetPort(value1)->GetName(), fPortRenameArg);
}


+ 1
- 1
common/JackConstants.h View File

@@ -24,7 +24,7 @@
#include "config.h"
#endif

#define VERSION "1.9.5"
#define VERSION "1.9.6"

#define BUFFER_SIZE_MAX 8192



+ 4
- 0
common/JackDriver.h View File

@@ -109,6 +109,10 @@ class SERVER_EXPORT JackDriverClientInterface : public JackDriverInterface, publ
/*!
\brief The base class for drivers.
*/
#define CaptureDriverFlags static_cast<JackPortFlags>(JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal | JackPortIsActive)
#define PlaybackDriverFlags static_cast<JackPortFlags>(JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal | JackPortIsActive)
#define MonitorDriverFlags static_cast<JackPortFlags>(JackPortIsOutput | JackPortIsActive)

class SERVER_EXPORT JackDriver : public JackDriverClientInterface
{


+ 76
- 71
common/JackEngine.cpp View File

@@ -35,8 +35,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
namespace Jack
{

#define AssertRefnum(ref) assert(ref >= 0 && ref < CLIENT_NUM);

JackEngine::JackEngine(JackGraphManager* manager,
JackSynchro* table,
JackEngineControl* control)
@@ -213,28 +211,28 @@ void JackEngine::NotifyClient(int refnum, int event, int sync, const char* messa
JackClientInterface* client = fClientTable[refnum];

// The client may be notified by the RT thread while closing
if (!client) {
jack_log("JackEngine::NotifyClient: client not available anymore");
} else if (client->GetClientControl()->fCallback[event]) {
if (client->ClientNotify(refnum, client->GetClientControl()->fName, event, sync, message, value1, value2) < 0)
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);
if (client) {
if (client && client->GetClientControl()->fCallback[event]) {
/*
Important for internal clients : unlock before calling the notification callbacks.
*/
bool res = fMutex.Unlock();
if (client->ClientNotify(refnum, client->GetClientControl()->fName, event, sync, message, value1, value2) < 0)
jack_error("NotifyClient fails name = %s event = %ld val1 = %ld val2 = %ld", client->GetClientControl()->fName, event, value1, value2);
if (res)
fMutex.Lock();
} else {
jack_log("JackEngine::NotifyClient: no callback for event = %ld", event);
}
}
}

void JackEngine::NotifyClients(int event, int sync, const char* message, int value1, int value2)
void JackEngine::NotifyClients(int event, int sync, const char* message, int value1, int value2)
{
for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];
if (client) {
if (client->GetClientControl()->fCallback[event]) {
if (client->ClientNotify(i, client->GetClientControl()->fName, event, sync, message, value1, value2) < 0)
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);
}
}
NotifyClient(i, event, sync, message, value1, value2);
}
}

@@ -274,8 +272,7 @@ void JackEngine::NotifyRemoveClient(const char* name, int refnum)
void JackEngine::NotifyXRun(jack_time_t callback_usecs, float delayed_usecs)
{
// Use the audio thread => request thread communication channel
fEngineControl->ResetFrameTime(callback_usecs);
fEngineControl->NotifyXRun(delayed_usecs);
fEngineControl->NotifyXRun(callback_usecs, delayed_usecs);
fChannel.Notify(ALL_CLIENTS, kXRunCallback, 0);
}

@@ -348,14 +345,9 @@ void JackEngine::NotifyActivate(int refnum)

int JackEngine::GetInternalClientName(int refnum, char* name_res)
{
AssertRefnum(refnum);
JackClientInterface* client = fClientTable[refnum];
if (client) {
strncpy(name_res, client->GetClientControl()->fName, JACK_CLIENT_NAME_SIZE);
return 0;
} else {
return -1;
}
strncpy(name_res, client->GetClientControl()->fName, JACK_CLIENT_NAME_SIZE);
return 0;
}

int JackEngine::InternalClientHandle(const char* client_name, int* status, int* int_ref)
@@ -378,7 +370,6 @@ int JackEngine::InternalClientHandle(const char* client_name, int* status, int*

int JackEngine::InternalClientUnload(int refnum, int* status)
{
AssertRefnum(refnum);
JackClientInterface* client = fClientTable[refnum];
if (client) {
int res = client->Close();
@@ -592,26 +583,19 @@ error:
// Used for external clients
int JackEngine::ClientExternalClose(int refnum)
{
AssertRefnum(refnum);
JackClientInterface* client = fClientTable[refnum];

if (client) {
fEngineControl->fTransport.ResetTimebase(refnum);
int res = ClientCloseAux(refnum, client, true);
client->Close();
delete client;
return res;
} else {
return -1;
}
fEngineControl->fTransport.ResetTimebase(refnum);
int res = ClientCloseAux(refnum, client, true);
client->Close();
delete client;
return res;
}

// Used for server internal clients or drivers when the RT thread is stopped
int JackEngine::ClientInternalClose(int refnum, bool wait)
{
AssertRefnum(refnum);
JackClientInterface* client = fClientTable[refnum];
return (client) ? ClientCloseAux(refnum, client, wait) : -1;
return ClientCloseAux(refnum, client, wait);
}

int JackEngine::ClientCloseAux(int refnum, JackClientInterface* client, bool wait)
@@ -656,11 +640,9 @@ int JackEngine::ClientCloseAux(int refnum, JackClientInterface* client, bool wai

int JackEngine::ClientActivate(int refnum, bool is_real_time)
{
AssertRefnum(refnum);
JackClientInterface* client = fClientTable[refnum];
assert(fClientTable[refnum]);

jack_log("JackEngine::ClientActivate ref = %ld name = %s", refnum, client->GetClientControl()->fName);
if (is_real_time)
fGraphManager->Activate(refnum);

@@ -669,7 +651,30 @@ int JackEngine::ClientActivate(int refnum, bool is_real_time)
jack_error("JackEngine::ClientActivate wait error ref = %ld name = %s", refnum, client->GetClientControl()->fName);
return -1;
} else {
jack_int_t input_ports[PORT_NUM_FOR_CLIENT];
jack_int_t output_ports[PORT_NUM_FOR_CLIENT];
fGraphManager->GetInputPorts(refnum, input_ports);
fGraphManager->GetOutputPorts(refnum, output_ports);
// First add port state to JackPortIsActive
for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (input_ports[i] != EMPTY); i++) {
fGraphManager->ActivatePort(input_ports[i]);
}
for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (output_ports[i] != EMPTY); i++) {
fGraphManager->ActivatePort(output_ports[i]);
}
// Notify client
NotifyActivate(refnum);
// Then issue port registration notification
for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (input_ports[i] != EMPTY); i++) {
NotifyPortRegistation(input_ports[i], true);
}
for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (output_ports[i] != EMPTY); i++) {
NotifyPortRegistation(output_ports[i], true);
}

return 0;
}
}
@@ -677,25 +682,30 @@ int JackEngine::ClientActivate(int refnum, bool is_real_time)
// May be called without client
int JackEngine::ClientDeactivate(int refnum)
{
AssertRefnum(refnum);
JackClientInterface* client = fClientTable[refnum];
if (client == NULL)
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;
jack_int_t input_ports[PORT_NUM_FOR_CLIENT];
jack_int_t output_ports[PORT_NUM_FOR_CLIENT];
fGraphManager->GetInputPorts(refnum, input_ports);
fGraphManager->GetOutputPorts(refnum, output_ports);

fGraphManager->GetInputPorts(refnum, ports);
for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) {
PortDisconnect(refnum, ports[i], ALL_PORTS);
// First disconnect all ports and remove their JackPortIsActive state
for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (input_ports[i] != EMPTY); i++) {
PortDisconnect(refnum, input_ports[i], ALL_PORTS);
fGraphManager->DeactivatePort(input_ports[i]);
}

fGraphManager->GetOutputPorts(refnum, ports);
for (i = 0; (i < PORT_NUM_FOR_CLIENT) && (ports[i] != EMPTY) ; i++) {
PortDisconnect(refnum, ports[i], ALL_PORTS);
for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (output_ports[i] != EMPTY); i++) {
PortDisconnect(refnum, output_ports[i], ALL_PORTS);
fGraphManager->DeactivatePort(output_ports[i]);
}
// Then issue port registration notification
for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (input_ports[i] != EMPTY); i++) {
NotifyPortRegistation(input_ports[i], false);
}
for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (output_ports[i] != EMPTY); i++) {
NotifyPortRegistation(output_ports[i], false);
}

fGraphManager->Deactivate(refnum);
@@ -717,8 +727,7 @@ int JackEngine::ClientDeactivate(int refnum)
int JackEngine::PortRegister(int refnum, const char* name, const char *type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index)
{
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]);
JackClientInterface* client = fClientTable[refnum];

// Check if port name already exists
if (fGraphManager->GetPort(name) != NO_PORT) {
@@ -728,7 +737,8 @@ int JackEngine::PortRegister(int refnum, const char* name, const char *type, uns

*port_index = fGraphManager->AllocatePort(refnum, name, type, (JackPortFlags)flags, fEngineControl->fBufferSize);
if (*port_index != NO_PORT) {
NotifyPortRegistation(*port_index, true);
if (client->GetClientControl()->fActive)
NotifyPortRegistation(*port_index, true);
return 0;
} else {
return -1;
@@ -738,14 +748,14 @@ int JackEngine::PortRegister(int refnum, const char* name, const char *type, uns
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]);
JackClientInterface* client = fClientTable[refnum];

// Disconnect port ==> notification is sent
PortDisconnect(refnum, port_index, ALL_PORTS);

if (fGraphManager->ReleasePort(refnum, port_index) == 0) {
NotifyPortRegistation(port_index, false);
if (client->GetClientControl()->fActive)
NotifyPortRegistation(port_index, false);
return 0;
} else {
return -1;
@@ -755,7 +765,6 @@ int JackEngine::PortUnRegister(int refnum, jack_port_id_t port_index)
int JackEngine::PortConnect(int refnum, const char* src, const char* dst)
{
jack_log("JackEngine::PortConnect src = %s dst = %s", src, dst);
AssertRefnum(refnum);
jack_port_id_t port_src, port_dst;

return (fGraphManager->GetTwoPorts(src, dst, &port_src, &port_dst) < 0)
@@ -766,7 +775,6 @@ int JackEngine::PortConnect(int refnum, const char* src, const char* dst)
int JackEngine::PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
{
jack_log("JackEngine::PortConnect src = %d dst = %d", src, dst);
AssertRefnum(refnum);
JackClientInterface* client;
int ref;

@@ -802,7 +810,6 @@ int JackEngine::PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
int JackEngine::PortDisconnect(int refnum, const char* src, const char* dst)
{
jack_log("JackEngine::PortDisconnect src = %s dst = %s", src, dst);
AssertRefnum(refnum);
jack_port_id_t port_src, port_dst;

return (fGraphManager->GetTwoPorts(src, dst, &port_src, &port_dst) < 0)
@@ -813,8 +820,7 @@ int JackEngine::PortDisconnect(int refnum, const char* src, const char* dst)
int JackEngine::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
{
jack_log("JackEngine::PortDisconnect src = %d dst = %d", src, dst);
AssertRefnum(refnum);

if (dst == ALL_PORTS) {

jack_int_t connections[CONNECTION_NUM_FOR_PORT];
@@ -850,7 +856,6 @@ int JackEngine::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t ds

int JackEngine::PortRename(int refnum, jack_port_id_t port, const char* name)
{
AssertRefnum(refnum);
char old_name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
strcpy(old_name, fGraphManager->GetPort(port)->GetName());
fGraphManager->GetPort(port)->SetName(name);


+ 9
- 1
common/JackEngine.h View File

@@ -23,6 +23,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackConstants.h"
#include "JackGraphManager.h"
#include "JackSynchro.h"
#include "JackMutex.h"
#include "JackTransportEngine.h"
#include "JackPlatformPlug.h"

@@ -37,8 +38,10 @@ class JackExternalClient;
\brief Engine description.
*/

class SERVER_EXPORT JackEngine
class SERVER_EXPORT JackEngine : public JackLockAble
{
friend class JackLockedEngine;
private:

JackGraphManager* fGraphManager;
@@ -71,6 +74,11 @@ class SERVER_EXPORT JackEngine
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);
bool CheckClient(int refnum)
{
return (refnum >= 0 && refnum < CLIENT_NUM && fClientTable[refnum] != NULL);
}

public:



+ 2
- 1
common/JackEngineControl.cpp View File

@@ -81,8 +81,9 @@ void JackEngineControl::ResetRollingUsecs()
fRollingInterval = int(floor((JACK_ENGINE_ROLLING_INTERVAL * 1000.f) / fPeriodUsecs));
}
void JackEngineControl::NotifyXRun(float delayed_usecs)
void JackEngineControl::NotifyXRun(jack_time_t callback_usecs, float delayed_usecs)
{
ResetFrameTime(callback_usecs);
fXrunDelayedUsecs = delayed_usecs;
if (delayed_usecs > fMaxDelayedUsecs)
fMaxDelayedUsecs = delayed_usecs;


+ 1
- 1
common/JackEngineControl.h View File

@@ -162,7 +162,7 @@ struct SERVER_EXPORT JackEngineControl : public JackShmMem
}
// XRun
void NotifyXRun(float delayed_usecs);
void NotifyXRun(jack_time_t callback_usecs, float delayed_usecs);
void ResetXRun()
{
fMaxDelayedUsecs = 0.f;


+ 12
- 0
common/JackGraphManager.cpp View File

@@ -376,6 +376,18 @@ int JackGraphManager::ReleasePort(int refnum, jack_port_id_t port_index)
return res;
}

void JackGraphManager::ActivatePort(jack_port_id_t port_index)
{
JackPort* port = GetPort(port_index);
port->fFlags = (JackPortFlags)(port->fFlags | JackPortIsActive);
}

void JackGraphManager::DeactivatePort(jack_port_id_t port_index)
{
JackPort* port = GetPort(port_index);
port->fFlags = (JackPortFlags)(port->fFlags | ~JackPortIsActive);
}

void JackGraphManager::GetInputPorts(int refnum, jack_int_t* res)
{
JackConnectionManager* manager = WriteNextStateStart();


+ 3
- 1
common/JackGraphManager.h View File

@@ -65,6 +65,8 @@ class SERVER_EXPORT JackGraphManager : public JackShmMem, public JackAtomicState
// Ports management
jack_port_id_t AllocatePort(int refnum, const char* port_name, const char* port_type, JackPortFlags flags, jack_nframes_t buffer_size);
int ReleasePort(int refnum, jack_port_id_t port_index);
void ActivatePort(jack_port_id_t port_index);
void DeactivatePort(jack_port_id_t port_index);
void GetInputPorts(int refnum, jack_int_t* res);
void GetOutputPorts(int refnum, jack_int_t* res);
void RemoveAllPorts(int refnum);
@@ -75,7 +77,7 @@ class SERVER_EXPORT JackGraphManager : public JackShmMem, public JackAtomicState
int ComputeTotalLatency(jack_port_id_t port_index);
int ComputeTotalLatencies();
int RequestMonitor(jack_port_id_t port_index, bool onoff);
// Connections management
int Connect(jack_port_id_t src_index, jack_port_id_t dst_index);
int Disconnect(jack_port_id_t src_index, jack_port_id_t dst_index);


+ 41
- 41
common/JackLockedEngine.h View File

@@ -37,7 +37,6 @@ See : http://groups.google.com/group/comp.programming.threads/browse_thread/thre
catch (...) {
// Assuming thread cancellation, must rethrow
throw;
}
*/

@@ -62,11 +61,12 @@ catch (...) {
throw; \
} \


/*!
\brief Locked Engine, access to methods is serialized using a mutex.
*/

class SERVER_EXPORT JackLockedEngine : public JackLockAble
class SERVER_EXPORT JackLockedEngine
{
private:

@@ -99,21 +99,21 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
int ClientCheck(const char* name, char* name_res, int protocol, int options, int* status)
{
TRY_CALL
JackLock lock(this);
JackLock lock(&fEngine);
return fEngine.ClientCheck(name, name_res, protocol, options, status);
CATCH_EXCEPTION_RETURN
}
int ClientExternalOpen(const char* name, int pid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager)
{
TRY_CALL
JackLock lock(this);
JackLock lock(&fEngine);
return fEngine.ClientExternalOpen(name, pid, ref, shared_engine, shared_client, shared_graph_manager);
CATCH_EXCEPTION_RETURN
}
int ClientInternalOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, bool wait)
{
TRY_CALL
JackLock lock(this);
JackLock lock(&fEngine);
return fEngine.ClientInternalOpen(name, ref, shared_engine, shared_manager, client, wait);
CATCH_EXCEPTION_RETURN
}
@@ -121,30 +121,30 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
int ClientExternalClose(int refnum)
{
TRY_CALL
JackLock lock(this);
return fEngine.ClientExternalClose(refnum);
JackLock lock(&fEngine);
return (fEngine.CheckClient(refnum)) ? fEngine.ClientExternalClose(refnum) : - 1;
CATCH_EXCEPTION_RETURN
}
int ClientInternalClose(int refnum, bool wait)
{
TRY_CALL
JackLock lock(this);
return fEngine.ClientInternalClose(refnum, wait);
JackLock lock(&fEngine);
return (fEngine.CheckClient(refnum)) ? fEngine.ClientInternalClose(refnum, wait) : -1;
CATCH_EXCEPTION_RETURN
}

int ClientActivate(int refnum, bool is_real_time)
{
TRY_CALL
JackLock lock(this);
return fEngine.ClientActivate(refnum, is_real_time);
JackLock lock(&fEngine);
return (fEngine.CheckClient(refnum)) ? fEngine.ClientActivate(refnum, is_real_time) : -1;
CATCH_EXCEPTION_RETURN
}
int ClientDeactivate(int refnum)
{
TRY_CALL
JackLock lock(this);
return fEngine.ClientDeactivate(refnum);
JackLock lock(&fEngine);
return (fEngine.CheckClient(refnum)) ? fEngine.ClientDeactivate(refnum) : -1;
CATCH_EXCEPTION_RETURN
}

@@ -152,21 +152,22 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
int GetInternalClientName(int int_ref, char* name_res)
{
TRY_CALL
JackLock lock(this);
JackLock lock(&fEngine);
return fEngine.GetInternalClientName(int_ref, name_res);
CATCH_EXCEPTION_RETURN
}
int InternalClientHandle(const char* client_name, int* status, int* int_ref)
{
TRY_CALL
JackLock lock(this);
JackLock lock(&fEngine);
return fEngine.InternalClientHandle(client_name, status, int_ref);
CATCH_EXCEPTION_RETURN
}
int InternalClientUnload(int refnum, int* status)
{
TRY_CALL
JackLock lock(this);
JackLock lock(&fEngine);
// Client is tested in fEngine.InternalClientUnload
return fEngine.InternalClientUnload(refnum, status);
CATCH_EXCEPTION_RETURN
}
@@ -175,53 +176,53 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
int PortRegister(int refnum, const char* name, const char *type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port)
{
TRY_CALL
JackLock lock(this);
return fEngine.PortRegister(refnum, name, type, flags, buffer_size, port);
JackLock lock(&fEngine);
return (fEngine.CheckClient(refnum)) ? fEngine.PortRegister(refnum, name, type, flags, buffer_size, port) : -1;
CATCH_EXCEPTION_RETURN
}
int PortUnRegister(int refnum, jack_port_id_t port)
{
TRY_CALL
JackLock lock(this);
return fEngine.PortUnRegister(refnum, port);
JackLock lock(&fEngine);
return (fEngine.CheckClient(refnum)) ? fEngine.PortUnRegister(refnum, port) : -1;
CATCH_EXCEPTION_RETURN
}

int PortConnect(int refnum, const char* src, const char* dst)
{
TRY_CALL
JackLock lock(this);
return fEngine.PortConnect(refnum, src, dst);
JackLock lock(&fEngine);
return (fEngine.CheckClient(refnum)) ? fEngine.PortConnect(refnum, src, dst) : -1;
CATCH_EXCEPTION_RETURN
}
int PortDisconnect(int refnum, const char* src, const char* dst)
{
TRY_CALL
JackLock lock(this);
return fEngine.PortDisconnect(refnum, src, dst);
JackLock lock(&fEngine);
return (fEngine.CheckClient(refnum)) ? fEngine.PortDisconnect(refnum, src, dst) : -1;
CATCH_EXCEPTION_RETURN
}

int PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
{
TRY_CALL
JackLock lock(this);
return fEngine.PortConnect(refnum, src, dst);
JackLock lock(&fEngine);
return (fEngine.CheckClient(refnum)) ? fEngine.PortConnect(refnum, src, dst) : -1;
CATCH_EXCEPTION_RETURN
}
int PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst)
{
TRY_CALL
JackLock lock(this);
return fEngine.PortDisconnect(refnum, src, dst);
JackLock lock(&fEngine);
return (fEngine.CheckClient(refnum)) ? fEngine.PortDisconnect(refnum, src, dst) : -1;
CATCH_EXCEPTION_RETURN
}

int PortRename(int refnum, jack_port_id_t port, const char* name)
{
TRY_CALL
JackLock lock(this);
return fEngine.PortRename(refnum, port, name);
JackLock lock(&fEngine);
return (fEngine.CheckClient(refnum)) ? fEngine.PortRename(refnum, port, name) : -1;
CATCH_EXCEPTION_RETURN
}

@@ -241,36 +242,35 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble

void NotifyXRun(int refnum)
{
TRY_CALL
JackLock lock(this);
// RT : no lock
fEngine.NotifyXRun(refnum);
CATCH_EXCEPTION
}
void NotifyGraphReorder()
{
TRY_CALL
JackLock lock(this);
JackLock lock(&fEngine);
fEngine.NotifyGraphReorder();
CATCH_EXCEPTION
}
void NotifyBufferSize(jack_nframes_t buffer_size)
{
TRY_CALL
JackLock lock(this);
JackLock lock(&fEngine);
fEngine.NotifyBufferSize(buffer_size);
CATCH_EXCEPTION
}
void NotifySampleRate(jack_nframes_t sample_rate)
{
TRY_CALL
JackLock lock(this);
JackLock lock(&fEngine);
fEngine.NotifySampleRate(sample_rate);
CATCH_EXCEPTION
}
void NotifyFreewheel(bool onoff)
{
TRY_CALL
JackLock lock(this);
JackLock lock(&fEngine);
fEngine.NotifyFreewheel(onoff);
CATCH_EXCEPTION
}
@@ -278,7 +278,7 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
void NotifyFailure(int code, const char* reason)
{
TRY_CALL
JackLock lock(this);
JackLock lock(&fEngine);
fEngine.NotifyFailure(code, reason);
CATCH_EXCEPTION
}
@@ -286,7 +286,7 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
int GetClientPID(const char* name)
{
TRY_CALL
JackLock lock(this);
JackLock lock(&fEngine);
return fEngine.GetClientPID(name);
CATCH_EXCEPTION_RETURN
}
@@ -294,7 +294,7 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
int GetClientRefNum(const char* name)
{
TRY_CALL
JackLock lock(this);
JackLock lock(&fEngine);
return fEngine.GetClientRefNum(name);
CATCH_EXCEPTION_RETURN
}
@@ -302,7 +302,7 @@ class SERVER_EXPORT JackLockedEngine : public JackLockAble
void NotifyQuit()
{
TRY_CALL
JackLock lock(this);
JackLock lock(&fEngine);
return fEngine.NotifyQuit();
CATCH_EXCEPTION
}


+ 2
- 5
common/JackMidiDriver.cpp View File

@@ -74,7 +74,6 @@ int JackMidiDriver::Attach()
jack_port_id_t port_index;
char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
unsigned long port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;
int i;

jack_log("JackMidiDriver::Attach fBufferSize = %ld fSampleRate = %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate);
@@ -82,7 +81,7 @@ int JackMidiDriver::Attach()
for (i = 0; i < fCaptureChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:%s:out%d", fAliasName, fCaptureDriverName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", name);
return -1;
}
@@ -92,12 +91,10 @@ int JackMidiDriver::Attach()
jack_log("JackMidiDriver::Attach fCapturePortList[i] port_index = %ld", port_index);
}

port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;

for (i = 0; i < fPlaybackChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:%s:in%d", fAliasName, fPlaybackDriverName, i + 1);
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", name);
return -1;
}


+ 2
- 4
common/JackMutex.h View File

@@ -36,11 +36,9 @@ namespace Jack
class JackLockAble
{

private:

JackMutex fMutex;

protected:
JackMutex fMutex;

JackLockAble()
{}


+ 4
- 10
common/JackNetOneDriver.cpp View File

@@ -138,19 +138,15 @@ namespace Jack
jack_port_id_t port_id;
char buf[64];
unsigned int chn;
int port_flags;


//if (netj.handle_transport_sync)
// jack_set_sync_callback(netj.client, (JackSyncCallback) net_driver_sync_cb, NULL);

port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;

for (chn = 0; chn < netj.capture_channels_audio; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:capture_%u", chn + 1);

if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE,
static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT )
CaptureDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT )
{
jack_error ( "driver: cannot register port for %s", buf );
return -1;
@@ -184,7 +180,7 @@ namespace Jack
snprintf (buf, sizeof(buf) - 1, "system:capture_%u", chn + 1);

if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_MIDI_TYPE,
static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT )
CaptureDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT )
{
jack_error ( "driver: cannot register port for %s", buf );
return -1;
@@ -195,13 +191,11 @@ namespace Jack
jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id);
}

port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;

for (chn = 0; chn < netj.playback_channels_audio; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:playback_%u", chn + 1);

if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE,
static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT )
PlaybackDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT )
{
jack_error ( "driver: cannot register port for %s", buf );
return -1;
@@ -231,7 +225,7 @@ namespace Jack
snprintf (buf, sizeof(buf) - 1, "system:playback_%u", chn + 1);

if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_MIDI_TYPE,
static_cast<JackPortFlags> ( port_flags ), fEngineControl->fBufferSize ) ) == NO_PORT )
PlaybackDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT )
{
jack_error ( "driver: cannot register port for %s", buf );
return -1;


+ 9
- 1
common/jack/types.h View File

@@ -295,7 +295,15 @@ enum JackPortFlags {
* systems are examples of clients that would set this flag for
* their ports.
*/
JackPortIsTerminal = 0x10
JackPortIsTerminal = 0x10,
/**
* JackPortIsActive means the port has been registered and the
* client is "active", that is jack_activate has been called
*
* JackPortIsActive is on between jack_activate and jack_deactivate.
*/
JackPortIsActive = 0x20
};

/**


+ 5
- 3
common/jack/weakmacros.h View File

@@ -42,7 +42,8 @@
*/
#define JACK_WEAK_EXPORT __attribute__((weak))
#else
/* Add other things here for non-gcc platforms */
/* Add other things here for non-gcc platforms */
#define JACK_WEAK_EXPORT
#endif
#endif

@@ -53,8 +54,9 @@
#ifndef JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT
#ifdef __GNUC__
#define JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT __attribute__((__deprecated__))
#else
/* Add other things here for non-gcc platforms */
#else
/* Add other things here for non-gcc platforms */
#define JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT
#endif /* __GNUC__ */
#endif



+ 1
- 1
doxyfile View File

@@ -23,7 +23,7 @@ PROJECT_NAME = "Jack2"
# This could be handy for archiving the generated documentation or
# if some version control system is used.

PROJECT_NUMBER = 1.9.5
PROJECT_NUMBER = 1.9.6

# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.


+ 6
- 0
example-clients/lsp.c View File

@@ -208,6 +208,12 @@ main (int argc, char *argv[])
if (flags & JackPortIsTerminal) {
fputs ("terminal,", stdout);
}
if (flags & JackPortIsActive) {
fputs ("active,", stdout);
} else {
fputs ("non-active,", stdout);
}
putc ('\n', stdout);
}
}


+ 3
- 3
linux/alsa/JackAlsaDriver.cpp View File

@@ -2087,7 +2087,7 @@ int JackAlsaDriver::Attach()
assert(fCaptureChannels < DRIVER_PORT_NUM);
assert(fPlaybackChannels < DRIVER_PORT_NUM);

port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;
port_flags = (unsigned long)CaptureDriverFlags;

alsa_driver_t* alsa_driver = (alsa_driver_t*)fDriver;

@@ -2114,7 +2114,7 @@ int JackAlsaDriver::Attach()
jack_log("JackAudioDriver::Attach fCapturePortList[i] %ld ", port_index);
}

port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;
port_flags = (unsigned long)PlaybackDriverFlags;

for (int i = 0; i < fPlaybackChannels; i++) {
snprintf(alias, sizeof(alias) - 1, "%s:playback_%u", fAliasName, i + 1);
@@ -2135,7 +2135,7 @@ int JackAlsaDriver::Attach()
if (fWithMonitorPorts) {
jack_log("Create monitor port ");
snprintf(name, sizeof(name) - 1, "%s:monitor_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) {
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, MonitorDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error ("ALSA: cannot register monitor port for %s", name);
} else {
port = fGraphManager->GetPort(port_index);


+ 1
- 1
linux/alsa/alsa_rawmidi.c View File

@@ -432,7 +432,7 @@ inline int midi_port_open_jack(alsa_rawmidi_t *midi, midi_port_t *port, int type
snprintf(name, sizeof(name) - 1, "system:midi_playback_%d", ++midi->midi_out_cnt);

port->jack = jack_port_register(midi->client, name, JACK_DEFAULT_MIDI_TYPE,
type | JackPortIsPhysical|JackPortIsTerminal, 0);
type | JackPortIsPhysical | JackPortIsTerminal | JackPortIsActive, 0);
if (port->jack)
jack_port_set_alias(port->jack, alias);


+ 1
- 1
linux/alsa/alsa_seqmidi.c View File

@@ -488,7 +488,7 @@ port_t* port_create(alsa_seqmidi_t *self, int type, snd_seq_addr_t addr, const s
/* mark anything that looks like a hardware port as physical&terminal */

if (snd_seq_port_info_get_type (info) & (SND_SEQ_PORT_TYPE_HARDWARE|SND_SEQ_PORT_TYPE_PORT|SND_SEQ_PORT_TYPE_SPECIFIC)) {
jack_caps |= (JackPortIsPhysical|JackPortIsTerminal);
jack_caps |= (JackPortIsPhysical | JackPortIsTerminal | JackPortIsActive);
}

if (jack_caps & JackPortIsOutput)


+ 14
- 14
linux/firewire/JackFFADODriver.cpp View File

@@ -359,8 +359,6 @@ int JackFFADODriver::Attach()
{
JackPort* port;
int port_index;
unsigned long port_flags;

char buf[JACK_PORT_NAME_SIZE];
char portname[JACK_PORT_NAME_SIZE];

@@ -418,8 +416,6 @@ int JackFFADODriver::Attach()
/* ports */

// capture
port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;

driver->capture_nchannels = ffado_streaming_get_nb_capture_streams(driver->dev);
driver->capture_channels = (ffado_capture_channel_t *)calloc(driver->capture_nchannels, sizeof(ffado_capture_channel_t));
if (driver->capture_channels == NULL) {
@@ -433,11 +429,11 @@ int JackFFADODriver::Attach()

driver->capture_channels[chn].stream_type = ffado_streaming_get_capture_stream_type(driver->dev, chn);
if (driver->capture_channels[chn].stream_type == ffado_stream_type_audio) {
snprintf(buf, sizeof(buf) - 1, "%s:AC%d_%s", fClientControl.fName, (int)chn, portname);
snprintf(buf, sizeof(buf) - 1, "%s:%s", fClientControl.fName, portname);
printMessage ("Registering audio capture port %s", buf);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
JACK_DEFAULT_AUDIO_TYPE,
(JackPortFlags)port_flags,
CaptureDriverFlags,
fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", buf);
return -1;
@@ -451,16 +447,19 @@ int JackFFADODriver::Attach()

port = fGraphManager->GetPort(port_index);
port->SetLatency(driver->period_size + driver->capture_frame_latency);
// capture port aliases (jackd1 style port names)
snprintf(buf, sizeof(buf) - 1, "%s:capture_%i", fClientControl.fName, (int) chn + 1);
port->SetAlias(buf);
fCapturePortList[chn] = port_index;
jack_log("JackFFADODriver::Attach fCapturePortList[i] %ld ", port_index);
fCaptureChannels++;

} else if (driver->capture_channels[chn].stream_type == ffado_stream_type_midi) {
snprintf(buf, sizeof(buf) - 1, "%s:MC%d_%s", fClientControl.fName, (int)chn, portname);
snprintf(buf, sizeof(buf) - 1, "%s:%s", fClientControl.fName, portname);
printMessage ("Registering midi capture port %s", buf);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
JACK_DEFAULT_MIDI_TYPE,
(JackPortFlags)port_flags,
CaptureDriverFlags,
fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", buf);
return -1;
@@ -489,8 +488,6 @@ int JackFFADODriver::Attach()
}

// playback
port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;

driver->playback_nchannels = ffado_streaming_get_nb_playback_streams(driver->dev);
driver->playback_channels = (ffado_playback_channel_t *)calloc(driver->playback_nchannels, sizeof(ffado_playback_channel_t));
if (driver->playback_channels == NULL) {
@@ -505,11 +502,11 @@ int JackFFADODriver::Attach()
driver->playback_channels[chn].stream_type = ffado_streaming_get_playback_stream_type(driver->dev, chn);

if (driver->playback_channels[chn].stream_type == ffado_stream_type_audio) {
snprintf(buf, sizeof(buf) - 1, "%s:AP%d_%s", fClientControl.fName, (int)chn, portname);
snprintf(buf, sizeof(buf) - 1, "%s:%s", fClientControl.fName, portname);
printMessage ("Registering audio playback port %s", buf);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
JACK_DEFAULT_AUDIO_TYPE,
(JackPortFlags)port_flags,
PlaybackDriverFlags,
fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", buf);
return -1;
@@ -526,15 +523,18 @@ int JackFFADODriver::Attach()
port = fGraphManager->GetPort(port_index);
// Add one buffer more latency if "async" mode is used...
port->SetLatency((driver->period_size * (driver->device_options.nb_buffers - 1)) + ((fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize) + driver->playback_frame_latency);
// playback port aliases (jackd1 style port names)
snprintf(buf, sizeof(buf) - 1, "%s:playback_%i", fClientControl.fName, (int) chn + 1);
port->SetAlias(buf);
fPlaybackPortList[chn] = port_index;
jack_log("JackFFADODriver::Attach fPlaybackPortList[i] %ld ", port_index);
fPlaybackChannels++;
} else if (driver->playback_channels[chn].stream_type == ffado_stream_type_midi) {
snprintf(buf, sizeof(buf) - 1, "%s:MP%d_%s", fClientControl.fName, (int)chn, portname);
snprintf(buf, sizeof(buf) - 1, "%s:%s", fClientControl.fName, portname);
printMessage ("Registering midi playback port %s", buf);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
JACK_DEFAULT_MIDI_TYPE,
(JackPortFlags)port_flags,
PlaybackDriverFlags,
fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", buf);
return -1;


+ 3
- 8
linux/freebob/JackFreebobDriver.cpp View File

@@ -667,8 +667,7 @@ int JackFreebobDriver::Attach()
{
JackPort* port;
int port_index;
unsigned long port_flags;

char buf[JACK_PORT_NAME_SIZE];
char portname[JACK_PORT_NAME_SIZE];

@@ -717,8 +716,6 @@ int JackFreebobDriver::Attach()
/* ports */

// capture
port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;

driver->capture_nchannels = freebob_streaming_get_nb_capture_streams(driver->dev);
driver->capture_nchannels_audio = 0;

@@ -734,7 +731,7 @@ int JackFreebobDriver::Attach()

if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
JACK_DEFAULT_AUDIO_TYPE,
(JackPortFlags)port_flags,
CaptureDriverFlags,
fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", buf);
return -1;
@@ -748,8 +745,6 @@ int JackFreebobDriver::Attach()
}

// playback
port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;

driver->playback_nchannels = freebob_streaming_get_nb_playback_streams(driver->dev);
driver->playback_nchannels_audio = 0;

@@ -764,7 +759,7 @@ int JackFreebobDriver::Attach()
printMessage ("Registering playback port %s", buf);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, buf,
JACK_DEFAULT_AUDIO_TYPE,
(JackPortFlags)port_flags,
PlaybackDriverFlags,
fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", buf);
return -1;


+ 2
- 2
macosx/Jack-Info.plist View File

@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>Jackservermp</string>
<key>CFBundleGetInfoString</key>
<string>Jackdmp 1.9.5, @03-09 Paul Davis, Grame</string>
<string>Jackdmp 1.9.6, @03-10 Paul Davis, Grame</string>
<key>CFBundleIdentifier</key>
<string>com.grame.Jackmp</string>
<key>CFBundleInfoDictionaryVersion</key>
@@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.9.5</string>
<string>1.9.6</string>
</dict>
</plist>

+ 28
- 0
macosx/Jackdmp.xcodeproj/project.pbxproj View File

@@ -580,6 +580,18 @@
4B80D7EB0BA0D17400F035BB /* JackMidiPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B80D7E50BA0D17400F035BB /* JackMidiPort.h */; };
4B80D7EC0BA0D17400F035BB /* JackMidiPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E60BA0D17400F035BB /* JackMidiPort.cpp */; };
4B80D7ED0BA0D17400F035BB /* JackMidiAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E70BA0D17400F035BB /* JackMidiAPI.cpp */; };
4B88D03B11298BEE007A87C1 /* weakjack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B88D03911298BEE007A87C1 /* weakjack.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B88D03C11298BEE007A87C1 /* weakmacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B88D03A11298BEE007A87C1 /* weakmacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B88D03D11298BEE007A87C1 /* weakjack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B88D03911298BEE007A87C1 /* weakjack.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B88D03E11298BEE007A87C1 /* weakmacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B88D03A11298BEE007A87C1 /* weakmacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B88D03F11298BEE007A87C1 /* weakjack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B88D03911298BEE007A87C1 /* weakjack.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B88D04011298BEE007A87C1 /* weakmacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B88D03A11298BEE007A87C1 /* weakmacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B88D04111298BEE007A87C1 /* weakjack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B88D03911298BEE007A87C1 /* weakjack.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B88D04211298BEE007A87C1 /* weakmacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B88D03A11298BEE007A87C1 /* weakmacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B88D04311298BEE007A87C1 /* weakjack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B88D03911298BEE007A87C1 /* weakjack.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B88D04411298BEE007A87C1 /* weakmacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B88D03A11298BEE007A87C1 /* weakmacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B88D04511298BEE007A87C1 /* weakjack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B88D03911298BEE007A87C1 /* weakjack.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B88D04611298BEE007A87C1 /* weakmacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B88D03A11298BEE007A87C1 /* weakmacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B93F1990E87992100E4ECCD /* JackPosixThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6A20E703B2E0066E42F /* JackPosixThread.cpp */; };
4B93F19A0E87992200E4ECCD /* JackPosixThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */; };
4B93F19C0E87998200E4ECCD /* JackPosixServerLaunch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBBA0E878B9C003D2374 /* JackPosixServerLaunch.cpp */; };
@@ -1567,6 +1579,8 @@
4B869B3D08C8D21C001CF041 /* driver_interface.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = driver_interface.h; path = ../common/driver_interface.h; sourceTree = SOURCE_ROOT; };
4B869B4208C8D22F001CF041 /* JackDriverLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackDriverLoader.h; path = ../common/JackDriverLoader.h; sourceTree = SOURCE_ROOT; };
4B869D7F08C9CB00001CF041 /* JackDriverLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackDriverLoader.cpp; path = ../common/JackDriverLoader.cpp; sourceTree = SOURCE_ROOT; };
4B88D03911298BEE007A87C1 /* weakjack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = weakjack.h; path = ../common/jack/weakjack.h; sourceTree = SOURCE_ROOT; };
4B88D03A11298BEE007A87C1 /* weakmacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = weakmacros.h; path = ../common/jack/weakmacros.h; sourceTree = SOURCE_ROOT; };
4B89B759076B731100D170DE /* JackRPCClientUser.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = JackRPCClientUser.c; path = RPC/JackRPCClientUser.c; sourceTree = SOURCE_ROOT; };
4B89B769076B74D200D170DE /* JackRPCEngineUser.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = JackRPCEngineUser.c; path = RPC/JackRPCEngineUser.c; sourceTree = SOURCE_ROOT; };
4B940B9B06DDDE5B00D77F60 /* AudioHardware.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AudioHardware.h; path = /System/Library/Frameworks/CoreAudio.framework/Versions/A/Headers/AudioHardware.h; sourceTree = "<absolute>"; };
@@ -2711,6 +2725,8 @@
4B6C737D0CC60A6D001AFFD4 /* thread.h */,
4B6C737E0CC60A6D001AFFD4 /* transport.h */,
4B6C737F0CC60A6D001AFFD4 /* types.h */,
4B88D03911298BEE007A87C1 /* weakjack.h */,
4B88D03A11298BEE007A87C1 /* weakmacros.h */,
);
name = jack;
path = ../common/jack;
@@ -3159,6 +3175,8 @@
4B4F9C910DC20C0400706CB0 /* JackMessageBuffer.h in Headers */,
4B93F19E0E87998400E4ECCD /* JackPosixThread.h in Headers */,
4BECB2FA0F4451C10091B70A /* JackProcessSync.h in Headers */,
4B88D03F11298BEE007A87C1 /* weakjack.h in Headers */,
4B88D04011298BEE007A87C1 /* weakmacros.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3227,6 +3245,8 @@
4BDCDC0A1001FDA800B15929 /* JackArgParser.h in Headers */,
4BCBCE6210C4FE3F00450FFE /* JackPhysicalMidiInput.h in Headers */,
4BCBCE6410C4FE3F00450FFE /* JackPhysicalMidiOutput.h in Headers */,
4B88D04311298BEE007A87C1 /* weakjack.h in Headers */,
4B88D04411298BEE007A87C1 /* weakmacros.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3507,6 +3527,8 @@
4B47ACA910B5890100469C67 /* JackMessageBuffer.h in Headers */,
4B47ACAA10B5890100469C67 /* JackPosixThread.h in Headers */,
4B47ACAB10B5890100469C67 /* JackProcessSync.h in Headers */,
4B88D04111298BEE007A87C1 /* weakjack.h in Headers */,
4B88D04211298BEE007A87C1 /* weakmacros.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3592,6 +3614,8 @@
4BC3B6A50E703B2E0066E42F /* JackPosixThread.h in Headers */,
4BECB2F80F4451C10091B70A /* JackProcessSync.h in Headers */,
4B94334A10A5E666002A187F /* systemdeps.h in Headers */,
4B88D03B11298BEE007A87C1 /* weakjack.h in Headers */,
4B88D03C11298BEE007A87C1 /* weakmacros.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3664,6 +3688,8 @@
4B94334B10A5E666002A187F /* systemdeps.h in Headers */,
4BCBCE5E10C4FE3F00450FFE /* JackPhysicalMidiInput.h in Headers */,
4BCBCE6010C4FE3F00450FFE /* JackPhysicalMidiOutput.h in Headers */,
4B88D03D11298BEE007A87C1 /* weakjack.h in Headers */,
4B88D03E11298BEE007A87C1 /* weakmacros.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3841,6 +3867,8 @@
4BA3396F10B2E36800190E3B /* JackArgParser.h in Headers */,
4BCBCE6610C4FE3F00450FFE /* JackPhysicalMidiInput.h in Headers */,
4BCBCE6810C4FE3F00450FFE /* JackPhysicalMidiOutput.h in Headers */,
4B88D04511298BEE007A87C1 /* weakjack.h in Headers */,
4B88D04611298BEE007A87C1 /* weakmacros.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};


+ 4
- 7
macosx/coreaudio/JackCoreAudioDriver.cpp View File

@@ -1560,8 +1560,7 @@ int JackCoreAudioDriver::Attach()
char channel_name[64];
char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
unsigned long port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;

jack_log("JackCoreAudioDriver::Attach fBufferSize %ld fSampleRate %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate);

for (int i = 0; i < fCaptureChannels; i++) {
@@ -1580,7 +1579,7 @@ int JackCoreAudioDriver::Attach()

snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);

if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("Cannot register port for %s", name);
return -1;
}
@@ -1601,8 +1600,6 @@ int JackCoreAudioDriver::Attach()
fCapturePortList[i] = port_index;
}

port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;

for (int i = 0; i < fPlaybackChannels; i++) {

err = AudioDeviceGetPropertyInfo(fDeviceID, i + 1, false, kAudioDevicePropertyChannelName, &size, &isWritable);
@@ -1619,7 +1616,7 @@ int JackCoreAudioDriver::Attach()

snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);

if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("Cannot register port for %s", name);
return -1;
}
@@ -1644,7 +1641,7 @@ int JackCoreAudioDriver::Attach()
if (fWithMonitorPorts) {
jack_log("Create monitor port ");
snprintf(name, sizeof(name) - 1, "%s:monitor_%u", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) {
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, MonitorDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("Cannot register monitor port for %s", name);
return -1;
} else {


+ 2
- 5
macosx/coremidi/JackCoreMidiDriver.cpp View File

@@ -222,7 +222,6 @@ int JackCoreMidiDriver::Attach()
char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
char endpoint_name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
char alias[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
unsigned long port_flags = JackPortIsOutput | JackPortIsPhysical | JackPortIsTerminal;
int i;

jack_log("JackCoreMidiDriver::Attach fBufferSize = %ld fSampleRate = %ld", fEngineControl->fBufferSize, fEngineControl->fSampleRate);
@@ -239,7 +238,7 @@ int JackCoreMidiDriver::Attach()
}
snprintf(name, sizeof(name) - 1, "%s:capture_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, CaptureDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", name);
return -1;
}
@@ -249,8 +248,6 @@ int JackCoreMidiDriver::Attach()
jack_log("JackCoreMidiDriver::Attach fCapturePortList[i] port_index = %ld", port_index);
}

port_flags = JackPortIsInput | JackPortIsPhysical | JackPortIsTerminal;

for (i = 0; i < fPlaybackChannels; i++) {
err = MIDIObjectGetStringProperty(fMidiSource[i], kMIDIPropertyName, &pname);
@@ -263,7 +260,7 @@ int JackCoreMidiDriver::Attach()
}
snprintf(name, sizeof(name) - 1, "%s:playback_%d", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, (JackPortFlags)port_flags, fEngineControl->fBufferSize)) == NO_PORT) {
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_MIDI_TYPE, PlaybackDriverFlags, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("driver: cannot register port for %s", name);
return -1;
}


+ 7
- 0
posix/JackNetUnixSocket.cpp View File

@@ -99,6 +99,13 @@ namespace Jack
Reset();
}
fSockfd = socket ( AF_INET, SOCK_DGRAM, 0 );
/* Enable address reuse */
int res, on = 1;
if ((res = setsockopt( fSockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))) < 0) {
StrError(NET_ERROR_CODE);
}
return fSockfd;
}



+ 4
- 2
posix/JackPosixMutex.h View File

@@ -103,11 +103,12 @@ class JackPosixMutex
pthread_mutex_destroy(&fMutex);
}

void Lock()
bool Lock()
{
int res = pthread_mutex_lock(&fMutex);
if (res != 0)
jack_error("JackPosixMutex::Lock res = %d", res);
return (res == 0);
}

bool Trylock()
@@ -115,11 +116,12 @@ class JackPosixMutex
return (pthread_mutex_trylock(&fMutex) == 0);
}

void Unlock()
bool Unlock()
{
int res = pthread_mutex_unlock(&fMutex);
if (res != 0)
jack_error("JackPosixMutex::Unlock res = %d", res);
return (res == 0);
}

};


+ 29
- 2
tests/test.cpp View File

@@ -183,7 +183,7 @@ void Jack_Client_Registration_Callback(const char* name, int val, void *arg)

int Jack_Port_Rename_Callback(jack_port_id_t port, const char* old_name, const char* new_name, void *arg)
{
Log("Rename callback has been successfully called with old_name '%s' and new_name '%s'. (msg from callback)\n");
Log("Rename callback has been successfully called with old_name '%s' and new_name '%s'. (msg from callback)\n", old_name, new_name);
port_rename_clbk = 1;
return 0;
}
@@ -822,6 +822,8 @@ int main (int argc, char *argv[])
printf("error : port_set_name function can't be tested...\n");
}

port_callback_reg = 0; // number of port registration received by the callback
/**
* Activate the client
*
@@ -840,6 +842,20 @@ int main (int argc, char *argv[])

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);

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.
@@ -1095,11 +1111,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, k);
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 {
@@ -1147,6 +1166,7 @@ int main (int argc, char *argv[])
* Deregister all ports previously created.
*
*/
port_callback_reg = 0; // to check registration callback
Log("Deregistering all ports of the client...\n");
inports = jack_get_ports(client1, NULL, NULL, 0);
a = 0;
@@ -1160,6 +1180,13 @@ int main (int argc, char *argv[])
}
a++;
}
// Check port registration callback again
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);
}

free(inports); // free array of ports (as mentionned in the doc of jack_get_ports)



+ 5
- 5
windows/JackRouter/resource.rc View File

@@ -28,8 +28,8 @@ LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,2,0,0
PRODUCTVERSION 0,2,0,0
FILEVERSION 0,2,1,0
PRODUCTVERSION 0,2,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -47,14 +47,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Grame\0"
VALUE "FileDescription", "JackRouter ASIO driver\0"
VALUE "FileVersion", "0, 2, 0, 0\0"
VALUE "FileVersion", "0, 2, 1, 0\0"
VALUE "InternalName", "JackRouter\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2010\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "JackRouter.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "JackRouter\0"
VALUE "ProductVersion", "0, 2, 0, 0\0"
VALUE "ProductVersion", "0, 2, 1, 0\0"
VALUE "SpecialBuild", "\0"
END
END


+ 5
- 5
windows/JackWinMutex.h View File

@@ -43,15 +43,15 @@ class JackWinMutex
// In recursive mode by default
fMutex = (HANDLE)CreateMutex(0, FALSE, 0);
}
virtual ~JackWinMutex()
{
CloseHandle(fMutex);
}

void Lock()
bool Lock()
{
WaitForSingleObject(fMutex, INFINITE);
return (WAIT_OBJECT_0 == WaitForSingleObject(fMutex, INFINITE));
}

bool Trylock()
@@ -59,9 +59,9 @@ class JackWinMutex
return (WAIT_OBJECT_0 == WaitForSingleObject(fMutex, 0));
}

void Unlock()
bool Unlock()
{
ReleaseMutex(fMutex);
return(ReleaseMutex(fMutex) != 0);
}

};


BIN
windows/Setup/JackRouter.dll View File


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

@@ -1,9 +1,9 @@
<*project
version = 4 civer = "Free v4.14.5" winver = "2.6/5.1.2600" >
<output> .</>
<exename> Jack_v1.9.5_setup.exe</>
<exename> Jack_v1.9.6_setup.exe</>
<digitsign> </>
<appname> Jack v1.9.5</>
<appname> Jack v1.9.6</>
<password> </>
<addlang> </>
<icon> Default - 2</>
@@ -92,6 +92,8 @@
<_><src>..\..\common\jack\transport.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
<_><src>..\..\common\jack\types.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>0</></>
<_><src>..\..\common\jack\systemdeps.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>1</></>
<_><src>..\..\common\jack\weakjack.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>1</></>
<_><src>..\..\common\jack\weakmacros.h</><dest>inst</><custom>includes\jack</><ifexist>overnewer</><recurs>1</></>
<_><src>.\JackRouter.dll</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
<_><src>.\JackRouter.ini</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>
<_><src>.\qjackctl\mingwm10.dll</><dest>inst</><custom></><ifexist>overnewer</><recurs>0</></>


+ 5
- 5
windows/jackaudioadapter.rc View File

@@ -11,8 +11,8 @@
//
LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
1 VERSIONINFO
FILEVERSION 1,9,5,0
PRODUCTVERSION 1,9,5,0
FILEVERSION 1,9,6,0
PRODUCTVERSION 1,9,6,0
FILEOS VOS_UNKNOWN
FILETYPE VFT_DLL
BEGIN
@@ -23,14 +23,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Grame\0"
VALUE "FileDescription", "Jackmp Audio Adapter for Windows\0"
VALUE "FileVersion", "1, 9, 5, 0\0"
VALUE "FileVersion", "1, 9, 6, 0\0"
VALUE "InternalName", "audioadapter\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2010\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "audioadapter.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "audioadapter\0"
VALUE "ProductVersion", "1, 9, 5, 0\0"
VALUE "ProductVersion", "1, 9, 6, 0\0"
VALUE "SpecialBuild", "\0"
END
END


+ 5
- 5
windows/jackd.rc View File

@@ -11,8 +11,8 @@
//
LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
1 VERSIONINFO
FILEVERSION 1,9,5,0
PRODUCTVERSION 1,9,5,0
FILEVERSION 1,9,6,0
PRODUCTVERSION 1,9,6,0
FILEOS VOS_UNKNOWN
FILETYPE VFT_APP
BEGIN
@@ -23,14 +23,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Grame\0"
VALUE "FileDescription", "Jack server for Windows\0"
VALUE "FileVersion", "1, 9, 5, 0\0"
VALUE "FileVersion", "1, 9, 6, 0\0"
VALUE "InternalName", "jackd\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2010\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "jackd.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "jackd\0"
VALUE "ProductVersion", "1, 9, 5, 0\0"
VALUE "ProductVersion", "1, 9, 6, 0\0"
VALUE "SpecialBuild", "\0"
END
END


+ 5
- 5
windows/jacknetadapter.rc View File

@@ -11,8 +11,8 @@
//
LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
1 VERSIONINFO
FILEVERSION 1,9,5,0
PRODUCTVERSION 1,9,5,0
FILEVERSION 1,9,6,0
PRODUCTVERSION 1,9,6,0
FILEOS VOS_UNKNOWN
FILETYPE VFT_DLL
BEGIN
@@ -23,14 +23,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Grame\0"
VALUE "FileDescription", "Jackmp Net Adapter for Windows\0"
VALUE "FileVersion", "1, 9, 5, 0\0"
VALUE "FileVersion", "1, 9, 6, 0\0"
VALUE "InternalName", "netadapter\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2010\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "netadapter.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "netadapter\0"
VALUE "ProductVersion", "1, 9, 5, 0\0"
VALUE "ProductVersion", "1, 9, 6, 0\0"
VALUE "SpecialBuild", "\0"
END
END


+ 5
- 5
windows/jacknetdriver.rc View File

@@ -11,8 +11,8 @@
//
LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
1 VERSIONINFO
FILEVERSION 1,9,5,0
PRODUCTVERSION 1,9,5,0
FILEVERSION 1,9,6,0
PRODUCTVERSION 1,9,6,0
FILEOS VOS_UNKNOWN
FILETYPE VFT_DLL
BEGIN
@@ -23,14 +23,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Grame\0"
VALUE "FileDescription", "Jackmp Net Driver for Windows\0"
VALUE "FileVersion", "1, 9, 5, 0\0"
VALUE "FileVersion", "1, 9, 6, 0\0"
VALUE "InternalName", "jack_netdriver\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2010\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "jack_netdriver.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "jack_netdriver\0"
VALUE "ProductVersion", "1, 9, 5, 0\0"
VALUE "ProductVersion", "1, 9, 6, 0\0"
VALUE "SpecialBuild", "\0"
END
END


+ 5
- 5
windows/jacknetmanager.rc View File

@@ -11,8 +11,8 @@
//
LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
1 VERSIONINFO
FILEVERSION 1,9,5,0
PRODUCTVERSION 1,9,5,0
FILEVERSION 1,9,6,0
PRODUCTVERSION 1,9,6,0
FILEOS VOS_UNKNOWN
FILETYPE VFT_DLL
BEGIN
@@ -23,14 +23,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Grame\0"
VALUE "FileDescription", "Jackmp Net Manager for Windows\0"
VALUE "FileVersion", "1, 9, 5, 0\0"
VALUE "FileVersion", "1, 9, 6, 0\0"
VALUE "InternalName", "netmanager\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2010\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "netmanager.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "netmanager\0"
VALUE "ProductVersion", "1, 9, 5, 0\0"
VALUE "ProductVersion", "1, 9, 6, 0\0"
VALUE "SpecialBuild", "\0"
END
END


+ 5
- 5
windows/jackportaudio.rc View File

@@ -11,8 +11,8 @@
//
LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
1 VERSIONINFO
FILEVERSION 1,9,5,0
PRODUCTVERSION 1,9,5,0
FILEVERSION 1,9,6,0
PRODUCTVERSION 1,9,6,0
FILEOS VOS_UNKNOWN
FILETYPE VFT_DLL
BEGIN
@@ -23,14 +23,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Grame\0"
VALUE "FileDescription", "Jackmp PortAudio Driver for Windows\0"
VALUE "FileVersion", "1, 9, 5, 0\0"
VALUE "FileVersion", "1, 9, 6, 0\0"
VALUE "InternalName", "jack_portaudio\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2010\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "jack_portaudio.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "jack_portaudio\0"
VALUE "ProductVersion", "1, 9, 5, 0\0"
VALUE "ProductVersion", "1, 9, 6, 0\0"
VALUE "SpecialBuild", "\0"
END
END


+ 5
- 5
windows/jackwinmme.rc View File

@@ -11,8 +11,8 @@
//
LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
1 VERSIONINFO
FILEVERSION 1,9,5,0
PRODUCTVERSION 1,9,5,0
FILEVERSION 1,9,6,0
PRODUCTVERSION 1,9,6,0
FILEOS VOS_UNKNOWN
FILETYPE VFT_DLL
BEGIN
@@ -23,14 +23,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Grame\0"
VALUE "FileDescription", "Jackmp WinMMEo Driver for Windows\0"
VALUE "FileVersion", "1, 9, 5, 0\0"
VALUE "FileVersion", "1, 9, 6, 0\0"
VALUE "InternalName", "jack_portaudio\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2010\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "jack_winmme.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "jack_winmme\0"
VALUE "ProductVersion", "1, 9, 5, 0\0"
VALUE "ProductVersion", "1, 9, 6, 0\0"
VALUE "SpecialBuild", "\0"
END
END


+ 5
- 5
windows/libjack.rc View File

@@ -11,8 +11,8 @@
//
LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
1 VERSIONINFO
FILEVERSION 1,9,5,0
PRODUCTVERSION 1,9,5,0
FILEVERSION 1,9,6,0
PRODUCTVERSION 1,9,6,0
FILEOS VOS_UNKNOWN
FILETYPE VFT_DLL
BEGIN
@@ -23,14 +23,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Grame\0"
VALUE "FileDescription", "Jack client library for Windows\0"
VALUE "FileVersion", "1, 9, 5, 0\0"
VALUE "FileVersion", "1, 9, 6, 0\0"
VALUE "InternalName", "libjack\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2009\0"
VALUE "LegalCopyright", "Copyright Grame © 2006-2010\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "libjack.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "libjack\0"
VALUE "ProductVersion", "1, 9, 5, 0\0"
VALUE "ProductVersion", "1, 9, 6, 0\0"
VALUE "SpecialBuild", "\0"
END
END


+ 5
- 5
windows/libjackserver.rc View File

@@ -11,8 +11,8 @@
//
LANGUAGE LANG_FRENCH, SUBLANG_DEFAULT
1 VERSIONINFO
FILEVERSION 1,9,5,0
PRODUCTVERSION 1,9,5,0
FILEVERSION 1,9,6,0
PRODUCTVERSION 1,9,6,0
FILEOS VOS_UNKNOWN
FILETYPE VFT_DLL
BEGIN
@@ -23,14 +23,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Grame\0"
VALUE "FileDescription", "Jack server library for Windows\0"
VALUE "FileVersion", "1, 9, 5, 0\0"
VALUE "FileVersion", "1, 9, 56, 0\0"