Browse Source

Merge branch 'master' into js-dbus

tags/1.9.8
Stephane Letz 14 years ago
parent
commit
4e979b9649
14 changed files with 180 additions and 130 deletions
  1. +36
    -32
      ChangeLog
  2. +3
    -3
      common/JackAPI.cpp
  3. +1
    -1
      common/JackControlAPI.cpp
  4. +1
    -1
      common/JackFrameTimer.cpp
  5. +29
    -33
      common/JackNetAPI.cpp
  6. +7
    -2
      common/JackNetDriver.cpp
  7. +6
    -6
      common/JackNetInterface.cpp
  8. +15
    -5
      common/JackNetManager.cpp
  9. +30
    -18
      common/JackNetTool.cpp
  10. +34
    -11
      common/JackNetTool.h
  11. +1
    -1
      common/JackServerGlobals.cpp
  12. +7
    -7
      macosx/JackMachSemaphore.cpp
  13. +8
    -8
      posix/JackPosixSemaphore.cpp
  14. +2
    -2
      windows/JackWinNamedPipeServerChannel.cpp

+ 36
- 32
ChangeLog View File

@@ -35,6 +35,10 @@ Chris Caudle
Jackdmp changes log
---------------------------

2011-07-22 Stephane Letz <letz@grame.fr>

* NetJack2: improve error reporting.

2011-07-16 Stephane Letz <letz@grame.fr>

* Error in JackActivationCount::Signal now uses jack_log instead of jack_error.
@@ -78,12 +82,12 @@ Chris Caudle

2011-06-17 Stephane Letz <letz@grame.fr>

* NetJack2 : connection error handling.
* NetJack2: connection error handling.

2011-06-16 Stephane Letz <letz@grame.fr>

* Changes in NetJack2 connection management: no more timeout, any transmission error considered as fatal.
* NetJack2 : timeout again...
* NetJack2: timeout again...

2011-06-11 Stephane Letz <letz@grame.fr>

@@ -96,7 +100,7 @@ Chris Caudle

2011-06-09 Stephane Letz <letz@grame.fr>

* Correct NetJack2 connection handling
* Correct NetJack2 connection handling.

2011-05-27 Stephane Letz <letz@grame.fr>

@@ -116,7 +120,7 @@ Chris Caudle

2011-05-02 Stephane Letz <letz@grame.fr>

* Merge branch 'switch-master-port-registration-notifications : correct driver port registration.
* Merge branch switch-master-port-registration-notifications: correct driver port registration.

2011-04-21 Stephane Letz <letz@grame.fr>

@@ -140,7 +144,7 @@ Chris Caudle

2011-04-02 Stephane Letz <letz@grame.fr>

* Netdriver can now ask for in/out values from the master (in progress).
* NetDriver can now ask for in/out values from the master (in progress).
* Correct drivers parameter settings.

2011-04-01 Stephane Letz <letz@grame.fr>
@@ -238,7 +242,7 @@ Chris Caudle

2010-11-17 Stephane Letz <letz@grame.fr>

* ALSA backend : suspend/resume handling (jack1 r4075).
* ALSA backend: suspend/resume handling (jack1 r4075).
* Correct dummy driver.

2010-11-05 Stephane Letz <letz@grame.fr>
@@ -290,7 +294,7 @@ Chris Caudle

2010-06-13 Stephane Letz <letz@grame.fr>

* Fix JackPosixSemaphore::TimedWait : same behavior as JackPosixSemaphore::Wait regarding EINTR.
* Fix JackPosixSemaphore::TimedWait: same behavior as JackPosixSemaphore::Wait regarding EINTR.

2010-05-31 Stephane Letz <letz@grame.fr>

@@ -337,7 +341,7 @@ Chris Caudle

2010-03-04 Stephane Letz <letz@grame.fr>

* Correct JackMachServerChannel::Execute : keep running even in error cases.
* Correct JackMachServerChannel::Execute: keep running even in error cases.
* Raise JACK_PROTOCOL_VERSION number.

2010-03-03 Stephane Letz <letz@grame.fr>
@@ -346,7 +350,7 @@ Chris Caudle

2010-03-02 Stephane Letz <letz@grame.fr>

* Improve JackCoreAudioDriver and JackCoreAudioAdapter : when no devices are described, takes default input and output and aggregate them.
* Improve JackCoreAudioDriver and JackCoreAudioAdapter: when no devices are described, takes default input and output and aggregate them.

2010-02-15 Stephane Letz <letz@grame.fr>

@@ -388,7 +392,7 @@ Chris Caudle

2009-12-01 Stephane Letz <letz@grame.fr>

* Fix port_rename callback : now both old name and new name are given as parameters.
* Fix port_rename callback: now both old name and new name are given as parameters.

2009-11-30 Stephane Letz <letz@grame.fr>

@@ -418,7 +422,7 @@ Chris Caudle
2009-11-17 Stephane Letz <letz@grame.fr>

* 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).
* In JackCoreAudio driver, clock drift compensation semantic changed a bit: when on, does not activate if not needed (same clock domain).

2009-11-16 Stephane Letz <letz@grame.fr>

@@ -426,14 +430,14 @@ Chris Caudle

2009-11-14 Stephane Letz <letz@grame.fr>

* Sync with JACK1 : -r parameter now used for no-realtime, realtime (-R) is now default, usable backend given vie platform.
* Sync with JACK1: -r parameter now used for no-realtime, realtime (-R) is now default, usable backend given vie platform.

2009-11-13 Stephane Letz <letz@grame.fr>

* 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.
* Simplify server temporary mode: now use a JackTemporaryException.
* Lock/Unlock shared memory segments (to test...).

2009-11-12 Stephane Letz <letz@grame.fr>
@@ -450,12 +454,12 @@ Chris Caudle

2009-11-09 Stephane Letz <letz@grame.fr>

* Correct JackGraphManager::GetBuffer for the "client loop with one connection" case : buffer must be copied.
* Correct JackGraphManager::GetBuffer for the "client loop with one connection" case: buffer must be copied.

2009-11-07 Stephane Letz <letz@grame.fr>

* 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 JackPosixThread::StartImp: thread priority setting now done in the RT case only.

2009-11-06 Stephane Letz <letz@grame.fr>

@@ -496,7 +500,7 @@ Chris Caudle

2009-10-25 Stephane Letz <letz@grame.fr>

* Improve aggregate device management in JackCoreAudioDriver : now a "private" device only and cleanup properly.
* Improve aggregate device management in JackCoreAudioDriver: now a "private" device only and cleanup properly.
* Aggregate device code added to JackCoreAudioAdapter.

2009-10-23 Stephane Letz <letz@grame.fr>
@@ -517,7 +521,7 @@ Chris Caudle

2009-10-17 Stephane Letz <letz@grame.fr>

* Correct server temporary mode : now set a global and quit after server/client message handling is finished.
* Correct server temporary mode: now set a global and quit after server/client message handling is finished.

2009-10-15 Stephane Letz <letz@grame.fr>

@@ -598,12 +602,12 @@ Chris Caudle

2009-06-30 Stephane Letz <letz@grame.fr>

* Tim Bechmann patch : hammerfall, only release monitor thread, if it has been created.
* Tim Bechmann patch: hammerfall, only release monitor thread, if it has been created.

2009-06-19 Stephane Letz <letz@grame.fr>

* Correct JackTransportEngine::MakeAllLocating, sync callback has to be called in this case also.
* NetJack2 code : better error checkout, method renaming.
* NetJack2 code: better error checkout, method renaming.

2009-06-17 Stephane Letz <letz@grame.fr>

@@ -703,7 +707,7 @@ Chris Caudle

2009-03-11 Stephane Letz <letz@grame.fr>

* Client incorrect re-naming fixed : now done at socket level also.
* Client incorrect re-naming fixed: now done at socket level also.

2009-03-10 Stephane Letz <letz@grame.fr>

@@ -918,7 +922,7 @@ Chris Caudle

2008-10-08 Stephane Letz <letz@grame.fr>
* Fix a SMP related bug introduced in rev 2957 : remove the __SMP__ flag and define LOCK for SMP in all cases.
* Fix a SMP related bug introduced in rev 2957: remove the __SMP__ flag and define LOCK for SMP in all cases.

2008-10-02 Stephane Letz <letz@grame.fr>
@@ -933,7 +937,7 @@ Chris Caudle

2008-10-10 Stephane Letz <letz@grame.fr>
* Improve OSS backend : SNDCTL_DSP_SETFRAGMENT must be done before, use of AFMT_S16_LE kind of values.
* Improve OSS backend: SNDCTL_DSP_SETFRAGMENT must be done before, use of AFMT_S16_LE kind of values.

2008-10-09 Stephane Letz <letz@grame.fr>
@@ -942,7 +946,7 @@ Chris Caudle

2008-10-08 Stephane Letz <letz@grame.fr>
* Fix a SMP related bug introduced in rev 2957 : remove the __SMP__ flag and define LOCK for SMP in all cases.
* Fix a SMP related bug introduced in rev 2957: remove the __SMP__ flag and define LOCK for SMP in all cases.

2008-10-03 Stephane Letz <letz@grame.fr>
@@ -1059,7 +1063,7 @@ Chris Caudle
2008-07-08 Stephane Letz <letz@grame.fr>

* Add jack_get_descriptor in internal clients API.
* Fix JackFreewheelDriver::Process() in case if client time-out : continue processing until a better recovery strategy is chosen.
* Fix JackFreewheelDriver::Process() in case if client time-out: continue processing until a better recovery strategy is chosen.

2008-07-08 Stephane Letz <letz@grame.fr>

@@ -1132,7 +1136,7 @@ Chris Caudle

2008-06-02 Stephane Letz <letz@grame.fr>

* Tim Blechmann patch to remove unnecessary virtual methods : choice of the appropriate platform version is now done at compilation time.
* Tim Blechmann patch to remove unnecessary virtual methods: choice of the appropriate platform version is now done at compilation time.

2008-06-02 Stephane Letz <letz@grame.fr>

@@ -1159,12 +1163,12 @@ Chris Caudle

2008-05-27 Stephane Letz <letz@grame.fr>

* Correct timing in drivers : frame time has to be incremented before Read.
* Correct timing in drivers: frame time has to be incremented before Read.

2008-05-26 Stephane Letz <letz@grame.fr>

* Merge control branch.
* Cleanup example clients : use jack_client_open and install a proper 'quit' signal handler.
* Cleanup example clients: use jack_client_open and install a proper 'quit' signal handler.

2008-05-24 Stephane Letz <letz@grame.fr>

@@ -1185,7 +1189,7 @@ Chris Caudle

* Correct JackEngine::PortUnRegister, JackEngine::ClientCloseAux and JackEngine::ClientDeactivate to correctly send notifications.
* New jack_get_client_pid API, implemented on server side.
* Better handling of graph state read functions : never wait when used in the real-time thread, current state is used.
* Better handling of graph state read functions: never wait when used in the real-time thread, current state is used.

2008-05-20 Stephane Letz <letz@grame.fr>

@@ -1195,7 +1199,7 @@ Chris Caudle
2008-05-19 Stephane Letz <letz@grame.fr>

* Use of placement new for dynamic port allocation is possibly not safe... so avoid that until a definitive answer is found.
* JackAudioDriver::ProcessAsync and JackAudioDriver::ProcessSync were broken at some point : 0 has to be returned in all cases.
* JackAudioDriver::ProcessAsync and JackAudioDriver::ProcessSync were broken at some point: 0 has to be returned in all cases.

2008-05-16 Stephane Letz <letz@grame.fr>

@@ -1224,7 +1228,7 @@ Chris Caudle

2008-05-05 Stephane Letz <letz@grame.fr>

* Fix JackClient::Close : notification channel is stopped first to avoid receiving notifications while closing and Close is again a synchronous call.
* Fix JackClient::Close: notification channel is stopped first to avoid receiving notifications while closing and Close is again a synchronous call.
* No more remaining client close in JackEngine::Close().

2008-05-01 Stephane Letz <letz@grame.fr>
@@ -1265,7 +1269,7 @@ Chris Caudle
2008-03-29 Stephane Letz <letz@grame.fr>
* Correct a missing parameter in the usage message of jack_midiseq.
* Add a client counter in wrapper layer : library is unloaded only when all clients have been closed.
* Add a client counter in wrapper layer: library is unloaded only when all clients have been closed.

2008-03-28 Stephane Letz <letz@grame.fr>
@@ -1455,7 +1459,7 @@ Chris Caudle

2008-01-03 Stephane Letz <letz@grame.fr>

* Dmitry Baikov MIDI patch : alsa_seqmidi and alsa_rammidi drivers.
* Dmitry Baikov MIDI patch: alsa_seqmidi and alsa_rammidi drivers.

2008-01-03 Stephane Letz <letz@grame.fr>



+ 3
- 3
common/JackAPI.cpp View File

@@ -1993,7 +1993,7 @@ LIB_EXPORT int jack_set_session_callback(jack_client_t* ext_client, JackSessionC
}
}

LIB_EXPORT jack_session_command_t *jack_session_notify(jack_client_t* ext_client, const char* target, jack_session_event_type_t ev_type, const char* path)
LIB_EXPORT jack_session_command_t* jack_session_notify(jack_client_t* ext_client, const char* target, jack_session_event_type_t ev_type, const char* path)
{
#ifdef __CLIENTDEBUG__
JackGlobals::CheckContext("jack_session_notify");
@@ -2039,7 +2039,7 @@ LIB_EXPORT void jack_session_event_free(jack_session_event_t* ev)
}
}

LIB_EXPORT char *jack_get_uuid_for_client_name(jack_client_t* ext_client, const char* client_name)
LIB_EXPORT char* jack_get_uuid_for_client_name(jack_client_t* ext_client, const char* client_name)
{
#ifdef __CLIENTDEBUG__
JackGlobals::CheckContext("jack_get_uuid_for_client_name");
@@ -2054,7 +2054,7 @@ LIB_EXPORT char *jack_get_uuid_for_client_name(jack_client_t* ext_client, const
}
}

LIB_EXPORT char *jack_get_client_name_by_uuid(jack_client_t* ext_client, const char* client_uuid)
LIB_EXPORT char* jack_get_client_name_by_uuid(jack_client_t* ext_client, const char* client_uuid)
{
#ifdef __CLIENTDEBUG__
JackGlobals::CheckContext("jack_get_client_name_by_uuid");


+ 1
- 1
common/JackControlAPI.cpp View File

@@ -1203,7 +1203,7 @@ LIB_EXPORT bool jackctl_server_unload_internal(
{
int status;
if (server_ptr->engine != NULL && internal->refnum > 0) {
// Client object is internally kept in JackEngine, and will be desallocated in InternalClientUnload
// Client object is internally kept in JackEngine, and will be deallocated in InternalClientUnload
return ((server_ptr->engine->GetEngine()->InternalClientUnload(internal->refnum, &status)) == 0);
} else {
return false;


+ 1
- 1
common/JackFrameTimer.cpp View File

@@ -13,7 +13,7 @@ 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
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/


+ 29
- 33
common/JackNetAPI.cpp View File

@@ -298,70 +298,66 @@ struct JackNetExtMaster : public JackNetMasterInterface {

void AllocPorts()
{
int port_index;

// Set buffers
// Set buffers
if (fParams.fSendAudioChannels > 0) {
fAudioCaptureBuffer = new float*[fParams.fSendAudioChannels];
for (port_index = 0; port_index < fParams.fSendAudioChannels; port_index++) {
fAudioCaptureBuffer[port_index] = new float[fParams.fPeriodSize];
fNetAudioCaptureBuffer->SetBuffer(port_index, fAudioCaptureBuffer[port_index]);
for (int audio_port_index = 0; audio_port_index < fParams.fSendAudioChannels; audio_port_index++) {
fAudioCaptureBuffer[audio_port_index] = new float[fParams.fPeriodSize];
fNetAudioCaptureBuffer->SetBuffer(audio_port_index, fAudioCaptureBuffer[audio_port_index]);
}
}

if (fParams.fSendMidiChannels > 0) {
fMidiCaptureBuffer = new JackMidiBuffer*[fParams.fSendMidiChannels];
for (port_index = 0; port_index < fParams.fSendMidiChannels; port_index++) {
fMidiCaptureBuffer[port_index] = (JackMidiBuffer*)new float[fParams.fPeriodSize];
fNetMidiCaptureBuffer->SetBuffer(port_index, fMidiCaptureBuffer[port_index]);
for (int midi_port_index = 0; midi_port_index < fParams.fSendMidiChannels; midi_port_index++) {
fMidiCaptureBuffer[midi_port_index] = (JackMidiBuffer*)new float[fParams.fPeriodSize];
fNetMidiCaptureBuffer->SetBuffer(midi_port_index, fMidiCaptureBuffer[midi_port_index]);
}
}

if (fParams.fReturnAudioChannels > 0) {
fAudioPlaybackBuffer = new float*[fParams.fReturnAudioChannels];
for (port_index = 0; port_index < fParams.fReturnAudioChannels; port_index++) {
fAudioPlaybackBuffer[port_index] = new float[fParams.fPeriodSize];
fNetAudioPlaybackBuffer->SetBuffer(port_index, fAudioPlaybackBuffer[port_index]);
for (int audio_port_index = 0; audio_port_index < fParams.fReturnAudioChannels; audio_port_index++) {
fAudioPlaybackBuffer[audio_port_index] = new float[fParams.fPeriodSize];
fNetAudioPlaybackBuffer->SetBuffer(audio_port_index, fAudioPlaybackBuffer[audio_port_index]);
}
}

if (fParams.fReturnMidiChannels > 0) {
fMidiPlaybackBuffer = new JackMidiBuffer*[fParams.fReturnMidiChannels];
for (port_index = 0; port_index < fParams.fReturnMidiChannels; port_index++) {
fMidiPlaybackBuffer[port_index] = (JackMidiBuffer*)new float[fParams.fPeriodSize];
fNetMidiPlaybackBuffer->SetBuffer(port_index, fMidiPlaybackBuffer[port_index]);
for (int midi_port_index = 0; midi_port_index < fParams.fReturnMidiChannels; midi_port_index++) {
fMidiPlaybackBuffer[midi_port_index] = (JackMidiBuffer*)new float[fParams.fPeriodSize];
fNetMidiPlaybackBuffer->SetBuffer(midi_port_index, fMidiPlaybackBuffer[midi_port_index]);
}
}
}

void FreePorts()
{
int port_index;

if (fAudioPlaybackBuffer) {
for (port_index = 0; port_index < fParams.fSendAudioChannels; port_index++)
delete[] fAudioPlaybackBuffer[port_index];
for (int audio_port_index = 0; audio_port_index < fParams.fSendAudioChannels; audio_port_index++)
delete[] fAudioPlaybackBuffer[audio_port_index];
delete[] fAudioPlaybackBuffer;
fAudioPlaybackBuffer = NULL;
}

if (fMidiPlaybackBuffer) {
for (port_index = 0; port_index < fParams.fSendMidiChannels; port_index++)
delete[] (fMidiPlaybackBuffer[port_index]);
for (int midi_port_index = 0; midi_port_index < fParams.fSendMidiChannels; midi_port_index++)
delete[] (fMidiPlaybackBuffer[midi_port_index]);
delete[] fMidiPlaybackBuffer;
fMidiPlaybackBuffer = NULL;
}

if (fAudioCaptureBuffer) {
for (port_index = 0; port_index < fParams.fReturnAudioChannels; port_index++)
delete[] fAudioCaptureBuffer[port_index];
for (int audio_port_index = 0; audio_port_index < fParams.fReturnAudioChannels; audio_port_index++)
delete[] fAudioCaptureBuffer[audio_port_index];
delete[] fAudioCaptureBuffer;
fAudioCaptureBuffer = NULL;
}

if (fMidiCaptureBuffer) {
for (port_index = 0; port_index < fParams.fReturnMidiChannels; port_index++)
delete[] fMidiCaptureBuffer[port_index];
for (int midi_port_index = 0; midi_port_index < fParams.fReturnMidiChannels; midi_port_index++)
delete[] fMidiCaptureBuffer[midi_port_index];
delete[] fMidiCaptureBuffer;
fMidiCaptureBuffer = NULL;
}
@@ -372,12 +368,12 @@ struct JackNetExtMaster : public JackNetMasterInterface {
try {
assert(audio_input == fParams.fReturnAudioChannels);

for (int port_index = 0; port_index < audio_input; port_index++) {
fNetAudioPlaybackBuffer->SetBuffer(port_index, audio_input_buffer[port_index]);
for (int audio_port_index = 0; audio_port_index < audio_input; audio_port_index++) {
fNetAudioPlaybackBuffer->SetBuffer(audio_port_index, audio_input_buffer[audio_port_index]);
}

for (int port_index = 0; port_index < midi_input; port_index++) {
fNetMidiPlaybackBuffer->SetBuffer(port_index, ((JackMidiBuffer**)midi_input_buffer)[port_index]);
for (int midi_port_index = 0; midi_port_index < midi_input; midi_port_index++) {
fNetMidiPlaybackBuffer->SetBuffer(midi_port_index, ((JackMidiBuffer**)midi_input_buffer)[midi_port_index]);
}

if (SyncRecv() == SOCKET_ERROR)
@@ -397,12 +393,12 @@ struct JackNetExtMaster : public JackNetMasterInterface {
try {
assert(audio_output == fParams.fSendAudioChannels);

for (int port_index = 0; port_index < audio_output; port_index++) {
fNetAudioCaptureBuffer->SetBuffer(port_index, audio_output_buffer[port_index]);
for (int audio_port_index = 0; audio_port_index < audio_output; audio_port_index++) {
fNetAudioCaptureBuffer->SetBuffer(audio_port_index, audio_output_buffer[audio_port_index]);
}

for (int port_index = 0; port_index < midi_output; port_index++) {
fNetMidiCaptureBuffer->SetBuffer(port_index, ((JackMidiBuffer**)midi_output_buffer)[port_index]);
for (int midi_port_index = 0; midi_port_index < midi_output; midi_port_index++) {
fNetMidiCaptureBuffer->SetBuffer(midi_port_index, ((JackMidiBuffer**)midi_output_buffer)[midi_port_index]);
}

EncodeSyncPacket();


+ 7
- 2
common/JackNetDriver.cpp View File

@@ -554,8 +554,13 @@ namespace Jack
fNetTimeMon->Add(((float)(GetMicroSeconds() - fRcvSyncUst) / (float)fEngineControl->fPeriodUsecs) * 100.f);
#endif
//audio, midi or sync if driver is late
if (DataRecv() == SOCKET_ERROR)
int res = DataRecv();
if (res == SOCKET_ERROR) {
return SOCKET_ERROR;
} else if (res == NET_PACKET_ERROR) {
jack_time_t cur_time = GetMicroSeconds();
NotifyXRun(cur_time, float(cur_time - fBeginDateUst)); // Better this value than nothing...
}

//take the time at the beginning of the cycle
JackDriver::CycleTakeBeginTime();
@@ -576,7 +581,7 @@ namespace Jack
for (int audio_port_index = 0; audio_port_index < fPlaybackChannels; audio_port_index++) {
#ifdef OPTIMIZED_PROTOCOL
// Port is connected on other side...
if ((long)fNetAudioPlaybackBuffer->GetBuffer(audio_port_index) == -1) {
if ((intptr_t)fNetAudioPlaybackBuffer->GetBuffer(audio_port_index) == -1) {
fNetAudioPlaybackBuffer->SetBuffer(audio_port_index, GetOutputBuffer(audio_port_index, true));
} else {
fNetAudioPlaybackBuffer->SetBuffer(audio_port_index, NULL);


+ 6
- 6
common/JackNetInterface.cpp View File

@@ -477,7 +477,7 @@ namespace Jack
int rx_bytes = Recv(fParams.fMtu, MSG_PEEK);

if ((rx_bytes == 0) || (rx_bytes == SOCKET_ERROR)) {
// O bytes considered an error (lost connection)
// 0 bytes considered an error (lost connection)
return SOCKET_ERROR;
}

@@ -581,7 +581,7 @@ namespace Jack
fRxHeader.fSubCycle = rx_head->fSubCycle;
fRxHeader.fIsLastPckt = rx_head->fIsLastPckt;
fRxHeader.fActivePorts = rx_head->fActivePorts;
fNetAudioPlaybackBuffer->RenderFromNetwork(rx_head->fCycle, rx_head->fSubCycle, rx_bytes - HEADER_SIZE, fRxHeader.fActivePorts);
rx_bytes = fNetAudioPlaybackBuffer->RenderFromNetwork(rx_head->fCycle, rx_head->fSubCycle, rx_bytes - HEADER_SIZE, fRxHeader.fActivePorts);
// Last audio packet is received, so finish rendering...
if (fRxHeader.fIsLastPckt)
fNetAudioPlaybackBuffer->RenderToJackPorts();
@@ -591,7 +591,7 @@ namespace Jack
jack_info("NetMaster : overloaded, skipping receive from '%s'", fParams.fName);
// TODO : finish midi and audio rendering ?
fNetAudioPlaybackBuffer->RenderToJackPorts();
return 0;
return NET_PACKET_ERROR;
}
}
}
@@ -978,7 +978,7 @@ namespace Jack
fRxHeader.fSubCycle = rx_head->fSubCycle;
fRxHeader.fIsLastPckt = rx_head->fIsLastPckt;
fRxHeader.fActivePorts = rx_head->fActivePorts;
fNetAudioCaptureBuffer->RenderFromNetwork(rx_head->fCycle, rx_head->fSubCycle, rx_bytes - HEADER_SIZE, fRxHeader.fActivePorts);
rx_bytes = fNetAudioCaptureBuffer->RenderFromNetwork(rx_head->fCycle, rx_head->fSubCycle, rx_bytes - HEADER_SIZE, fRxHeader.fActivePorts);
// Last audio packet is received, so finish rendering...
if (fRxHeader.fIsLastPckt)
fNetAudioCaptureBuffer->RenderToJackPorts();
@@ -988,13 +988,13 @@ namespace Jack
jack_info("NetSlave : overloaded, skipping receive");
// TODO : finish midi and audio rendering ?
fNetAudioCaptureBuffer->RenderToJackPorts();
return 0;
return NET_PACKET_ERROR;
}
}
}

fRxHeader.fCycle = rx_head->fCycle;
return 0;
return rx_bytes;
}

int JackNetSlaveInterface::SyncSend()


+ 15
- 5
common/JackNetManager.cpp View File

@@ -19,6 +19,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackNetManager.h"
#include "JackArgParser.h"
#include "JackTime.h"
#include "JackServerGlobals.h"
#include "JackLockedEngine.h"

using namespace std;

@@ -407,7 +409,11 @@ namespace Jack
//process-----------------------------------------------------------------------------
int JackNetMaster::SetProcess(jack_nframes_t nframes, void* arg)
{
return static_cast<JackNetMaster*> ( arg )->Process();
try {
return static_cast<JackNetMaster*>(arg)->Process();
} catch (JackNetException& e) {
return 0;
}
}

int JackNetMaster::Process()
@@ -431,7 +437,7 @@ namespace Jack
for (int audio_port_index = 0; audio_port_index < fParams.fSendAudioChannels; audio_port_index++) {

#ifdef OPTIMIZED_PROTOCOL
if ((long)fNetAudioCaptureBuffer->GetBuffer(audio_port_index) == -1) {
if ((intptr_t)fNetAudioCaptureBuffer->GetBuffer(audio_port_index) == -1) {
// Port is connected on other side...
fNetAudioCaptureBuffer->SetBuffer(audio_port_index,
static_cast<sample_t*>(jack_port_get_buffer_nulled(fAudioCapturePorts[audio_port_index],
@@ -441,8 +447,8 @@ namespace Jack
}
#else
fNetAudioCaptureBuffer->SetBuffer(audio_port_index,
static_cast<sample_t*>(jack_port_get_buffer(fAudioCapturePorts[audio_port_index],
fParams.fPeriodSize)));
static_cast<sample_t*>(jack_port_get_buffer(fAudioCapturePorts[audio_port_index],
fParams.fPeriodSize)));
#endif
// TODO
}
@@ -523,8 +529,12 @@ namespace Jack

//receive data
res = DataRecv();
if ((res == 0) || (res == SOCKET_ERROR))
if ((res == 0) || (res == SOCKET_ERROR)) {
return res;
} else if (res == NET_PACKET_ERROR) {
// Well not a real XRun, but...
JackServerGlobals::fInstance->GetEngine()->NotifyXRun(GetMicroSeconds(), 0);
}

/*
switch (DataRecv()) {


+ 30
- 18
common/JackNetTool.cpp View File

@@ -25,23 +25,25 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

class HardwareClock
{
public:
HardwareClock();
public:

void Reset();
void Update();
HardwareClock();

float GetDeltaTime() const;
double GetTime() const;
void Reset();
void Update();

private:
double m_clockToSeconds;
float GetDeltaTime() const;
double GetTime() const;

uint64_t m_startAbsTime;
uint64_t m_lastAbsTime;
private:

double m_time;
float m_deltaTime;
double m_clockToSeconds;

uint64_t m_startAbsTime;
uint64_t m_lastAbsTime;

double m_time;
float m_deltaTime;
};

HardwareClock::HardwareClock()
@@ -228,9 +230,9 @@ namespace Jack
}

//network<->buffer
void NetFloatAudioBuffer::RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
int NetFloatAudioBuffer::RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
{
fPortBuffer.RenderFromNetwork(fNetBuffer, cycle, sub_cycle, copy_size, port_num);
return fPortBuffer.RenderFromNetwork(fNetBuffer, cycle, sub_cycle, copy_size, port_num);
}

int NetFloatAudioBuffer::RenderToNetwork(int sub_cycle, uint32_t& port_num)
@@ -443,8 +445,10 @@ namespace Jack
}

//network<->buffer
void NetCeltAudioBuffer::RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
int NetCeltAudioBuffer::RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
{
int res = 0;

if (sub_cycle == fNumPackets - 1) {
for (int port_index = 0; port_index < fNPorts; port_index++)
memcpy(fCompressedBuffer[port_index] + sub_cycle * fSubPeriodBytesSize, fNetBuffer + port_index * fLastSubPeriodBytesSize, fLastSubPeriodBytesSize);
@@ -453,10 +457,13 @@ namespace Jack
memcpy(fCompressedBuffer[port_index] + sub_cycle * fSubPeriodBytesSize, fNetBuffer + port_index * fSubPeriodBytesSize, fSubPeriodBytesSize);
}

if (sub_cycle != fLastSubCycle + 1)
if (sub_cycle != fLastSubCycle + 1) {
jack_error("Packet(s) missing from... %d %d", fLastSubCycle, sub_cycle);
res = NET_PACKET_ERROR;
}

fLastSubCycle = sub_cycle;
return res;
}

int NetCeltAudioBuffer::RenderToNetwork(int sub_cycle, uint32_t& port_num)
@@ -573,8 +580,10 @@ namespace Jack
}

//network<->buffer
void NetIntAudioBuffer::RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
int NetIntAudioBuffer::RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
{
int res = 0;

if (sub_cycle == fNumPackets - 1) {
for (int port_index = 0; port_index < fNPorts; port_index++)
memcpy(fIntBuffer[port_index] + sub_cycle * fSubPeriodSize, fNetBuffer + port_index * fLastSubPeriodBytesSize, fLastSubPeriodBytesSize);
@@ -583,10 +592,13 @@ namespace Jack
memcpy(fIntBuffer[port_index] + sub_cycle * fSubPeriodSize, fNetBuffer + port_index * fSubPeriodBytesSize, fSubPeriodBytesSize);
}

if (sub_cycle != fLastSubCycle + 1)
if (sub_cycle != fLastSubCycle + 1) {
jack_error("Packet(s) missing from... %d %d", fLastSubCycle, sub_cycle);
res = NET_PACKET_ERROR;
}

fLastSubCycle = sub_cycle;
return res;
}

int NetIntAudioBuffer::RenderToNetwork(int sub_cycle, uint32_t& port_num)


+ 34
- 11
common/JackNetTool.h View File

@@ -42,6 +42,8 @@ using namespace std;
#define MASTER_PROTOCOL 4
#define SLAVE_PROTOCOL 4

#define NET_PACKET_ERROR -2

#define OPTIMIZED_PROTOCOL

namespace Jack
@@ -288,7 +290,7 @@ namespace Jack
virtual void RenderToJackPorts() = 0;

//network<->buffer
virtual void RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num) = 0;
virtual int RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num) = 0;
virtual void ActivePortsFromNetwork(char* net_buffer, uint32_t port_num) {}

virtual int RenderToNetwork(int sub_cycle, uint32_t& port_num) = 0;
@@ -366,7 +368,7 @@ namespace Jack
fPortBuffer = 0;
}

~JackPortList()
virtual ~JackPortList()
{
delete [] fPortBuffer;
}
@@ -424,8 +426,10 @@ namespace Jack
{}

//network<->buffer
virtual void RenderFromNetwork(char* net_buffer, int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
virtual int RenderFromNetwork(char* net_buffer, int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
{
int res = 0;

for (int port_index = 0; port_index < fNPorts; port_index++) {
float* src = (float*)(net_buffer + port_index * fSubPeriodBytesSize);
float* dst = (float*)(fPortBuffer[port_index] + sub_cycle * fSubPeriodSize);
@@ -435,8 +439,11 @@ namespace Jack
}
if (sub_cycle != fLastSubCycle + 1) {
jack_error("Packet(s) missing from... %d %d", fLastSubCycle, sub_cycle);
res = NET_PACKET_ERROR;
}

fLastSubCycle = sub_cycle;
return res;
}

virtual int RenderToNetwork(char* net_buffer, int sub_cycle, uint32_t& port_num)
@@ -465,15 +472,20 @@ namespace Jack
}

//network<->buffer
virtual void RenderFromNetwork(char* net_buffer, int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
virtual int RenderFromNetwork(char* net_buffer, int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
{
int res = 0;

for (int port_index = 0; port_index < fNPorts; port_index++) {
memcpy(fPortBuffer[port_index] + sub_cycle * fSubPeriodSize, net_buffer + port_index * fSubPeriodBytesSize, fSubPeriodBytesSize);
}
if (sub_cycle != fLastSubCycle + 1) {
jack_error("Packet(s) missing from... %d %d", fLastSubCycle, sub_cycle);
res = NET_PACKET_ERROR;
}

fLastSubCycle = sub_cycle;
return res;
}

virtual int RenderToNetwork(char* net_buffer, int sub_cycle, uint32_t& port_num)
@@ -506,6 +518,9 @@ namespace Jack
:JackPortList(params, nports)
{}

virtual ~JackOptimizedPortList()
{}

int GetNumPackets()
{
// Count active ports
@@ -532,8 +547,10 @@ namespace Jack
#else

//network<->buffer
virtual void RenderFromNetwork(char* net_buffer, int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
virtual int RenderFromNetwork(char* net_buffer, int cycle, int sub_cycle, size_t copy_size, uint32_t port_num)
{
int res = 0;

// Cleanup all JACK ports at the beginning of the cycle
if (sub_cycle == 0) {
for (int port_index = 0; port_index < fNPorts; port_index++) {
@@ -554,8 +571,6 @@ namespace Jack
}
sub_period_bytes_size = sub_period_size * sizeof(sample_t) + sizeof(uint32_t); // The port number in coded on 4 bytes



for (uint32_t port_index = 0; port_index < port_num; port_index++) {
// Only copy to active ports : read the active port number then audio data
int* active_port_address = (int*)(net_buffer + port_index * sub_period_bytes_size);
@@ -566,9 +581,13 @@ namespace Jack

if (sub_cycle != fLastSubCycle + 1) {
jack_error("Packet(s) missing from... %d %d", fLastSubCycle, sub_cycle);
res = NET_PACKET_ERROR;
}

fLastSubCycle = sub_cycle;
}

return res;
}

virtual int RenderToNetwork(char* net_buffer,int sub_cycle, uint32_t& port_num)
@@ -618,7 +637,11 @@ namespace Jack

for (uint port_index = 0; port_index < port_num; port_index++) {
// Use -1 when port is actually connected on other side
fPortBuffer[*active_port_address] = (sample_t*)-1;
if (*active_port_address >= 0 && *active_port_address < fNPorts) {
fPortBuffer[*active_port_address] = (sample_t*)-1;
} else {
jack_error("ActivePortsFromNetwork: incorrect port = %d", *active_port_address);
}
active_port_address++;
}
}
@@ -663,7 +686,7 @@ namespace Jack
sample_t* GetBuffer(int index);

//network<->buffer
void RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num);
int RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num);
void ActivePortsFromNetwork(char* net_buffer, uint32_t port_num);

int RenderToNetwork(int sub_cycle, uint32_t& ort_num);
@@ -720,7 +743,7 @@ namespace Jack
void RenderToJackPorts();

//network<->buffer
void RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num);
int RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num);
int RenderToNetwork(int sub_cycle, uint32_t& port_num);
};

@@ -769,7 +792,7 @@ namespace Jack
void RenderToJackPorts();

//network<->buffer
void RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num);
int RenderFromNetwork(int cycle, int sub_cycle, size_t copy_size, uint32_t port_num);
int RenderToNetwork(int sub_cycle, uint32_t& port_num);
};



+ 1
- 1
common/JackServerGlobals.cpp View File

@@ -84,7 +84,7 @@ void JackServerGlobals::Delete()
int status;
int refnum = (*it2).second;
if (refnum > 0) {
// Client object is internally kept in JackEngine, and will be desallocated in InternalClientUnload
// Client object is internally kept in JackEngine, and will be deallocated in InternalClientUnload
fInstance->GetEngine()->InternalClientUnload(refnum, &status);
}
}


+ 7
- 7
macosx/JackMachSemaphore.cpp View File

@@ -12,7 +12,7 @@ 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
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/
@@ -38,7 +38,7 @@ void JackMachSemaphore::BuildName(const char* client_name, const char* server_na
bool JackMachSemaphore::Signal()
{
if (!fSemaphore) {
jack_error("JackMachSemaphore::Signal name = %s already desallocated!!", fName);
jack_error("JackMachSemaphore::Signal name = %s already deallocated!!", fName);
return false;
}

@@ -55,13 +55,13 @@ bool JackMachSemaphore::Signal()
bool JackMachSemaphore::SignalAll()
{
if (!fSemaphore) {
jack_error("JackMachSemaphore::SignalAll name = %s already desallocated!!", fName);
jack_error("JackMachSemaphore::SignalAll name = %s already deallocated!!", fName);
return false;
}

if (fFlush)
return true;
kern_return_t res;
// When signaled several times, do not accumulate signals...
if ((res = semaphore_signal_all(fSemaphore)) != KERN_SUCCESS) {
@@ -73,7 +73,7 @@ bool JackMachSemaphore::SignalAll()
bool JackMachSemaphore::Wait()
{
if (!fSemaphore) {
jack_error("JackMachSemaphore::Wait name = %s already desallocated!!", fName);
jack_error("JackMachSemaphore::Wait name = %s already deallocated!!", fName);
return false;
}

@@ -87,10 +87,10 @@ bool JackMachSemaphore::Wait()
bool JackMachSemaphore::TimedWait(long usec)
{
if (!fSemaphore) {
jack_error("JackMachSemaphore::TimedWait name = %s already desallocated!!", fName);
jack_error("JackMachSemaphore::TimedWait name = %s already deallocated!!", fName);
return false;
}
kern_return_t res;
mach_timespec time;
time.tv_sec = usec / 1000000;


+ 8
- 8
posix/JackPosixSemaphore.cpp View File

@@ -40,7 +40,7 @@ bool JackPosixSemaphore::Signal()
int res;

if (!fSemaphore) {
jack_error("JackPosixSemaphore::Signal name = %s already desallocated!!", fName);
jack_error("JackPosixSemaphore::Signal name = %s already deallocated!!", fName);
return false;
}

@@ -58,7 +58,7 @@ bool JackPosixSemaphore::SignalAll()
int res;

if (!fSemaphore) {
jack_error("JackPosixSemaphore::SignalAll name = %s already desallocated!!", fName);
jack_error("JackPosixSemaphore::SignalAll name = %s already deallocated!!", fName);
return false;
}

@@ -77,7 +77,7 @@ bool JackPosixSemaphore::Wait()
int res;

if (!fSemaphore) {
jack_error("JackPosixSemaphore::Wait name = %s already desallocated!!", fName);
jack_error("JackPosixSemaphore::Wait name = %s already deallocated!!", fName);
return false;
}

@@ -102,14 +102,14 @@ bool JackPosixSemaphore::Wait()

#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) // glibc feature test

bool JackPosixSemaphore::TimedWait(long usec)
bool JackPosixSemaphore::TimedWait(long usec)
{
int res;
struct timeval now;
timespec time;

if (!fSemaphore) {
jack_error("JackPosixSemaphore::TimedWait name = %s already desallocated!!", fName);
jack_error("JackPosixSemaphore::TimedWait name = %s already deallocated!!", fName);
return false;
}
gettimeofday(&now, 0);
@@ -155,7 +155,7 @@ bool JackPosixSemaphore::Allocate(const char* name, const char* server_name, int
bool JackPosixSemaphore::ConnectInput(const char* name, const char* server_name)
{
BuildName(name, server_name, fName);
jack_log("JackPosixSemaphore::Connect %s", fName);
jack_log("JackPosixSemaphore::Connect name = %s", fName);

// Temporary...
if (fSemaphore) {
@@ -187,7 +187,7 @@ bool JackPosixSemaphore::ConnectOutput(const char* name, const char* server_name
bool JackPosixSemaphore::Disconnect()
{
if (fSemaphore) {
jack_log("JackPosixSemaphore::Disconnect %s", fName);
jack_log("JackPosixSemaphore::Disconnect name = %s", fName);
if (sem_close(fSemaphore) != 0) {
jack_error("Disconnect: can't disconnect named semaphore name = %s err = %s", fName, strerror(errno));
return false;
@@ -204,7 +204,7 @@ bool JackPosixSemaphore::Disconnect()
void JackPosixSemaphore::Destroy()
{
if (fSemaphore != NULL) {
jack_log("JackPosixSemaphore::Destroy");
jack_log("JackPosixSemaphore::Destroy name = %s", fName);
sem_unlink(fName);
if (sem_close(fSemaphore) != 0) {
jack_error("Destroy: can't destroy semaphore name = %s err = %s", fName, strerror(errno));


+ 2
- 2
windows/JackWinNamedPipeServerChannel.cpp View File

@@ -71,7 +71,7 @@ void JackClientPipeThread::Close() // Close
/*
TODO : solve WIN32 thread Kill issue
This would hang.. since Close will be followed by a delete,
all ressources will be desallocated at the end.
all ressources will be deallocated at the end.
*/

fThread.Kill();
@@ -478,7 +478,7 @@ void JackWinNamedPipeServerChannel::Close()
{
/* TODO : solve WIN32 thread Kill issue
This would hang the server... since we are quitting it, its not really problematic,
all ressources will be desallocated at the end.
all ressources will be deallocated at the end.

fRequestListenPipe.Close();
fThread.Stop();


Loading…
Cancel
Save